You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php /** * Created by PhpStorm. * User: travis * Date: 2019/12/12 * Time: 15:59 */
namespace api\controllers;
use api\logic\WxPaymentLogic; use yii\filters\auth\HttpBearerAuth; use yii\helpers\ArrayHelper; use yii\web\Response; use Yii;
class WxPaymentController extends CommonController { public $modelClass = 'backend\modules\shop\models\ars\Order'; public $className = 'api\logic\WxPaymentLogic';
public function behaviors() { return ArrayHelper::merge(parent::behaviors(), [ 'authenticatior' => [ 'class' => HttpBearerAuth::className(), 'except' => ['notify'], ] ]); }
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); }
public function actionNotify() { Yii::$app->response->format = Response::FORMAT_XML; return $this->object->notify(); } }
|