[ 'class' => \yii\filters\VerbFilter::className(), 'actions' => [ 'list' => ['GET'], 'create' => ['POST'], 'delete' => ['POST'], 'update' => ['POST'], ], ], ]); } /** * [创建队列] * @author: libingke * @return array * @throws Exception */ public function actionCreate() { $model = new TopicForm(); $model->setScenario('create_topic'); $model->load(['TopicForm' => Yii::$app->request->post()]); $data = []; if ($model->validate()) { $data = $model->createTopic(); } else { $model->handleError();//处理验证失败 } return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } /** * 删除队列 * @author: libingke * @return array * @throws Exception */ public function actionDelete() { $model = new TopicForm(); $model->setScenario('delete_topic'); $model->load(['TopicForm' => Yii::$app->request->post()]); $data = []; if ($model->validate()) { $data = $model->deleteTopic(); } else { $model->handleError(); } return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } /** * 获取队列列表 * @author: libingke */ public function actionList() { $model = new TopicForm(); $data = $model->getTopicList(); return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } /** * [修改队列] * @author: hanguangxu * @return array * @throws Exception */ public function actionUpdate() { $model = new TopicForm(); $model->setScenario('update_topic'); $model->load(['TopicForm' => Yii::$app->request->post()]); $data = []; if ($model->validate()) { $data = $model->updateTopic(); } else { $model->handleError();//处理验证失败 } return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } }