From 282942bbc57d50139324d5066fe33063238e9cdc Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 8 Nov 2023 09:46:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=85=E5=8A=9E=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Common.php | 38 +++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index 97254e3..c9dcd90 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -86,19 +86,31 @@ class Common extends ApiController public function get_task_list() { $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')); + $map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.check_admin_ids)")]; + $param['status'] = 1; + $list = Db::name('Approve') + ->field('f.*,a.name,d.title as department_name,t.title as flow_type') + ->alias('f') + ->join('Admin a', 'a.id = f.admin_id', 'left') + ->join('Department d', 'd.id = f.department_id', 'left') + ->join('FlowType t', 't.id = f.type', 'left') + ->where($map1) + ->order('f.id desc') + ->group('f.id') + ->paginate(['list_rows' => 2, 'query' => $param]) + ->each(function($item, $key){ + $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); + $item['start_time'] = date('Y-m-d H:i:s', $item['start_time']); + $item['end_time'] = date('Y-m-d H:i:s', $item['end_time']); + $item['check_user'] = '-'; + if($item['check_status']<2 && !empty($item['check_admin_ids'])){ + $check_user = Db::name('Admin')->where('id','in',$item['check_admin_ids'])->column('name'); + $item['check_user'] = implode(',',$check_user); + } + return $item; + }); + $list = $list->toArray(); + $this->apiSuccess('获取成功', $list['data']); } private function isAuthProject($uid)