From bf2d80253b6eb6ca3bfa7f82625ef89e48bc26aa Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Sat, 4 Nov 2023 17:43:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=8E=B7=E5=8F=96=E5=BE=85?= =?UTF-8?q?=E5=8A=9E=E4=BA=8B=E9=A1=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Common.php | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index bc7e9be..f9ec27a 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -83,4 +83,57 @@ class Common extends ApiController ]; $this->apiSuccess('获取成功', $subject); } + + //获取待办任务 + public function get_task_list() + { + $this->uid = JWT_UID; + $where = array(); + $whereOr = array(); + $map1 = []; + $map2 = []; + $map3 = []; + $map1[] = ['admin_id', '=', $this->uid]; + $map2[] = ['director_uid', '=', $this->uid]; + $map3[] = ['', 'exp', Db::raw("FIND_IN_SET({$this->uid},assist_admin_ids)")]; + if($this->isAuthProject($this->uid)==0){ + $whereOr =[$map1,$map2,$map3]; + } + $where[] = ['delete_time', '=', 0]; + $list = Db::name('ProjectTask') + ->where(function ($query) use ($whereOr) { + if (!empty($whereOr)) + $query->whereOr($whereOr); + }) + ->where($where) + ->withoutField('content,md_content') + ->order('flow_status asc') + ->order('id desc') + ->limit(8) + ->select()->toArray(); + foreach ($list as $key => &$val) { + $val['director_name'] = Db::name('Admin')->where(['id' => $val['director_uid']])->value('name'); + if($val['end_time']>0){ + $val['end_time'] = date('Y-m-d', $val['end_time']); + } + else{ + $val['end_time'] = '-'; + } + $val['flow_name'] = \app\project\model\ProjectTask::$FlowStatus[(int) $val['flow_status']]; + } + $res['data'] = $list; + $this->apiSuccess('获取成功', $res); + } + + private function isAuthProject($uid) + { + if($uid == 1){ + return 1; + } + $map = []; + $map[] = ['name', '=', 'project_admin']; + $map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',uids)")]; + $count = Db::name('DataAuth')->where($map)->count(); + return $count; + } }