Browse Source

update offer_sn and saihu query

ayHaru 4 years ago
parent
commit
d9c2306923

+ 4 - 1
helper/refill/RefillFactory.php

@@ -45,6 +45,9 @@ require_once(BASE_HELPER_PATH . '/refill/saihu/RefillOil.php');
 require_once(BASE_HELPER_PATH . '/refill/saihu/RefillPhone.php');
 require_once(BASE_HELPER_PATH . '/refill/saihu/RefillCallBack.php');
 
+require_once(BASE_HELPER_PATH . '/refill/yifa/RefillPhone.php');
+require_once(BASE_HELPER_PATH . '/refill/yifa/RefillCallBack.php');
+
 use Log;
 use mtopcard;
 use QueueClient;
@@ -542,7 +545,7 @@ class RefillFactory
             "trade_no" => $refill_info['order_sn'],
             "idcard" => $refill_info['idcard'] ?? "",
             "card_name" => $refill_info['card_name'] ?? "",
-            'official_sn' => $refill_info['offer_sn'] ?? "",
+            'official_sn' => $refill_info['official_sn'] ?? "",
             "state" => $state];
 
         $secure_key = $mch_info['secure_key'];

+ 1 - 1
helper/refill/bjb/RefillCallBack.php

@@ -35,7 +35,7 @@ class RefillCallBack implements refill\IRefillCallBack
             return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
-        $data['offer_sn'] = $params['bz'];
+        $data['official_sn'] = $params['bz'];
         Model('refill_order')->edit($order_id, $data);
 
         if ($status === 1) {

+ 2 - 2
helper/refill/lx/RefillCallBack.php

@@ -20,8 +20,8 @@ class RefillCallBack implements refill\IRefillCallBack
         if (empty($order_info)) {
             return [false, false, false,false];
         }
-        if(!empty($params['offer_sn']) && $state == 'order_success'){
-            $data['offer_sn'] = $params['offer_sn'];
+        if(!empty($params['official_sn']) && $state == 'order_success'){
+            $data['official_sn'] = $params['official_sn'];
             Model('refill_order')->edit($order_id, $data);
         }
         if ($state == 'order_success') {

+ 27 - 0
helper/refill/saihu/RefillOil.php

@@ -60,6 +60,33 @@ class RefillOil extends refill\IRefillOil
 
     public function query($refill_info)
     {
+        $params['ordersn'] = $refill_info['order_sn'];
+        $params['app_id'] = config::APP_ID;
+        $params['sign'] = md5(config::APP_ID . config::APP_KEY . $refill_info['order_sn']);
 
+        $resp = http_request(config::QUERY_URL,$params);
+        if($resp === false) {
+            return [false,'系统错误'];
+        }
+        else {
+            Log::record($resp,Log::DEBUG);
+            $resp = json_decode($resp,true);
+            if($resp['code'] == 0) {
+                if($resp['result']['order_state'] == 1){
+                    $data['order_state'] = ORDER_STATE_SUCCESS;
+                }
+                if($resp['result']['order_state'] == 9){
+                    $data['order_state'] = ORDER_STATE_CANCEL;
+                }
+                if(empty($data)){
+                    return [false,$resp['result']];
+                }
+                Model('vr_order')->edit($refill_info['order_id'], $data);
+                return [true,$resp['result']];
+            }
+            else {
+                return [false,$resp['msg']];
+            }
+        }
     }
 }

+ 1 - 0
helper/refill/saihu/config.php

@@ -7,6 +7,7 @@ namespace refill\saihu;
 class config
 {
     const ORDER_URL = 'https://qzcz.edusahoo.com.cn/api/sinopec/onlineorder';
+    const QUERY_URL = 'https://qzcz.edusahoo.com.cn/api/sinopec/ordersta';
 
     const APP_ID = '0ceb5bc14dca15c4e5e53244d30b30bc';
     const APP_KEY = '03ed24aec631996fT0pVtw1tckzXhRy5KQHkIFtEIc9OBzg3F0RmWYFQ3F3AKzkKWqPAKPFzNFEdRkqkZudpsI';

+ 1 - 1
helper/refill/yifa/RefillCallBack.php

@@ -57,7 +57,7 @@ class RefillCallBack implements refill\IRefillCallBack
             return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
-        $data['offer_sn'] = $params['isp_order_sn'];
+        $data['official_sn'] = $params['isp_order_sn'];
         $data['ch_trade_no'] = $params['order_sn'];
         Model('refill_order')->edit($order_id, $data);
 

+ 1 - 1
helper/refill/yifa/config.php

@@ -6,7 +6,7 @@ namespace refill\yifa;
 
 class config
 {
-    const ORDER_URL = 'http://host/api/coder/order';
+    const ORDER_URL = 'http://www.xatc.club/api/coder/order';
     const APP_ID= 'e4a61b2acf1119c72c1ed9b61781494e';
     const APP_SECRET = '97a4f0c19b4b34578df4a65b5daddf50b7cb9ba02d3690d015f747a5feef1381';
     const NOTIFY_URL = "https://www.xyzshops.cn/mobile/refill_yifa.php";

+ 3 - 1
mobile/control/merchant_order.php

@@ -20,7 +20,9 @@ class merchant_orderControl extends mbMerchantControl
         if ($_GET['start_time'] > 0 && $_GET['end_time'] > 0) {
             $cond['refill_order.order_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
         }
-        $fields = 'refill_order.order_id,refill_order.order_sn,refill_order.mchid,refill_order.card_no,refill_order.mch_order,refill_order.card_type,refill_order.order_time,refill_order.notify_time,refill_order.refill_amount,refill_order.mch_amount,vr_order.order_state,refill_order.channel_name,refill_order.ch_trade_no';
+        $fields = 'refill_order.order_id,refill_order.order_sn,refill_order.mchid,refill_order.card_no,
+        refill_order.mch_order,refill_order.card_type,refill_order.order_time,refill_order.notify_time,
+        refill_order.refill_amount,refill_order.mch_amount,vr_order.order_state,refill_order.channel_name,refill_order.ch_trade_no,refill_order.official_sn';
         $order_list = $model_vr_order->getMerchantOrderList($cond, $this->page, $fields, 'refill_order.order_id desc');
         $order_list = $this->merchant_order_format($order_list);
         $result['data'] = $order_list;

+ 1 - 1
shop/control/store_refill_order.php

@@ -163,7 +163,7 @@ class store_refill_ordercontrol extends BaseSellerControl
                 $params = ['state_type' => $state_type,
                     'order_id' => $order_id,
                     'channel_name' => $refill_info['channel_name'],
-                    'offer_sn' => $ch_trade_no];
+                    'official_sn' => $ch_trade_no];
                 $resp = http_request(BASE_SITE_URL . '/mobile/refill_inner.php', $params, 'POST');
                 if ($resp === 'success') {
                     showDialog("成功", 'reload', 'js');