更新获取待办事项
This commit is contained in:
parent
5f7d7b3d3f
commit
747fe3a718
|
@ -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(),
|
'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(),
|
'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(),
|
'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()
|
'task'=>$handle['task'] = Db::name('ProjectTask')->where([['director_uid', '=', $this->uid],['flow_status', '<', 3],['delete_time', '=', 0]])->count()
|
||||||
];
|
];
|
||||||
$this->apiSuccess('获取成功', $subject);
|
$this->apiSuccess('获取成功', $subject);
|
||||||
|
@ -87,42 +85,20 @@ class Common extends ApiController
|
||||||
//获取待办任务
|
//获取待办任务
|
||||||
public function get_task_list()
|
public function get_task_list()
|
||||||
{
|
{
|
||||||
$this->uid = JWT_UID;
|
$user_id = JWT_UID;
|
||||||
$where = array();
|
|
||||||
$whereOr = array();
|
$map1 = [];
|
||||||
$map1 = [];
|
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")];
|
||||||
$map2 = [];
|
$approve = Db::name('Approve')->where($map1)->order('id desc')->limit(2)->select();
|
||||||
$map3 = [];
|
|
||||||
$map1[] = ['admin_id', '=', $this->uid];
|
$map1 = [];
|
||||||
$map2[] = ['director_uid', '=', $this->uid];
|
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")];
|
||||||
$map3[] = ['', 'exp', Db::raw("FIND_IN_SET({$this->uid},assist_admin_ids)")];
|
$expense = Db::name('Expense')->where($map1)->order('id desc')->limit(2)->select();
|
||||||
if($this->isAuthProject($this->uid)==0){
|
|
||||||
$whereOr =[$map1,$map2,$map3];
|
$map1 = [];
|
||||||
}
|
$map1[] = ['', 'exp', Db::raw("FIND_IN_SET('{$user_id}',check_admin_ids)")];
|
||||||
$where[] = ['delete_time', '=', 0];
|
$invoice = Db::name('Invoice')->where($map1)->order('id desc')->limit(2)->select();
|
||||||
$list = Db::name('ProjectTask')
|
$this->apiSuccess('获取成功', compact('approve', 'expense', 'invoice'));
|
||||||
->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)
|
private function isAuthProject($uid)
|
||||||
|
|
Loading…
Reference in New Issue