From 747fe3a718734daee89c1fa3bbfb744ea72a10a5 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 7 Nov 2023 18:38:27 +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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Common.php | 52 ++++++++++------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index f10b339..97254e3 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -77,8 +77,6 @@ class Common extends ApiController 'approve'=>Db::name('Approve')->where([['', 'exp', Db::raw("FIND_IN_SET('{$this->uid}',check_admin_ids)")]])->count(), 'expenses'=>Db::name('Expense')->where([['', 'exp', Db::raw("FIND_IN_SET('{$this->uid}',check_admin_ids)")],['delete_time', '=', 0]])->count(), 'invoice'=>Db::name('Invoice')->where([['', 'exp', Db::raw("FIND_IN_SET('{$this->uid}',check_admin_ids)")],['delete_time', '=', 0]])->count(), - // 'income'=>Db::name('Invoice')->where([['is_cash', '<', 2],['admin_id','=',$this->uid],['check_status', '=', 5],['delete_time', '=', 0]])->count(), - // 'contract'=>Db::name('Contract')->where([['', 'exp', Db::raw("FIND_IN_SET('{$this->uid}',check_admin_ids)")],['delete_time', '=', 0]])->count(), 'task'=>$handle['task'] = Db::name('ProjectTask')->where([['director_uid', '=', $this->uid],['flow_status', '<', 3],['delete_time', '=', 0]])->count() ]; $this->apiSuccess('获取成功', $subject); @@ -87,42 +85,20 @@ class Common extends ApiController //获取待办任务 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); + $user_id = JWT_UID; + + $map1 = []; + $map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; + $approve = Db::name('Approve')->where($map1)->order('id desc')->limit(2)->select(); + + $map1 = []; + $map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; + $expense = Db::name('Expense')->where($map1)->order('id desc')->limit(2)->select(); + + $map1 = []; + $map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; + $invoice = Db::name('Invoice')->where($map1)->order('id desc')->limit(2)->select(); + $this->apiSuccess('获取成功', compact('approve', 'expense', 'invoice')); } private function isAuthProject($uid)