This commit is contained in:
szdot 2024-06-05 21:08:51 +08:00
commit 403f9c32af

View File

@ -14,19 +14,6 @@ class PayController extends PublicController
*/ */
public function _initialize() public function _initialize()
{ {
}
/**
* @description: Yansongda pay类的参数
*/
protected $config;
/**
* @description: 发起小程序支付
*/
public function pay()
{
//父级构造函数
parent::_initialize();
//初始化 pay类的参数 //初始化 pay类的参数
$this->config = [ $this->config = [
'wechat' => [ 'wechat' => [
@ -54,6 +41,18 @@ class PayController extends PublicController
'connect_timeout' => 5.0, 'connect_timeout' => 5.0,
], ],
]; ];
}
/**
* @description: Yansongda pay类的参数
*/
protected $config;
/**
* @description: 发起小程序支付
*/
public function pay()
{
//父级构造函数
parent::_initialize();
//获取订单信息 //获取订单信息
$where['order_sn'] = $_REQUEST['order_sn']; $where['order_sn'] = $_REQUEST['order_sn'];
@ -86,9 +85,8 @@ class PayController extends PublicController
{ {
$this->publish('demo1', 'start'); $this->publish('demo1', 'start');
// 实例化 Yansongda Pay // 实例化 Yansongda Pay
$pay = Pay::wechat($this->config); $result = Pay::wechat($this->config)->callback();
$callBackData = $pay->callback(); $this->publish('demo', json_encode($result));
$this->publish('demo', json_encode($callBackData));
// try { // try {
// // 获取并验证回调数据 // // 获取并验证回调数据
// $callBackData = $pay->callback(); // $callBackData = $pay->callback();
@ -106,6 +104,6 @@ class PayController extends PublicController
// } // }
// 返回成功响应给腾讯服务器,告知通知已处理 // 返回成功响应给腾讯服务器,告知通知已处理
return $pay->success(); return Pay::wechat()->success();
} }
} }