<?php
namespace app\common\model;

use think\Db;

class Task extends Base
{
    const TASK_TYPE_TODO = 1; // 工单
    const TASK_TYPE_PATROL = 2; // 巡更
    const TASK_TYPE_DAILY = 3; // 日常工作
    const TASK_TYPE_DEVICE = 4; // 设备台账
    const TASK_TYPE_QUALITY = 5; // 品控任务
    const TASK_TYPE_GREEN = 6; // 绿化养护

    /**
     * 删除任务
     * @param $type
     * @param $busId
     * @return bool
     */
    public function del($type,$busId){
        try{
            $busIds = explode(',',$busId);
            $map[] = ['bus_id','in',$busIds];
            $map[] = ['type',$type];
            $ret = Db::name('task')
                ->where($map)
                ->delete();
            return $ret?true:false;
        }catch (\Exception $e){
            trace($e->getMessage());
            return false;
        }
    }

}