/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Task(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->getAjaxResponse(); } }
public function actionCreate() { $task = new Task(); if ($task->load(Yii::$app->request->post()) && $task->save()) { Yii::$app->getSession()->setFlash("success", 'The record was saved.'); return $this->redirect(["task/"]); } return $this->render("create", ["models" => ["task" => $task]]); }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Task(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed test */ public function actionCreate() { $model = new Task(); $categories = Category::find()->all(); $units = DicUnit::find()->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model, 'categories' => $categories, 'units' => $units]); } }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Task(); $modelDevice = new Device(); $modelAction = new Action(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model, 'from_device_ids' => ArrayHelper::map($modelDevice->getDeviceMaster(), 'id', 'name'), 'to_device_ids' => ArrayHelper::map($modelDevice->getDeviceAll(), 'id', 'name'), 'action_ids' => ArrayHelper::map($modelAction->getActionAll(), 'id', 'name')]); } }
/** * Добавление нового задания в таблицу * @param string $title Название задания * @return redirect */ public function actionNew($title) { SiteController::locale(); $task = new Task(); $task->title = $title; $task->status = Task::STATUS_ACTIVE; $task->date = date('Y-m-d H:i:s'); if ($task->save()) { Yii::$app->session->setFlash('success', Yii::t('msg/msg', 'Запись добавлена')); } else { Yii::$app->session->setFlash('errors', $task->errors); } return $this->redirect("/"); }
/** * @param Request $request * * @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\Response */ public function store(Request $request) { $task = new Task(); $task->title = $request->title; $task->description = $request->description; $task->is_complete = 0; $task->completed_at = null; if ($task->save()) { $response = ['code' => 200, 'message' => 'OK', 'data' => $task]; return response()->json($response, $response['code'])->header('Location', $request->root() . '/api/tasks/' . $task->id); } else { //TODO } }
public function store(TaskRequest $request) { $task = new Task(); $task->name_en = $request->input('name_en'); $task->name_bn = $request->input('name_bn'); $task->component_id = $request->input('component_id'); $task->module_id = $request->input('module_id'); $task->route = $request->input('route'); $task->icon = $request->input('icon'); $task->description = $request->input('description'); $task->ordering = $request->input('ordering'); $task->created_by = Auth::user()->id; $task->created_at = time(); $task->save(); Session()->flash('flash_message', 'Task has been created!'); return redirect('tasks'); }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed * @throws UserException */ public function actionCreate() { $goalId = (int) Yii::$app->request->get('goal_id', 0); if (!$goalId) { throw new UserException('Goal id is not provided'); } $goal = Goal::findOne($goalId); if (!$goal) { throw new UserException("Goal [{$goalId}] not found"); } $model = new Task(['goal_id' => $goalId]); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(Yii::$app->request->post('referrer') ?: $model->goal->urlTaskList()); } else { return $this->render('create', ['model' => $model]); } }
public function afterSave($insert, $changed) { if ($insert) { foreach (WorkflowTask::findAll(['workflow_id' => $this->workflow_id]) as $orig) { $task = new Task(); $skips = ['workflow_task_id', 'workflow_id', 'regist_date', 'update_date']; foreach (Task::getTableSchema()->columnNames as $cols) { if (in_array($cols, $skips)) { continue; } $task->{$cols} = $orig->{$cols}; } $task->user_id = Yii::$app->user->id; $task->project_id = $this->project_id; $task->save(); } } parent::afterSave($insert, $changed); }
public static function execute($id) { $model = TaskDefined::findOne($id); $modelTask = new Task(); $modelTask->from_device_id = $model->from_device_id; $modelTask->to_device_id = $model->to_device_id; $modelTask->action_id = $model->action_id; if (!$modelTask->save()) { print_r($modelTask->errors); return false; } // check for a error in the data foreach (['error:', 'err:'] as $needle) { if (false !== strpos($modelTask->data, $needle)) { return false; } } return true; }
/** * Updates an existing Task model. * If update is successful, the browser will be redirected to the 'update' page. * @param integer $id * @return mixed */ public function actionUpdate($id = null, $partner_id = null) { if ($id) { $model = $this->findModel($id); } else { $model = new Task(); } if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', __('Your changes have been saved successfully.')); return $this->redirect(['index']); } else { if (!$id) { $model->timestamp = Yii::$app->formatter->asDate(time()); $model->user_id = Yii::$app->user->id; if ($partner_id) { $model->select_partner = Partner::findOne($partner_id); } } return $this->renderAjax('update', ['model' => $model]); } }
/** * */ public function actionTasks() { $user = User::findOne(['username' => 'admin']); if (!$user) { throw new \Exception('Admin user not exists.'); } \Yii::$app->db->createCommand('TRUNCATE task; TRUNCATE user_task;')->execute(); $taskList = [['userID' => $user->id, 'title' => \Yii::$app->security->generateRandomString(8), 'description' => 'some description', 'timeStart' => time() - 60 * 60 * 24 * 7, 'timeEnd' => time() + 60 * 60 * 24 * 7], ['userID' => $user->id, 'title' => \Yii::$app->security->generateRandomString(6), 'description' => 'some description', 'timeStart' => time() - 60 * 60 * 5, 'timeEnd' => time() + 60 * 60 * 5], ['userID' => $user->id, 'title' => \Yii::$app->security->generateRandomString(4), 'description' => 'some description', 'timeStart' => time() + 60 * 60 * 2, 'timeEnd' => time() + 60 * 60 * 24], ['userID' => $user->id, 'title' => \Yii::$app->security->generateRandomString(7), 'description' => 'some description', 'timeStart' => time() + 60 * 60 * 24 * 1, 'timeEnd' => time() + 60 * 60 * 24 * 7]]; $tasks = null; foreach ($taskList as $taskEntry) { $task = new Task(); $task->userID = $taskEntry['userID']; $task->title = $taskEntry['title']; $task->description = $taskEntry['description']; $task->timeStart = $taskEntry['timeStart']; $task->timeEnd = $taskEntry['timeEnd']; $task->timeCreated = time(); $task->save(); $tasks[] = $task; } $this->assignRandom($tasks); }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @param integer $projectId * @return mixed */ public function actionCreate($projectId) { $model = new Task(); if ($model->load(Yii::$app->request->post())) { if (strtotime($model->delivery_date) >= strtotime(Yii::$app->formatter->asDate('now', 'yyyy-MM-dd'))) { $students = $_POST['Task']['students']; $model->status = Task::NEW_TASK; $model->project_id = $projectId; $model->save(); foreach ($students as $value) { Yii::$app->db->createCommand()->insert('student_evidence', ['task_id' => $model->id, 'project_id' => $model->project_id, 'evidence_id' => null, 'student_id' => $value, 'status' => Task::NEW_TASK])->execute(); $this->setNotification($value, $model->id, $model->project_id, Notification::NEW_TASK); } Yii::$app->getSession()->setFlash('success', 'Petición creada exitosamente'); return $this->redirect(['student-evidence/index']); } else { Yii::$app->getSession()->setFlash('danger', 'La fecha de entrega no puede ser anterior a la fecha actual'); return $this->render('create', ['model' => $model, 'projectId' => $projectId]); } } else { return $this->render('create', ['model' => $model]); } }
/** * Creates a new Task model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { if (($role = priviledge::getRole()) == 'Admin') { $model = new Task(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { $model->url = strtolower($model->url); $model->status = 'Pending'; //$model->user_id = \Yii::$app->user->identity; $mode = new LoginForm(); $mode->username = \Yii::$app->user->identity->username; $user = new User(); if ($user = $mode->getUser()) { $model->user_id = $user->id; } $listsocmed = $_POST['Task']['socmed']; $model->facebook = 'No'; $model->twitter = 'No'; foreach ($listsocmed as $value) { if ($value == 'Facebook') { $model->facebook = 'Yes'; } if ($value == 'Twitter') { $model->twitter = 'Yes'; } } if ($model->save()) { return $this->redirect(['view', 'id' => $model->task_id]); } else { return $this->render('create', ['model' => $model]); } } else { return $this->render('create', ['model' => $model]); } } else { throw new ForbiddenHttpException(); } }
public function store(Request $request) { $rules = ['category' => 'required|numeric|exists:categories,id', 'sub_category' => 'required|numeric|exists:categories,id', 'title' => 'required|min:5|max:255', 'subtitle' => 'required|min:5', 'photo' => 'image|max:3500', 'event_date' => 'date', 'event_time' => 'date_format:H:i', 'address' => 'min:5|max:255', 'location' => 'required|numeric|exists:locations,id', 'is_priced' => 'required|boolean', 'price' => 'required_if:is_priced,1|numeric', 'is_sms' => 'boolean', 'is_email' => 'boolean', 'taskers_only' => 'boolean', 'no_comments' => 'boolean', 'agree' => 'accepted']; if (!$this->user) { $rules['name'] = 'required|min:2|max:255'; $rules['email'] = 'required|email|unique:users,email'; $rules['mobile'] = 'required|min:5|max:16'; } $this->validate($request, $rules); $data = $request->all(); if (!$this->user) { $user = new User(['is_active' => 1, 'locale' => App::getLocale(), 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt(substr(uniqid(), 0, 8))]); $user->is_active = 1; $user->role = 'user'; $user->type = 'client'; $user->save(); $profile = new UserProfile(['first_name' => $data['name'], 'last_name' => '', 'location' => $data['location'], 'phone' => $data['mobile'], 'last_activity' => Carbon::now()]); $profile->user_id = $user->id; $profile->type = 'personal'; $profile->save(); Auth::login($user); $this->user = $user; } $task = new Task(['is_active' => 1, 'status' => 'bidding', 'category_id' => $data['sub_category'], 'location_id' => $data['location'], 'title' => $data['title'], 'subtitle' => $data['subtitle'], 'address' => $data['address'], 'price' => floatval($data['price']), 'event_date' => new Carbon($data['event_date']), 'event_time' => $data['event_time'], 'sms' => isset($data['is_sms']) ? $data['is_sms'] : 0, 'email' => isset($data['is_email']) ? $data['is_email'] : 0, 'taskers_only' => isset($data['taskers_only']) ? $data['taskers_only'] : 0, 'comments_public' => isset($data['no_comments']) ? !$data['no_comments'] : 1]); $task->user_id = $this->user->id; $task->save(); $photo = $request->file('photo'); if ($photo) { $ext = strtolower($photo->getClientOriginalExtension()); $photoFile = TaskMapper::generatePhotoPath($task, $ext); $photo = $photo->move(pathinfo($photoFile, PATHINFO_DIRNAME), pathinfo($photoFile, PATHINFO_BASENAME)); $task->photo = $photo->getFilename(); $task->save(); } return redirect('/task/show/' . $task->id); }
/** * 生成回滚任务 * * @return string * @throws \Exception */ public function actionRollback($taskId) { $this->task = Task::findOne($taskId); if (!$this->task) { throw new \Exception('任务号不存在:)'); } if ($this->task->user_id != $this->uid) { throw new \Exception('不可以操作其它人的任务:)'); } if ($this->task->ex_link_id == $this->task->link_id) { throw new \Exception('已回滚的任务不能再次回滚:('); } $conf = Project::find()->where(['id' => $this->task->project_id, 'status' => Project::STATUS_VALID])->one(); if (!$conf) { throw new \Exception('此项目已关闭,不能再回滚:('); } // 是否需要审核 $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS; $rollbackTask = new Task(); $rollbackTask->attributes = ['user_id' => $this->uid, 'project_id' => $this->task->project_id, 'status' => $status, 'action' => Task::ACTION_ROLLBACK, 'link_id' => $this->task->ex_link_id, 'ex_link_id' => $this->task->ex_link_id, 'title' => $this->task->title . ' - 回滚', 'commit_id' => $this->task->commit_id]; if ($rollbackTask->save()) { $url = $conf->audit == Project::AUDIT_YES ? '/task/' : '/walle/deploy?taskId=' . $rollbackTask->id; $this->renderJson(['url' => $url]); } else { $this->renderJson([], -1, '生成回滚任务失败'); } }
protected function sync_task() { $url = 'http://pd.mingyuanyun.com/AjaxRequirement/GetAllRequirementList.cspx?KeyValue=&ManagerName=&TeamMembers=&Status=0%2C1%2C2%2C3%2C4%2C5&Source=&XqType=&CustomerType=&CustomerArea=&HandlerToRequirementType=&CreatedOnType=&DevelopEndTimeType=&TechReLmtType=&TaskDoneLmtType=&OrderSeq='; $pm = '胡洁'; $cur_page = 1; $params = "&PMName={$pm}&PageIndex={$cur_page}"; $url = $url . $params; $method = 'GET'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, 0); //模拟登录 curl_setopt($ch, CURLOPT_COOKIE, self::$user_cookie); //模拟打开浏览器 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 10); if ($method === 'POST') { curl_setopt($ch, CURLOPT_POST, true); } $result = curl_exec($ch); $j = json_decode($result); $total_count = $j->TotalCount; $html = $j->html; $count = 0; $html = str_get_html($html); foreach ($html->find('div[class*=singleRequirementCard]') as $task_node) { $task_no = $task_node->find('div[class*=title]', 0)->children(0)->plaintext; $str = ['【', '】']; $task_no = trim(str_replace($str, "", $task_no)); $ekp_oid = $task_node->find('div[class*=title]', 0)->children(1)->attr['href']; $task_title = trim($task_node->find('div[class*=title]', 0)->children(1)->plaintext); $task_cst_name = $task_node->find('li[title=客户名称]', 0)->plaintext; $ekp_task_type = $task_node->find('li[title=需求类型]', 0)->plaintext; $task_apu_pm = $task_node->find('li[title=需求负责人]', 0)->plaintext; $task_status = $task_node->find('div[class*=status]', 0)->plaintext; //判断任务是否已经存在,存在则不同步 $exits_task_no = DB::table('tasks')->where('task_no', $task_no)->pluck('task_no'); if (empty($exits_task_no)) { $mysql_task = new Task(); $mysql_task->task_no = $task_no; $mysql_task->task_title = $task_title; $mysql_task->customer_name = $task_cst_name; $mysql_task->ekp_oid = $ekp_oid; $mysql_task->abu_pm = $task_apu_pm; $mysql_task->ekp_create_date = date("y-m-d", time()); $mysql_task->status = $task_status; $mysql_task->ekp_task_type = $ekp_task_type; $mysql_task->ekp_expect = date("y-m-d", time()); //TODO:根据客户自动判断 // $mysql_task->erp_version = $task->ErpVersion; // $mysql_task->map_version = $task->MapVersion; // $mysql_task->workflow_version = $task->WorkflowVersion; //根据客户名称查询客户台账中的唯一用户 $customers = DB::table('customers')->where('name', 'like', '%' . $task_cst_name . '%')->orWhere('ekp_latest_name', 'like', '%' . $task_cst_name . '%')->get(); if (!empty($customers)) { if (count($customers) == 1) { $mysql_task->customer_uuid = $customers[0]->uuid; } if (count($customers) > 1) { foreach ($customers as $val) { $mysql_task->customer_uuid = $val->uuid; break; } } } $mysql_task->save(); $count++; } } Log::info('同步任务系统记录' . date("Y-m-d H:i:s", strtotime("now"))); return $count; }
/** * Добавление задачи * @return string */ public function actionAddTask() { if (Yii::$app->getRequest()->getQueryParam('user')) { $user = MarkUser::findOne(Yii::$app->getRequest()->getQueryParam('user')); if (Yii::$app->getRequest()->getQueryParam('name') && Yii::$app->getRequest()->getQueryParam('description')) { $new_task = new Task(); $new_task->name = Yii::$app->getRequest()->getQueryParam('name'); $new_task->description = Yii::$app->getRequest()->getQueryParam('description'); $new_task->status = 1; $new_task->source_id = 327; $new_task->hour = 0; $new_task->dead_line = 0; if ($new_task->validate()) { if ($new_task->save()) { $tasks = Task::find()->where('status = 0 or status = 1')->orderBy('id DESC')->all(); return $this->renderPartial('new_tasks', ['tasks_list' => $tasks, 'user' => $user]); } else { return $this->renderPartial('error'); } } else { return 'Текст большой!'; } } } }
// model.fetch() Route::get('tasks/{id}', function ($id) { $tasks = Task::find($id); if ($tasks) { return json_encode($tasks); } else { abort(404); } }); // model.save() - if id exist Route::put('tasks/{id}', function ($id) { $input = Input::all(); $task = Task::find($id); $task->title = $input['title']; $task->completed = $input['completed']; $task->save(); }); // model.save() - if id doesn't exist Route::post('tasks', function () { $input = Input::all(); $newTask = new Task(); $newTask->title = $input['title']; $newTask->completed = $input['completed']; $newTask->save(); return $newTaskArray = array('id' => $newTask->id, 'title' => $newTask->title, 'completed' => $newTask->completed); }); // model.delete() Route::delete('tasks/{id}', function ($id) { $task = Task::find($id); $task->delete(); });
public function actionCreate() { $model = new Task(); if (Yii::$app->request->isPost) { $model->load(Yii::$app->request->post()); if ($model->save()) { return 'ok'; } } elseif (Yii::$app->request->isAjax) { $date = new \DateTime(); $model->start = $date->format('Y-m-d'); $model->end = $date->format('Y-m-d'); $model->family_id = \Yii::$app->user->identity->family_id; $model->member_id = \Yii::$app->user->identity->family_member_id; $model->description = ''; $model->done = 0; $model->status = \app\enum\TaskStatus::__default; $model->task_type = \app\enum\TaskType::__default; $modelMembers = \Yii::$app->user->identity->familyMembers; $modelAssigned = TaskAssign::findAll(['task_id' => 0]); return json_encode($this->renderAjax('_user', ['model' => $model, 'modelMembers' => $modelMembers, 'modelAssigned' => $modelAssigned])); } return false; }
*/ use Illuminate\Http\Request; use App\Models\Task; Route::get('/', function () { //return view('tasks'); $tasks = Task::orderBy('created_at', 'asc')->get(); return view('tasks', ['tasks' => $tasks]); }); Route::post('/task', function (Request $request) { $validator = Validator::make($request->all(), ['name' => 'required|max:255']); if ($validator->fails()) { return redirect('/')->withInput()->withErrors($validator); } $task = new Task(); $task->name = $request->name; $task->save(); return redirect('/'); }); Route::delete('/task/{task}', function (Task $task) { $task->delete(); return redirect('/'); }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | This route group applies the "web" middleware group to every route | it contains. The "web" middleware group is defined in your HTTP | kernel and includes session state, CSRF protection, and more. |
public function updateSingleTask(Project $project, $id) { $data = array(); $data = splitString($id); $id = $data[0]; $statusName = $data[2]; $currentStatus = $data[3]; $task = new Task(); $affectedRows = $task->whereId($id)->orderBy('id', 'desc')->first(); //dd($affectedRows->task_dev); $datetime = currentTimestamp($currentStatus); if ($currentStatus == "start" or $currentStatus == "restart") { $newStatus = "pause"; } elseif ($currentStatus == "notStart" or $currentStatus == "end") { $newStatus = "start"; } elseif ($currentStatus == "pause") { $newStatus = "restart"; } if ($statusName == "status_des") { $task->task_designs = $datetime; $task->status_task_designs = $newStatus; $task->task_prod = $affectedRows->task_prod; $task->status_task_prod = $affectedRows->status_task_prod; $task->task_dev = $affectedRows->task_dev; $task->status_task_dev = $affectedRows->status_task_dev; $task->project_id = $affectedRows->project_id; $task->save(); } if ($statusName == "status_dev") { $task->task_designs = $affectedRows->task_designs; $task->status_task_designs = $affectedRows->status_task_designs; $task->task_prod = $affectedRows->task_prod; $task->status_task_prod = $affectedRows->status_task_prod; $task->task_dev = $datetime; $task->status_task_dev = $newStatus; $task->project_id = $affectedRows->project_id; $task->save(); } if ($statusName == "status_prod") { $task->task_designs = $affectedRows->task_designs; $task->status_task_designs = $affectedRows->status_task_designs; $task->task_prod = $datetime; $task->status_task_prod = $newStatus; $task->task_dev = $affectedRows->task_dev; $task->status_task_dev = $affectedRows->status_task_dev; $task->project_id = $affectedRows->project_id; $task->save(); } return view('projects.show', compact('project')); }
/** * 生成回滚任务 * * @return string * @throws \Exception */ public function actionRollback($taskId) { $this->task = Task::findOne($taskId); if (!$this->task) { throw new \Exception(yii::t('task', 'unknown deployment bill')); } if ($this->task->user_id != $this->uid) { throw new \Exception(yii::t('w', 'you are not master of project')); } if ($this->task->ex_link_id == $this->task->link_id) { throw new \Exception(yii::t('task', 'no rollback twice')); } $conf = Project::find()->where(['id' => $this->task->project_id, 'status' => Project::STATUS_VALID])->one(); if (!$conf) { throw new \Exception(yii::t('task', 'can\'t rollback the closed project\'s job')); } // 是否需要审核 $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS; $rollbackTask = new Task(); $rollbackTask->attributes = ['user_id' => $this->uid, 'project_id' => $this->task->project_id, 'status' => $status, 'action' => Task::ACTION_ROLLBACK, 'link_id' => $this->task->ex_link_id, 'ex_link_id' => $this->task->ex_link_id, 'title' => $this->task->title . ' - ' . yii::t('task', 'rollback'), 'commit_id' => $this->task->commit_id]; if ($rollbackTask->save()) { $url = $conf->audit == Project::AUDIT_YES ? '/task/' : '/walle/deploy?taskId=' . $rollbackTask->id; $this->renderJson(['url' => $url]); } else { $this->renderJson([], -1, yii::t('task', 'create a rollback job failed')); } }
/** * 上线管理 * @param $taskId * @return string * @throws \Exception */ public function actionRollback() { $taskId = $this->getParam('taskId'); $this->_task = Task::findOne($taskId); if (!$this->_task) { throw new \Exception('任务号不存在:)'); } if ($this->_task->user_id != \Yii::$app->user->id) { throw new \Exception('不可以操作其它人的任务:)'); } if ($this->_task->ex_link_id == $this->_task->link_id) { throw new \Exception('已回滚的任务不能再次回滚:('); } $rollbackTask = new Task(); $conf = Conf::findOne($this->_task->project_id); // 只有线上才需要审核 $status = in_array($conf->level, [Conf::LEVEL_PROD]) ? Task::STATUS_SUBMIT : Task::STATUS_PASS; $rollbackTask->attributes = ['user_id' => \Yii::$app->user->id, 'project_id' => $this->_task->project_id, 'status' => $status, 'action' => Task::ACTION_ROLLBACK, 'link_id' => $this->_task->ex_link_id, 'ex_link_id' => $this->_task->ex_link_id, 'created_at' => time(), 'title' => $this->_task->title . ' - 回滚', 'commit_id' => $this->_task->commit_id]; if ($rollbackTask->save()) { $this->renderJson(['url' => in_array($conf->level, [Conf::LEVEL_PROD]) ? '/walle/index' : '/walle/deploy?taskId=' . $rollbackTask->id]); } else { $this->renderJson([], -1, '生成回滚任务失败'); } }