'yii\rest\IndexAction', 'modelClass' => $this->modelClass, 'dataFilter' => $this->getFilter() ]; return $action; } protected function getFilter() { $status = Yii::$app->request->getBodyParam('status'); $data = \Yii::$app->request->getBodyParams(); $data['user'] = true; \Yii::$app->request->setBodyParams($data); $array = ['user_id' => Yii::$app->user->getId()]; if ($status) { $array['status'] = $status; } $filter = ['class' => 'yii\data\ActiveDataFilter', 'filter' => $array, 'searchModel' => ['class' => 'common\models\searchs\OrderSearch']]; return $filter; } public function actionCreate() { $originId = Yii::$app->request->getBodyParam('originId'); $count = Yii::$app->request->getBodyParam('count'); $skuId = Yii::$app->request->getBodyParam('skuId'); return Yii::$app->orderLogic->create($originId, $count, $skuId); } /** * @return mixed * @throws \yii\base\InvalidConfigException */ public function actionUpdate() { $data = Yii::$app->request->getBodyParams(); return Yii::$app->orderLogic->update($data); } }