项目增删通知

This commit is contained in:
Pang
2021-06-18 01:02:01 +08:00
parent c3fe7c1f7e
commit 41825ea4d4
6 changed files with 80 additions and 44 deletions

View File

@@ -60,21 +60,22 @@ class ProjectColumn extends AbstractModel
/**
* 删除列表
* @param bool $pushMsg 是否推送
* @return bool
*/
public function deleteColumn()
public function deleteColumn($pushMsg = true)
{
$result = AbstractModel::transaction(function () {
$result = AbstractModel::transaction(function () use ($pushMsg) {
$tasks = ProjectTask::whereColumnId($this->id)->get();
foreach ($tasks as $task) {
$task->deleteTask();
$task->deleteTask($pushMsg);
}
if ($this->delete()) {
$this->addLog("删除列表:" . $this->name);
return Base::retSuccess('删除成功', $this->toArray());
} else {
return Base::retError('删除失败', $this->toArray());
if ($pushMsg) {
$this->pushMsg("delete", $this->toArray());
}
$this->delete();
$this->addLog("删除列表:" . $this->name);
return Base::retSuccess('删除成功', $this->toArray());
});
return Base::isSuccess($result);
}