更新待办任务

This commit is contained in:
yaooo 2023-11-08 09:46:07 +08:00
parent 10750f1628
commit 282942bbc5
1 changed files with 25 additions and 13 deletions

View File

@ -86,19 +86,31 @@ class Common extends ApiController
public function get_task_list() public function get_task_list()
{ {
$user_id = JWT_UID; $user_id = JWT_UID;
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',f.check_admin_ids)")];
$map1 = []; $param['status'] = 1;
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; $list = Db::name('Approve')
$approve = Db::name('Approve')->where($map1)->order('id desc')->limit(2)->select(); ->field('f.*,a.name,d.title as department_name,t.title as flow_type')
->alias('f')
$map1 = []; ->join('Admin a', 'a.id = f.admin_id', 'left')
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; ->join('Department d', 'd.id = f.department_id', 'left')
$expense = Db::name('Expense')->where($map1)->order('id desc')->limit(2)->select(); ->join('FlowType t', 't.id = f.type', 'left')
->where($map1)
$map1 = []; ->order('f.id desc')
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")]; ->group('f.id')
$invoice = Db::name('Invoice')->where($map1)->order('id desc')->limit(2)->select(); ->paginate(['list_rows' => 2, 'query' => $param])
$this->apiSuccess('获取成功', compact('approve', 'expense', 'invoice')); ->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) private function isAuthProject($uid)