From 8806b3998dcfc8a0b69b24c2a1452b7b5135da2f Mon Sep 17 00:00:00 2001
From: lihan <3398341942@qq.com>
Date: Wed, 10 Oct 2018 17:21:31 +0800
Subject: [PATCH] 测试

---
 app/pay/controller/PayController.php                      | 20 +++++++++++++++++++-
 public/themes/simpleboot3/cart/zj_cart/order_confirm.html |  7 +++++--
 simplewind/extend/Payment.php                             |  2 +-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/app/pay/controller/PayController.php b/app/pay/controller/PayController.php
index 7561e09..0e0ddef 100644
--- a/app/pay/controller/PayController.php
+++ b/app/pay/controller/PayController.php
@@ -89,7 +89,25 @@ class PayController extends HomeBaseController
     public function notify()
     {
         $pay = new \Payment();
-        $pay->handleNotify();
+        $notify = $pay->handleNotify();
+        if(!empty($notify)) {
+            $oid = $notify['attach'];
+            if(Db::name('zj_order')->where(['id'=>$oid])->value('step') == 2) {
+                echo "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
+                exit();
+            }else {
+                //改变订单状态
+                $update = [
+                    'id' => $oid,
+                    'step' => 2
+                ];
+                if(Db::name('zj_order')->update($update)) {
+                    echo "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
+                    exit();
+                }
+            }
+        }
+
     }
 
 }
\ No newline at end of file
diff --git a/public/themes/simpleboot3/cart/zj_cart/order_confirm.html b/public/themes/simpleboot3/cart/zj_cart/order_confirm.html
index 32cce47..33538eb 100644
--- a/public/themes/simpleboot3/cart/zj_cart/order_confirm.html
+++ b/public/themes/simpleboot3/cart/zj_cart/order_confirm.html
@@ -233,6 +233,9 @@
         if(pay_type == '') {
             return false;
         }
+        if(address_id == '') {
+            return false;
+        }
         $.ajax({
             url:"{:url('pay/Pay/done')}",
             data:{
@@ -253,7 +256,7 @@
                         paySign: data.data.paySign, // 支付签名
                         success: function (res) {
                             window.location.href=data.url;
-                        }
+                        },
                     });
                 }
             }
@@ -288,7 +291,7 @@
 
 
     wx.config({
-        debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
         appId: '{$js_sdk.appId}', // 必填,公众号的唯一标识
         timestamp: '{$js_sdk.timestamp}', // 必填,生成签名的时间戳
         nonceStr: '{$js_sdk.nonceStr}', // 必填,生成签名的随机串
diff --git a/simplewind/extend/Payment.php b/simplewind/extend/Payment.php
index b9ab763..16b8b55 100644
--- a/simplewind/extend/Payment.php
+++ b/simplewind/extend/Payment.php
@@ -170,7 +170,7 @@ class Payment {
                 $signA = "appid=".$data['appid']."&attach=".$data['attach']."&bank_type=".$data['bank_type']."&cash_fee=".$data['cash_fee']."&fee_type=".$data['fee_type']."&is_subscribe=".$data['is_subscribe']."&mch_id=".$data['mch_id']."&nonce_str=".$data['nonce_str']."&openid=". $data['openid']."&out_trade_no=".$data['out_trade_no']."&result_code=".$data['result_code']."&return_code=".$data['return_code']."&time_end=".$data['time_end']."&total_fee=".$data['total_fee']."&trade_type=".$data['trade_type']."&transaction_id=".$data['transaction_id']."&key=".config('Key');
                 $sign = strtoupper(MD5($signA));
                 if($sign == $data['sign']) {
-                    return $data['attach'];
+                    return $data;
                 }else {
                     return false;
                 }
--
libgit2 0.24.0