优化 删除算法

This commit is contained in:
iVampireSP.com 2022-11-22 19:31:41 +08:00
parent 792c2ce6ca
commit a6c5e7e89a
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -199,6 +199,11 @@ public function scopeThisUser($query, $module = null)
public function safeDelete(): bool public function safeDelete(): bool
{ {
// 如果创建时间大于大于 1 小时
if ($this->created_at->diffInHours(now()) > 1) {
$this->cost();
}
dispatch(new \App\Jobs\Module\Host($this, 'delete')); dispatch(new \App\Jobs\Module\Host($this, 'delete'));
return true; return true;
} }