xiaoyu %!s(int64=2) %!d(string=hai) anos
pai
achega
0b161304e2

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

@@ -6875,6 +6875,51 @@ $jinfeng_fs_phone = ['name' => 'jinfeng_fs', 'store_id' => 251, 'qualitys' => '1
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$douxun_phone = ['name' => 'douxun', 'store_id' => 252, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8087, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8087, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8087, 'price' => 10.01, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8088, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8088, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8088, 'price' => 20.02, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 8089, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8089, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8089, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+//            ['goods_id' => 8090, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8090, 'price' => 51.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8090, 'price' => 50.05, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8091, 'price' => 102.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8091, 'price' => 102.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8091, 'price' => 103.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8092, 'price' => 205.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8092, 'price' => 205.2, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8092, 'price' => 206.2, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 8093, 'price' => 308.1, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8093, 'price' => 307.8, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8093, 'price' => 309.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 8094, 'price' => 513.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8094, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8094, 'price' => 515.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -7083,6 +7128,7 @@ $phone_providers = [
     ['name' => 'feimingyu_high', 'cfg' => $feimingyu_high_phone],
     ['name' => 'weixue_yi', 'cfg' => $weixue_yi_phone],
     ['name' => 'jinfeng_fs', 'cfg' => $jinfeng_fs_phone],
+    ['name' => 'douxun', 'cfg' => $douxun_phone],
 
 ];
 $config['phone_providers'] = $phone_providers;

+ 4 - 6
helper/refill/api/xyz/douxun/RefillCallBack.php

@@ -24,7 +24,8 @@ class RefillCallBack implements refill\IRefillCallBack
 
     public function notify($params)
     {
-        $status = intval($params['body']['item']['result']);
+        $item = $params['body']['item'];
+        $status = $item['result'];
         $order_sn = $params['id'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if (empty($order_info)) {
@@ -33,15 +34,12 @@ class RefillCallBack implements refill\IRefillCallBack
 
         $order_id = $order_info['order_id'];
         if ($status === '0000') {
-            $data['official_sn'] = strtolower($params['body']['item']['operatorNo']) == 'null' ? '' : $params['body']['item']['operatorNo'];
+            $data['official_sn'] = strtolower($item['operatorNo']) == 'null' ? '' : $item['operatorNo'];
             Model('refill_order')->edit($order_id, $data);
             return [$order_id, true, false,true];
         }
-        elseif ($status === 8030) {
-            return [$order_id, false, true,true];
-        }
         else {
-            return [$order_id, false, false,false];
+            return [$order_id, false, true,true];
         }
     }
 }

+ 10 - 5
helper/refill/api/xyz/douxun/RefillPhone.php

@@ -91,15 +91,20 @@ class RefillPhone extends refill\IRefillPhone
             if (empty($resp)) {
                 return [false, '网络错误'];
             } elseif ($resp['head']['result'] === '0000') {
-                $status = $resp['body']['item']['state'];
-                if ($status === 1) {
+                $item = $resp['body']['item'];
+                $status = $item['state'];
+                if ($status === '1') {
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif ($status === 2) {
+                    $updata['official_sn'] = $item['operatorNo'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                } elseif ($status === '2') {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif ($status === 0) {
+                } elseif ($status === '0') {
                     $order_state = ORDER_STATE_SEND;
+                } elseif ($status === '-1' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
                 } else {
-                    return [false, $resp['msg']];
+                    return [false, $item['desc']];
                 }
 
                 return [true, $order_state];

+ 10 - 0
mobile/callback/refill_douxun.php

@@ -0,0 +1,10 @@
+<?php
+$content = $_SERVER['post_content'] ?? [];
+$input = refill\util::xmlToArray($content);
+
+refill\util::push_notify('kuaikuai',$input);
+echo
+'<response>
+	<result>0000</result>
+	<desc></desc>
+</response>';

+ 32 - 0
test/TestRefill.php

@@ -2606,6 +2606,38 @@ class TestRefill extends TestCase
         $resp = $provider->notify($params);
     }
 
+    public function testDouxun()
+    {
+        $provider = $this->getProvider('douxun');
+        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 4, 10, ['order_sn' => $this->make_sn(), 'regin_no' =>18]);
+//        $resp = $provider->query(['order_sn' => '15711665296902146642']);
+
+        $body = '<request>
+ <head>
+    <custInteId>BJQDWTC</custInteId>
+    <echo>tu7d1YZCB7Ca8wQNQC2mgEoMirD4an7R</echo>
+    <timestamp>20221009113824</timestamp>
+    <chargeSign>+jGibLIlbzG0Lzv0/sxdtg==</chargeSign>
+ </head>
+ <body>
+  <item>
+    <orderId>38901665286687817863</orderId>
+    <orderType>1</orderType>
+    <packCode>400030</packCode>
+    <mobile>15811535608</mobile>
+    <result>0017</result>
+    <desc>移动通道未开通或维护中</desc>
+    <operatorNo></operatorNo>
+  </item>
+ </body>
+</request>';
+//        $params = refill\util::xmlToArray($body);
+//        $provider = $this->getProvider('douxun', 'RefillCallBack');
+//        $ret = $provider->verify($params);
+//        $resp = $provider->notify($params);
+    }
+
     public function testAmingjd()
     {
 //        $provider = new refill\amingjd\RefillPhone([]);