From b37304ea72b8fedb08752d8d877bc0bfc2d13977 Mon Sep 17 00:00:00 2001 From: tk Date: Thu, 27 Jun 2024 19:21:07 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=09=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E3=80=90=E4=B8=BB=09=E9=A2=98=E3=80=91=EF=BC=9A?= =?UTF-8?q?=E8=85=BE=E8=AE=AF=E5=9B=9E=E8=B0=83=20=E7=BB=95=E5=BC=80?= =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=87=BD=E6=95=B0=E7=9A=84=20=E8=BA=AB?= =?UTF-8?q?=E4=BB=BD=E6=A3=80=E6=9F=A5=20=E3=80=90=E6=8F=8F=09=E8=BF=B0?= =?UTF-8?q?=E3=80=91=EF=BC=9A=20=09[=E5=8E=9F=E5=9B=A0]=EF=BC=9A=E6=9E=84?= =?UTF-8?q?=E9=80=A0=E5=87=BD=E6=95=B0=E4=BC=9A=E6=8B=A6=E6=88=AA=E8=85=BE?= =?UTF-8?q?=E8=AE=AF=20=E8=B0=83=E7=94=A8=E5=9B=9E=E8=B0=83=20=09[?= =?UTF-8?q?=E8=BF=87=E7=A8=8B]=EF=BC=9A=20=09[=E5=BD=B1=E5=93=8D]=EF=BC=9A?= =?UTF-8?q?=20=E3=80=90=E7=BB=93=09=E6=9D=9F=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动 --- FlyCube/MpApi/Controller/PayController.class.php | 9 ++++----- FlyCube/MpApi/Controller/PublicController.class.php | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) 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"); // 允许的请求方法