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

interface

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