优化 AbstractModel::transaction

This commit is contained in:
kuaifan
2021-06-18 19:32:50 +08:00
parent f74b660d4a
commit 6a0bc37645
7 changed files with 86 additions and 97 deletions
+6 -6
View File
@@ -62,22 +62,22 @@ class ProjectColumn extends AbstractModel
/**
* 删除列表
* @param bool $pushMsg 是否推送
* @return array
* @return bool
*/
public function deleteColumn($pushMsg = true)
{
return AbstractModel::transaction(function () use ($pushMsg) {
AbstractModel::transaction(function () use ($pushMsg) {
$tasks = ProjectTask::whereColumnId($this->id)->get();
foreach ($tasks as $task) {
$task->deleteTask($pushMsg);
}
$this->delete();
$this->addLog("删除列表:" . $this->name);
if ($pushMsg) {
$this->pushMsg("delete");
}
return Base::retSuccess('删除成功', $this->toArray());
});
if ($pushMsg) {
$this->pushMsg("delete");
}
return true;
}
/**