作者 郭鑫

微信支付调试

@@ -34,21 +34,24 @@ class NotifyController extends HomeBaseController @@ -34,21 +34,24 @@ class NotifyController extends HomeBaseController
34 $data = $base->FromXml($xml); 34 $data = $base->FromXml($xml);
35 if($base->CheckSign() == true){ 35 if($base->CheckSign() == true){
36 if ($data["return_code"] == "SUCCESS") { 36 if ($data["return_code"] == "SUCCESS") {
37 - $where['order_sn'] = $data['attach']; 37 + $order_sn = $where['order_sn'] = $data['attach'];
38 if (!$where['order_sn']) { 38 if (!$where['order_sn']) {
39 $where['order_sn'] = $data['out_trade_no']; 39 $where['order_sn'] = $data['out_trade_no'];
40 } 40 }
41 // $where['money'] = $data['total_fee']/100; 41 // $where['money'] = $data['total_fee']/100;
42 $where['money'] = 1; 42 $where['money'] = 1;
43 $order_model = new OrderModel(); 43 $order_model = new OrderModel();
44 - $info = [  
45 - 'pay_time'=>time(),  
46 - 'status'=>2,  
47 - 'transaction_id'=>$data['transaction_id']  
48 - ];  
49 - $results = $order_model->where($where)->update($info);  
50 - if($results) {  
51 - $this->return_success(); 44 + $orderInfo = $order_model->where(['order_sn'=>$order_sn])->find();
  45 + if($orderInfo['status'] == 1) {
  46 + $info = [
  47 + 'pay_time'=>time(),
  48 + 'status'=>2,
  49 + 'transaction_id'=>$data['transaction_id']
  50 + ];
  51 + $results = $order_model->where($where)->update($info);
  52 + if($results) {
  53 + $this->return_success();
  54 + }
52 } 55 }
53 } 56 }
54 } 57 }