优化任务项目归档
This commit is contained in:
@@ -744,18 +744,18 @@ class ProjectTask extends AbstractModel
|
||||
* @param int $task_id
|
||||
* @param array $with
|
||||
* @param bool $ignoreArchived 排除已归档
|
||||
* @param null $project
|
||||
* @return self
|
||||
*/
|
||||
public static function userTask($task_id, $with = [], $ignoreArchived = true, &$project = null)
|
||||
{
|
||||
$builder = self::with($with)->whereId(intval($task_id));
|
||||
if ($ignoreArchived) {
|
||||
$builder->whereNull('archived_at');
|
||||
}
|
||||
$task = $builder->first();
|
||||
$task = self::with($with)->whereId(intval($task_id))->first();
|
||||
if (empty($task)) {
|
||||
throw new ApiException('任务不存在', [ 'task_id' => $task_id ], -4002);
|
||||
}
|
||||
if ($ignoreArchived && $task->archived_at != null) {
|
||||
throw new ApiException('任务已归档', [ 'task_id' => $task_id ], -4002);
|
||||
}
|
||||
//
|
||||
try {
|
||||
$project = Project::userProject($task->project_id, $ignoreArchived);
|
||||
|
||||
Reference in New Issue
Block a user