作者 董瑞恩
1 个管道 的构建 通过 耗费 0 秒

interface

... ... @@ -228,7 +228,8 @@ class OrderController extends HomeBaseController{
$body='支付';
$price=$order['price']*100;//订单价格
$notify_url=url('order/notify','','',true);//回调地址
$wxPay=new WeixinPay($openId,$order_no,$body,$price,$notify_url);
$out_trade_no=$order_no.rand(1000,9999);
$wxPay=new WeixinPay($openId,$out_trade_no,$body,$price,$notify_url);
$pay=$wxPay->pay();
if (isset($pay['package'])){
$data=[
... ... @@ -261,7 +262,7 @@ class OrderController extends HomeBaseController{
$Sign = $data['sign'];
//支付成功回调后变更订单状态
$mySign = $wxPay->getSign($data);
$order_no = $data['out_trade_no'];
$order_no =substr($data['out_trade_no'], 0, -4);
if ($Sign===$mySign && $data['return_code'] == 'SUCCESS') {
try{
Db::name('order')->where(['order_no'=>$order_no])->update(['state'=>3]);
... ...