perf: 优化数据同步

This commit is contained in:
kuaifan
2023-03-07 18:11:34 +08:00
parent db3fc5f492
commit bca28fb390
18 changed files with 604 additions and 18 deletions

View File

@@ -1260,7 +1260,7 @@ class ProjectTask extends AbstractModel
$this->archived_follow = 0;
$this->addLog($logText, [], $userid);
}
$this->pushMsg('update', [
$this->pushMsg($archived_at === null ? 'recovery' : 'archived', [
'id' => $this->id,
'archived_at' => $this->archived_at,
'archived_userid' => $this->archived_userid,
@@ -1286,7 +1286,6 @@ class ProjectTask extends AbstractModel
if ($this->dialog_id) {
$dialog = WebSocketDialog::find($this->dialog_id);
$dialog?->deleteDialog();
$dialog?->pushMsg("groupDelete");
}
self::whereParentId($this->id)->delete();
$this->deleted_userid = User::userid();
@@ -1305,12 +1304,12 @@ class ProjectTask extends AbstractModel
* @param bool $pushMsg 是否推送
* @return bool
*/
public function recoveryTask($pushMsg = true)
public function restoreTask($pushMsg = true)
{
AbstractModel::transaction(function () {
if ($this->dialog_id) {
$dialog = WebSocketDialog::withTrashed()->find($this->dialog_id);
$dialog?->recoveryDialog();
$dialog?->restoreDialog();
}
self::whereParentId($this->id)->withTrashed()->restore();
$this->addLog("还原{任务}");