[ 'class' => \yii\filters\VerbFilter::className(), 'actions' => [ 'list' => ['GET'], 'create' => ['POST'], 'delete' => ['POST'], ], ], ]); } /** * [创建队列] * @author: libingke * @return array * @throws Exception */ public function actionCreate() { $model = new QueueForm(); $model->setScenario('create_queue'); $model->load(['QueueForm' => Yii::$app->request->post()]); $data = []; if ($model->validate()) { $data = $model->createQueue(); } else { $model->handleError();//处理验证失败 } return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } /** * 删除队列 * @author: libingke * @return array * @throws Exception */ public function actionDelete() { $model = new QueueForm(); $model->setScenario('delete_queue'); $model->load(['QueueForm' => Yii::$app->request->post()]); $data = []; if ($model->validate()) { $data = $model->deleteQueue(); } else { $model->handleError(); } return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } /** * 获取队列列表 * @author: libingke */ public function actionList() { $model = new QueueForm(); $data = $model->getQueueList(); return [ 'code' => 200, 'message' => Yii::t('error', 200), 'data' => $data ]; } }