model = new \app\common\model\Device(); } public function sweepCode(){ $code = input('code','','trim'); $taskId = input('taskId/d',0); $deviceId = input('deviceId/d',0); $ret = $this->model->sweepCode($code,$this->userId,$this->orgId,$taskId,$deviceId); if($ret){ HelpHander::success($ret); }else{ HelpHander::error($this->model->getError()); } } public function deviceInfo(){ $id=input('deviceId'); $ret=$this->model->deviceInfo($id,$this->orgId); if($ret){ HelpHander::success($ret); }else{ HelpHander::error($this->model->getError()); } } //任务列表下所有地点 public function taskAddrAll(){ $taskId = input('taskId/d',0); $ret = $this->model->taskAddrAll($taskId); HelpHander::success($ret); } //我的历史记录 public function myTaskRecord(){ $page = input('page/d',1); $size = input('size/d',10); $type = input('type/d'); $status = input('status',''); if($status == 0){ $status = 2; }elseif ($status == 1){ $status = 3; } $ret = $this->model->myTaskRecord($type,$page,$size,$this->userId,$this->orgId,$status); HelpHander::success($ret); } // 延期申请 public function delay(){ $taskId = input('taskId/d',0); $endTime = input('endTime','','trim'); $reason = input('reason','','trim'); model('DeviceTask')->delayTask($taskId,$endTime,$reason,$this->userId,$this->orgId); HelpHander::success([],'操作成功'); } // 延期申请列表 public function delayLists(){ $page = input('page/d',1); $size = input('size/d',10); $res = model('DeviceTask')->delayLists($page,$size,$this->userId,$this->orgId); HelpHander::success($res,'操作成功'); } // 延期申请取消 public function cancelDelay(){ $id = input('id/d',0); model('DeviceTask')->cancelDelay($id,$this->userId); HelpHander::success([],'操作成功'); } public function taskList(){ $page = input('page',1); $size = input('size',10); $date = input('date',''); if($date!=''){ $map[] = ['create_yyyymmdd','=',date('Ymd',strtotime($date))]; } $map[] = ['a.org_id','=',$this->orgId]; $map[] = ['a.del','=',0]; $map[] = ['a.status','=',0]; $lists = Db::name('device_task') ->alias('a') ->join('device_task_user b','a.id=b.task_id') ->field('a.id,a.start_time,a.end_time,a.title') ->where($map) ->where('b.user_id',$this->userId) ->page($page,$size) ->order('a.id desc') ->select(); HelpHander::success($lists); } }