xiaoyu %!s(int64=2) %!d(string=hai) anos
pai
achega
4ec99ff194

+ 45 - 0
data/config/xyz/refill.ini.php

@@ -6582,6 +6582,51 @@ $weixue_phone = ['name' => 'weixue', 'store_id' => 243, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yelin_hf_phone = ['name' => 'yelin_hf', 'store_id' => 244, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8015, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8015, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8015, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 8016, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8016, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8016, 'price' => 19, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 8017, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8017, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8017, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8018, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8018, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8018, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8019, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8019, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8019, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8020, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8020, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8020, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 8021, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8021, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8021, 'price' => 285, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 8022, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8022, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8022, 'price' => 475, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],

+ 4 - 3
helper/refill/api/xyz/yelin_hf/RefillCallBack.php

@@ -59,17 +59,18 @@ class RefillCallBack implements refill\IRefillCallBack
             return [false, false, false,false];
         }
         $order_id = $order_info['order_id'];
-        Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['trade_no']]);
         if ($status === 'SUCCESS') {
+            $data['ch_trade_no'] = $params['trade_no'];
             $data['official_sn'] = strtolower($params['official_sn']) == 'null' ? '' : $params['official_sn'];
             Model('refill_order')->edit($order_id, $data);
             return [$order_id, true, false,true];
         }
         elseif ($status === 'CANCEL') {
-            return [$order_id, false, false,true];
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['trade_no']]);
+            return [$order_id, false, true,true];
         }
         else {
             return [$order_id, false, false,false];
         }
     }
-}
+}

+ 3 - 2
helper/refill/api/xyz/yelin_hf/RefillPhone.php

@@ -73,12 +73,13 @@ class RefillPhone extends refill\IRefillPhone
             elseif ($resp['code'] === 200)
             {
                 $data = $resp['datas'];
-                Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $data['trade_no']]);
                 if ($data['order_state'] == '40') {
+                    $save['ch_trade_no'] = $data['trade_no'];
                     $save['official_sn'] = strtolower($resp['official_sn']) == 'null' ? '' : $resp['official_sn'];
                     Model('refill_order')->edit($refill_info['order_id'], $save);
                     $order_state = ORDER_STATE_SUCCESS;
                 } elseif ($data['order_state'] === '0') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $data['trade_no']]);
                     $order_state = ORDER_STATE_CANCEL;
                 } elseif (in_array($data['order_state'], ['10', '20', '30', '50'], true)) {
                     $order_state = ORDER_STATE_SEND;
@@ -151,4 +152,4 @@ class RefillPhone extends refill\IRefillPhone
 
         return md5($body);
     }
-}
+}