get('role_id'); $adminRole = new AdminRole(); $row = $adminRole->getInfoById($role_id); return $this->success(dataReturn(0, 'success', $row)); } /** * 上报问题 */ public function store() { $formData = request()->post(); // $orgId = request()->get('org_id'); $formData['find_problem_video'] = json_encode($formData['find_problem_video']); ## if 指定项目部 任务的分配人 $task_allocation_user_id = (new AdminOrg) ->select('task_allocation_user_id') ->where('id', '=', $formData['find_problem_org_id'])->first()['task_allocation_user_id']; if (empty($task_allocation_user_id)) { return sparkSuccess(dataReturn(-1, '该项目部未指定任务分配人,无法添加任务', $formData['find_problem_org_id'])); } ## 给一个默认的分配人 $formData['distribution_person_id'] = $task_allocation_user_id; ##是否有责任人 查询责任人 直接设置已分配 给到固定的人 if (!empty($formData['contacts_id'])) { // $formData['contacts'] = $contacts; $formData['the_problem_is_distribution'] = 2;#已分配 $formData['deal_problem_person_id'] = $formData['contacts_id'];# 分配到处理人id $formData['deal_problem_person_name'] = $formData['contacts'];# 分配到处理人姓名 $formData['distribution_problem_time'] = now();# 分配时间 } unset($formData['contacts_id']);//删除多余字段 unset($formData['contacts']);//删除多余字段 #设置发现人项目部 $org_id = request()->get()['org_id']; $org = getOrg($org_id); $formData['find_problem_person_org_id'] = $org_id; $formData['find_problem_person_org_name'] = $org['name']; $formData['create_time'] = now(); $formData['update_time'] = now(); $formData['find_problem_time'] = date('Y-m-d H:i:s'); $patrolProblem = new PatrolProblem(); $patrolProblem->insertOne($formData); return sparkSuccess(dataReturn(0, 'success', $formData['find_problem_org_id'])); } #获取相应主线的问题列表 public function getPatrolProblem() { $param = request()->get(); $limit = $param['limit'] ?? 10; $where = []; checkEmpty($param, [ "find_problem_type" => "任务类型", 'find_problem_type_source_id' => '任务所属主线id', ]); $where[] = ['find_problem_type', '=', $param['find_problem_type']]; $where[] = ['find_problem_type_source_id', '=', $param['find_problem_type_source_id']]; // if (isset ($param['find_problem_type']) && !empty ($param['find_problem_type'])) { // } // if (isset ($param['find_problem_type_source_id']) && !empty ($param['find_problem_type_source_id'])) { // } if (isset($param['the_problem_is_deal']) && !empty($param['the_problem_is_deal'])) { $where[] = ['the_problem_is_deal', '<>', 1]; } $PatrolSpecialInspection = new PatrolProblem(); $list = $PatrolSpecialInspection->getPaginateList($where, ["*"], ['id' => 'desc'], [], $limit, $param['page']); return sparkSuccess(dataReturn(0, 'success', $list)); } #查询单个任务详情 public function getFirstPatrolProblem() { $param = request()->get(); $where = []; if (isset($param['id']) && !empty($param['id'])) { $where[] = ['id', '=', $param['id']]; } else { return sparkSuccess(dataReturn(-1, '获取失败,缺少参数id')); } $PatrolSpecialInspection = new PatrolProblem(); $data = $PatrolSpecialInspection ->where($where) ->first(); return sparkSuccess(dataReturn(0, 'success', $data)); } #评价当个任务 public function submitComment() { $adminId = \Tinywan\Jwt\JwtToken::getCurrentId(); $userInfo = (new AdminUser)->select()->where("id", '=', $adminId)->first(); $param = request()->post(); $formData['the_problem_is_comment'] = 2; $formData['comment_problem_person_id'] = $userInfo['id']; $formData['comment_problem_person_name'] = $userInfo['nickname']; $formData['comment_problem_is_solve'] = $param['is_solve']; $formData['comment_problem_score'] = $param['score']; $formData['comment_problem_time'] = now(); $formData['update_time'] = now(); $patrolProblem = new PatrolProblem(); $patrolProblem->updateById($formData, $param['id']); return sparkSuccess(dataReturn(0, '评价成功')); } /**get 专项巡查主线 */ public function getPatrolSpecialInspection() { $param = request()->get(); $limit = $param['limit'] ?? 10; $where = []; $PatrolSpecialInspection = new PatrolSpecialInspection(); #筛选组员 $adminId = \Tinywan\Jwt\JwtToken::getCurrentId(); $where[] = ['persons', 'like', '%"' . $adminId . '"%']; // dump($where); $list = $PatrolSpecialInspection->getPaginateList($where, ["*"], ['id' => 'desc'], [], $limit, $param['page']); return sparkSuccess(dataReturn(0, 'success', $list)); } #添加专项巡查任务 public function storePatrolMasterstrokeTask() { $formData = request()->post(); $formData['create_time'] = now();#创建 时间 $formData['persons'] = json_encode($formData['persons']); $patrolProblem = new PatrolSpecialInspection(); $patrolProblem->insertOne($formData); return sparkSuccess(dataReturn(0, 'success')); } }