修复任务bug

This commit is contained in:
2026-02-12 17:21:23 +08:00
parent 63e6365337
commit 1a74cc8d25
3 changed files with 40 additions and 42 deletions
+4 -14
View File
@@ -39,18 +39,9 @@ class Task extends Model
function list($param)
{
$where = array();
$map1 = [];
$map2 = [];
$map3 = [];
$map4 = [];
if (!empty($param['project_id'])) {
$where[] = ['project_id', '=', $param['project_id']];
} else {
$project_ids = Db::name('ProjectUser')->where(['uid' => $param['uid'], 'delete_time' => 0])->column('project_id');
$map1[] = ['admin_id', '=', $param['uid']];
$map2[] = ['director_uid', '=', $param['uid']];
$map3[] = ['', 'exp', Db::raw("FIND_IN_SET({$param['uid']},assist_admin_ids)")];
$map4[] = ['project_id', 'in', $project_ids];
}
if (!empty($param['admin_id'])) {
$where[] = ['admin_id', '=', $param['admin_id']];
@@ -82,11 +73,9 @@ class Task extends Model
$where[] = ['delete_time', '=', 0];
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$list = Db::name('Task')->where(function ($query) use ($map1, $map2, $map3, $map4) {
$query->where($map1)->whereor($map2)->whereor($map3)->whereor($map4);
})->where($where)
$list = Db::name('Task')->where($where)
->withoutField('content,md_content')
->orderRaw("FIELD(flow_status, 6, 1, 2, 4, 5, 3)")
// ->orderRaw("FIELD(flow_status, 6, 1, 2, 4, 5, 3)")
->order('id', 'desc')
->paginate($rows, false, ['query' => $param])
->each(function ($item, $key) {
@@ -115,6 +104,7 @@ class Task extends Model
$item['assist_admin_names'] = implode(',', $assist_admin_names);
}
$item['end_time'] = date('Y-m-d', $item['end_time']);
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
$item['delay'] = 0;
if ($item['over_time'] > 0 && $item['flow_status'] < 4) {
$item['delay'] = countDays($item['end_time'], date('Y-m-d', $item['over_time']));