app\controllers\TaskController::actionDelete PHP Method

actionDelete() public method

任务删除
public actionDelete ( $taskId ) : string
return string
    public function actionDelete($taskId)
    {
        $task = Task::findOne($taskId);
        if (!$task) {
            throw new \Exception(yii::t('task', 'unknown deployment bill'));
        }
        if ($task->user_id != $this->uid) {
            throw new \Exception(yii::t('w', 'you are not master of project'));
        }
        if ($task->status == Task::STATUS_DONE) {
            throw new \Exception(yii::t('task', 'can\'t delele the job which is done'));
        }
        if (!$task->delete()) {
            throw new \Exception(yii::t('w', 'delete failed'));
        }
        $this->renderJson([]);
    }