浏览代码

tongy update

xiaoyu 3 年之前
父节点
当前提交
c66f9fb95e
共有 2 个文件被更改,包括 55 次插入53 次删除
  1. 53 53
      helper/refill/api/xyz/tongy/RefillCallBack.php
  2. 2 0
      helper/refill/api/xyz/tongy/RefillPhone.php

+ 53 - 53
helper/refill/api/xyz/tongy/RefillCallBack.php

@@ -1,54 +1,54 @@
-<?php
-
-
-namespace refill\tongy;
-
-require_once(BASE_HELPER_RAPI_PATH . '/tongy/config.php');
-
-
-use refill;
-
-class RefillCallBack implements refill\IRefillCallBack
-{
-    public function verify($params): bool
-    {
-        $sign = $this->sign($params);
-        if ($params['sign'] == $sign) {
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    private function sign($params)
-    {
-        $content  = $params['ShopId'] . $params['UserId'] . $params['SysOrderId'] . $params['OrderId'] . $params['State'];
-        $content .= $params['Timestamp'] . config::KEY;
-        return md5($content);
-    }
-
-    //[$order_id, $success, $can_try, $need_handle]
-    public function notify($params)
-    {
-        $status = intval($params['State']);
-        $order_sn = $params['OrderId'];
-        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
-        if (empty($order_info)) {
-            return [false, false, false,false];
-        }
-        $order_id = $order_info['order_id'];
-        
-        $data['official_sn'] = strtolower($params['op_order_id']) == 'null' ? '' : $params['op_order_id'];
-
-        if ($status === 4) {
-            Model('refill_order')->edit($order_id, $data);
-            return [$order_id, true, false,true];
-        }
-        elseif ($status === 5) {
-            return [$order_id, false, true,true];
-        }
-        else {
-            return [$order_id, false, false,false];
-        }
-    }
+<?php
+
+
+namespace refill\tongy;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tongy/config.php');
+
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        $content  = $params['ShopId'] . $params['UserId'] . $params['SysOrderId'] . $params['OrderId'] . $params['State'];
+        $content .= $params['Timestamp'] . config::KEY;
+        return md5($content);
+    }
+
+    //[$order_id, $success, $can_try, $need_handle]
+    public function notify($params)
+    {
+        $status = intval($params['State']);
+        $order_sn = $params['OrderId'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false,false];
+        }
+        $order_id = $order_info['order_id'];
+        
+        $data['official_sn'] = strtolower($params['VoucherContent']) == 'null' ? '' : $params['VoucherContent'];
+
+        if ($status === 4) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 5) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
 }

+ 2 - 0
helper/refill/api/xyz/tongy/RefillPhone.php

@@ -79,6 +79,8 @@ class RefillPhone extends refill\IRefillPhone
             elseif ($resp['Code'] == 10023)
             {
                 if ($resp['State'] == 4) {
+                    $updata['official_sn'] = $resp['VoucherContent'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($resp['State'] == 5) {
                     $order_state = ORDER_STATE_CANCEL;