diff --git a/app/Models/Project.php b/app/Models/Project.php index 8e4665b96..a293150c4 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -239,6 +239,7 @@ public function archivedProject($archived_at) if ($archived_at === null) { // 取消归档 $this->archived_at = null; + $this->archived_userid = User::userid(); $this->addLog("项目取消归档"); $this->pushMsg('add', $this); ProjectTask::whereProjectId($this->id)->whereArchivedFollow(1)->update([ diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index 8d69a61b4..710ad3a8e 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -777,6 +777,7 @@ public function archivedTask($archived_at, $isAuto = false) if ($archived_at === null) { // 取消归档 $this->archived_at = null; + $this->archived_userid = User::userid(); $this->archived_follow = 0; $this->addLog("任务取消归档:" . $this->name); $this->pushMsg('add', [ diff --git a/app/Tasks/AutoArchivedTask.php b/app/Tasks/AutoArchivedTask.php index c0afdcfa7..10301baa3 100644 --- a/app/Tasks/AutoArchivedTask.php +++ b/app/Tasks/AutoArchivedTask.php @@ -30,16 +30,15 @@ public function start() $archivedDay = min(100, $archivedDay); $archivedTime = Carbon::now()->subDays($archivedDay); //获取已完成未归档的任务 - AbstractModel::transaction(function() use ($archivedTime) { - $taskLists = ProjectTask::whereNotNull('complete_at') - ->where('complete_at', '<=', $archivedTime) - ->whereNull('archived_at') - ->take(100) - ->get(); - foreach ($taskLists AS $task) { - $task->archivedTask(Carbon::now(), true); - } - }); + $taskLists = ProjectTask::whereNotNull('complete_at') + ->where('complete_at', '<=', $archivedTime) + ->where('archived_userid', 0) + ->whereNull('archived_at') + ->take(100) + ->get(); + foreach ($taskLists AS $task) { + $task->archivedTask(Carbon::now(), true); + } } } } diff --git a/resources/assets/js/pages/manage/components/ProjectArchived.vue b/resources/assets/js/pages/manage/components/ProjectArchived.vue index 31ea29781..f2cdf49db 100644 --- a/resources/assets/js/pages/manage/components/ProjectArchived.vue +++ b/resources/assets/js/pages/manage/components/ProjectArchived.vue @@ -83,6 +83,9 @@ export default { key: 'archived_userid', minWidth: 80, render: (h, {row}) => { + if (!row.archived_userid) { + return h('Tag', this.$L('系统自动')); + } return h('UserAvatar', { props: { userid: row.archived_userid, diff --git a/resources/assets/js/pages/manage/components/TaskArchived.vue b/resources/assets/js/pages/manage/components/TaskArchived.vue index 0e264782b..c52de3d18 100644 --- a/resources/assets/js/pages/manage/components/TaskArchived.vue +++ b/resources/assets/js/pages/manage/components/TaskArchived.vue @@ -74,6 +74,9 @@ export default { key: 'archived_userid', minWidth: 100, render: (h, {row}) => { + if (!row.archived_userid) { + return h('Tag', this.$L('系统自动')); + } return h('UserAvatar', { props: { userid: row.archived_userid,