Browse Source

xyz provider xc

HARUHARU 4 years ago
parent
commit
4b55733ce0

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

@@ -333,6 +333,19 @@ $tonglu_phone = ['name' => 'tonglu', 'store_id' => 33,'qualitys' => '4',
     ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
     'official_sn' => true, 'refill_type' => 'api'];
 
 
+$xc_phone = ['name' => 'xc', 'store_id' => 34,'qualitys' => '1',
+    'amount' => [
+        10 => [['goods_id' => 6430, 'price' => 9.6, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        20 => [['goods_id' => 6431, 'price' => 19.2, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        30 => [['goods_id' => 6432, 'price' => 28.8, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 6433, 'price' => 48, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 6434, 'price' => 96, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 6435, 'price' => 192, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        300 => [['goods_id' => 6436, 'price' => 288, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        500 => [['goods_id' => 6437, 'price' => 480, 'quality' => 1, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -350,5 +363,6 @@ $phone_providers = [
     ['name' => 'tongy', 'cfg' => $tongy_phone],
     ['name' => 'tongy', 'cfg' => $tongy_phone],
     ['name' => 'weiyi', 'cfg' => $weiyi_phone],
     ['name' => 'weiyi', 'cfg' => $weiyi_phone],
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
     ['name' => 'tonglu', 'cfg' => $tonglu_phone],
+//    ['name' => 'xc', 'cfg' => $xc_phone],
 ];
 ];
 $config['phone_providers'] = $phone_providers;
 $config['phone_providers'] = $phone_providers;

+ 16 - 11
helper/refill/api/xyz/xc/RefillCallBack.php

@@ -21,10 +21,10 @@ class RefillCallBack implements refill\IRefillCallBack
 
 
     private function sign($params)
     private function sign($params)
     {
     {
-        $body[] = $params['wt_orderid'];
-        $body[] = $params['Pay_iphone'];
-        $body[] = $params['Pay_orderid'];
-        $body[] = $params['Pay_money'];
+        $body['wt_orderid'] = $params['wt_orderid'];
+        $body['pay_iphone'] = $params['pay_iphone'];
+        $body['pay_orderid'] = $params['pay_orderid'];
+        $body['pay_money'] = $params['pay_money'];
 
 
         ksort($body);
         ksort($body);
         $str = '';
         $str = '';
@@ -39,18 +39,23 @@ class RefillCallBack implements refill\IRefillCallBack
     public function notify($params)
     public function notify($params)
     {
     {
         $status = intval($params['status']);
         $status = intval($params['status']);
-        $order_sn = $params['Pay_orderid'];
+        $order_sn = $params['pay_orderid'];
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
         if(empty($order_info)) {
         if(empty($order_info)) {
-            return [false,false];
+            return [false, false, false,false];
         }
         }
         $order_id = $order_info['order_id'];
         $order_id = $order_info['order_id'];
         $data['official_sn'] = $params['wt_orderid'];
         $data['official_sn'] = $params['wt_orderid'];
-        Model('refill_order')->edit($order_id, $data);
-        if($status === 1) {
-            return [$order_id,true];
-        } else {
-            return [$order_id,false];
+
+        if ($status === 1) {
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 0) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
         }
         }
     }
     }
 }
 }

+ 9 - 6
helper/refill/api/xyz/xc/RefillPhone.php

@@ -37,11 +37,11 @@ class RefillPhone extends refill\IRefillPhone
         {
         {
             Log::record($resp,Log::DEBUG);
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
             $resp = json_decode($resp,true);
-            if($resp['code'] == 200 && $resp['result'] == 'SUCCESS') {
+            if($resp['code'] == 200 && $resp['result'] == 'success') {
                 return [true,$resp['result'], false];
                 return [true,$resp['result'], false];
             }
             }
             else {
             else {
-                return [false,$resp['result'], false];
+                return [false,$resp['info'], false];
             }
             }
         }
         }
     }
     }
@@ -61,15 +61,18 @@ class RefillPhone extends refill\IRefillPhone
             Log::record($resp,Log::DEBUG);
             Log::record($resp,Log::DEBUG);
             $resp = json_decode($resp,true);
             $resp = json_decode($resp,true);
             $order_state = -1;
             $order_state = -1;
-            if ($resp['status'] == 1) {
+            $status = $resp['data']['status'];
+            if ($status == 1) {
                 $order_state = ORDER_STATE_SUCCESS;
                 $order_state = ORDER_STATE_SUCCESS;
-            } elseif ($resp['status'] == 2) {
+                $save['official_sn'] = $resp['data']['wt_orderid'];
+                Model('refill_order')->edit($refill_info['order_id'], $save);
+            } elseif ($status == 0) {
                 $order_state = ORDER_STATE_CANCEL;
                 $order_state = ORDER_STATE_CANCEL;
-            } elseif ($resp['status'] == 6){
+            } elseif ($status == 2){
                 $order_state = ORDER_STATE_SEND;
                 $order_state = ORDER_STATE_SEND;
             }
             }
             if ($order_state == -1) {
             if ($order_state == -1) {
-                return [false, $resp['data']];
+                return [false, $resp['info']];
             }
             }
             return [true, $order_state];
             return [true, $order_state];
         }
         }

+ 6 - 5
helper/refill/api/xyz/xc/config.php

@@ -6,9 +6,10 @@ namespace refill\xc;
 
 
 class config
 class config
 {
 {
-    const ORDER_URL = 'http://180.215.207.83/pay/order/upload';
-    const QUERY_ORDER_URL = 'http://180.215.207.83/chaxun/order/queryStatus';
-    const NUMBER_ID= '10019';
-    const KEY = '346ab585a7cbeccd4f11e54ffaf5fe1c';
-    const NOTIFY_URL =  BASE_SITE_URL."/mobile/signature.php";
+    const ORDER_URL = 'http://202.79.172.201/pay/order/upload';
+    const QUERY_ORDER_URL = 'http://202.79.172.201/chaxun/order/queryStatus';
+    const NUMBER_ID= '10010';
+    const KEY = '11a5e71e0da0e3ae0942cbd6b7c62f2a';
+//    const NOTIFY_URL =  BASE_SITE_URL."/mobile/refill_xc.php";
+    const NOTIFY_URL = "https://www.xyzshops.cn/mobile/signature.php";
 }
 }

+ 10 - 2
test/TestRefill.php

@@ -294,7 +294,7 @@ class TestRefill extends TestCase
     public function testPrice()
     public function testPrice()
     {
     {
         $amounts = [10,20,30,50,100,200,300,500];
         $amounts = [10,20,30,50,100,200,300,500];
-        $rate = 0.94;
+        $rate = 0.96;
         foreach ($amounts as $amount){
         foreach ($amounts as $amount){
             $price[] = $amount * $rate;
             $price[] = $amount * $rate;
         }
         }
@@ -311,7 +311,15 @@ class TestRefill extends TestCase
     public function testXcPhone()
     public function testXcPhone()
     {
     {
         $providers = new refill\xc\RefillPhone([]);
         $providers = new refill\xc\RefillPhone([]);
-        $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
+        $resp = $providers->add(13699279618, 5, 100, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '87961616926444043617']);
+        $params['pay_orderid'] = '87961616926444043617';
+        $params['pay_iphone'] = '18500608333';
+        $params['pay_money'] = '100';
+        $params['wt_orderid'] = '202103281816121070';
+        $params['status'] = '1';
+        $params['sign'] = 'f7be2e859a5a6dc7b1a8273361617752';
+//        refill\RefillFactory::instance()->notify('xc',$params);
     }
     }
 
 
     public function testAfandPhone()
     public function testAfandPhone()