diff --git a/FlyCube/MpApi/Controller/PayController.class.php b/FlyCube/MpApi/Controller/PayController.class.php index cf31963..6c27a05 100644 --- a/FlyCube/MpApi/Controller/PayController.class.php +++ b/FlyCube/MpApi/Controller/PayController.class.php @@ -9,7 +9,7 @@ class PayController extends PublicController /** * @description: 初始化 pay类的参数 */ - private function init() + public function _initialize() { // 初始化 pay类的参数 $this->config = [ @@ -50,10 +50,11 @@ class PayController extends PublicController */ public function refund() { + //父级构造函数 + parent::_initialize(); + // 总管理员 可接收任何shop_id 非总管理员 只可以调用自身shop_id 否则会中断 $this->isPower(); - // 初始化 pay类的参数 - $this->init(); // 获取订单信息 $where['shop_id'] = $_REQUEST['shop_id']; @@ -78,7 +79,6 @@ class PayController extends PublicController 'total' => $order['total_price'] * 100, // 订单金额,单位:分 'currency' => 'CNY', ], - 'notify_url' => C('host') . 'flycube.php/MpApi/Pay/notifyCallback', // 退款回调地址 ]; try { @@ -96,7 +96,6 @@ class PayController extends PublicController public function notifyCallback() { $this->publish("demo", "hello"); - $this->init(); // 初始化 pay类的参数 try { // 实例化 Yansongda Pay 并处理回调 diff --git a/FlyCube/MpApi/Controller/PublicController.class.php b/FlyCube/MpApi/Controller/PublicController.class.php index 4f08edf..e58ae7b 100644 --- a/FlyCube/MpApi/Controller/PublicController.class.php +++ b/FlyCube/MpApi/Controller/PublicController.class.php @@ -13,11 +13,11 @@ use PhpMqtt\Client\ConnectionSettings; class PublicController extends Controller { + protected $tokenShop_id; //**************** //构造函数 //**************** - protected $tokenShop_id; - public function __construct() + public function _initialize() { header("Access-Control-Allow-Origin: *"); // 允许所有来源 header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); // 允许的请求方法