[ 'class' => HttpBearerAuth::className(), 'except' => ['notify', 'test'], ] ]); } public function actions() { $action = parent::actions(); unset($action['index']); unset($action['update']); unset($action['view']); unset($action['delete']); $action['options'] = [ 'class' => 'yii\rest\OptionsAction', 'collectionOptions' => ['PUT', 'GET', 'OPTIONS'] ]; return $action; } public function actionWeb() { return $this->object->wxPayment(WxPaymentLogic::PAY_TYPE_WEB); } public function actionMiniProgram() { return $this->object->wxPayment(WxPaymentLogic::PAY_TYPE_MINI_PROGRAM); } /** * @return array|bool * @throws BadRequestHttpException * @throws \yii\base\InvalidConfigException * @throws \yii\httpclient\Exception * 异步回调 */ public function actionNotify() { Yii::$app->response->format = Response::FORMAT_XML; return $this->object->notify(); } public function actionTest() { $data = Yii::$app->request->getBodyParam('notify');/*int 商品id*/ return $data; } }