Browse Source

Merge branch 'mhtest' of ssh://gogs.ibaobei.shop:10022/stanley/xyzshop into mhtest

stanley-king 1 year atrás
parent
commit
fdfbdc5a4c

+ 4 - 4
data/config/mh/refill.ini.php

@@ -59,7 +59,7 @@ $suhu_normal = ['name' => 'suhu_normal', 'store_id' => 379,'qualitys' => '3',
         ],
         100 => [
             ['goods_id' => 8960, 'price' => 100.1, 'quality' => 3, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8960, 'price' => 94.68, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8960, 'price' => 97.85, 'quality' => 3, 'card_type' => 'chinaunicom'],
             ['goods_id' => 8960, 'price' => 100.3, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
     ],
@@ -309,8 +309,8 @@ $zhixin_fast = ['name' => 'zhixin_fast', 'store_id' => 391, 'qualitys' => '2',
         ],
         100 => [
             ['goods_id' => 9056, 'price' => 100.1, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9056, 'price' => 99.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 9056, 'price' => 100.3,'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 9056, 'price' => 99.1,  'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9056, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
             ['goods_id' => 9057, 'price' => 200.2,  'quality' => 2, 'card_type' => 'chinamobile'],
@@ -318,7 +318,7 @@ $zhixin_fast = ['name' => 'zhixin_fast', 'store_id' => 391, 'qualitys' => '2',
             ['goods_id' => 9057, 'price' => 200.3,  'quality' => 2, 'card_type' => 'chinatelecom'],
         ],
         300 => [
-            ['goods_id' => 9058, 'price' => 300.3,  'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9058, 'price' => 300.3,   'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 9058, 'price' => 300.15,  'quality' => 2, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9058, 'price' => 300.45,  'quality' => 2, 'card_type' => 'chinatelecom'],
         ],

+ 7 - 7
helper/refill/api/mh/zhixin_fast/RefillPhone.php

@@ -43,7 +43,7 @@ class RefillPhone extends refill\IRefillPhone
             'phone_no'=> "$phone",
             'cp' => $nSortType,
             'city_code' => "",
-            'recharge_amount' => $amount,
+            'recharge_amount' => $amount*100,
             'recharge_type' => 0,
             'recharge_desc' => "",
             'notify_url' => config::NOTIFY_URL,
@@ -94,7 +94,7 @@ class RefillPhone extends refill\IRefillPhone
         $params = [
             'mrch_no' => config::szAgentId,
             'request_time' => date('YmdHis'),
-            'client_order_no'   => $refill_info[order_sn],
+            'client_order_no'   => $refill_info['order_sn'],
             'order_time'   => date('YmdHis')
         ];
 
@@ -120,13 +120,13 @@ class RefillPhone extends refill\IRefillPhone
             $official_sn = '';
             $nRtn = intval($resp['code']);
             if ($nRtn === 2) {
-                if($resp[data][recharge_status]=="1")//交易中
+                if($resp['data']['recharge_status']=="1")//交易中
                 {
                     $order_state = ORDER_STATE_SEND;
-                }elseif ($resp[data][recharge_status]=="2") //交易成功
+                }elseif ($resp['data']['recharge_status']=="2") //交易成功
                 {
-                    $official_sn = $resp[data][elecardID] ?? '';
-                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => ($resp[data][elecardID] ?? '')]);
+                    $official_sn = $resp['data']['elecardID'] ?? '';
+                    Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => ($resp['data']['elecardID'] ?? '')]);
                     $order_state = ORDER_STATE_SUCCESS;
                 }else{//交易失败
                     $order_state = ORDER_STATE_CANCEL;
@@ -165,7 +165,7 @@ class RefillPhone extends refill\IRefillPhone
             if (empty($resp)) {
                 return [false, '系统错误'];
             } elseif (intval($resp['code']) === 2) {
-                return [true, ncPriceFormat($resp['data']['balance'])];
+                return [true, ncPriceFormat($resp['data']['balance']+$resp['data']['credit'])];
             } else {
                 return [false, '其它,失败'];
             }

+ 11 - 14
helper/refill/api/mh/zhixin_fast/config.php

@@ -11,34 +11,31 @@ class config
     const BALANCE_URL = 'http://balance.julives.com:9080/zxpaycore/v2/balance';
     const NOTIFY_URL  = BASE_SITE_URL . "/racc/callback/mh/zhixin_fast.php";
 
-
-    public const ERRCODES = ["600","602","603","606","622","623","624","615","637","751"];
+    public const ERRCODES = [600,602,603,606,622,623,624,615,637,751];
 
     const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
 
     public const ERRMSG = [
-        "600" => '商户禁用,接口已关闭',
-        "602" => '订单提交失败,未充值',
-        "603" => '参数校验错误',
-        "606" => '数据签名错误',
-        "622" => '商户不存在',
-        "623" => '通道维护',
-        "624" => '产品未配置',
-        "615" => '号码归属地未配置',
-        "637" => '流量充值未配置',
-        "751" => 'IP地址限制',
+        600 => '商户禁用,接口已关闭',
+        602 => '订单提交失败,未充值',
+        603 => '参数校验错误',
+        606 => '数据签名错误',
+        622 => '商户不存在',
+        623 => '通道维护',
+        624 => '产品未配置',
+        615 => '号码归属地未配置',
+        637 => '流量充值未配置',
+        751 => 'IP地址限制',
     ];
 
     public static function sign($params)
     {
         ksort($params);
-
         $body = "";
         foreach ($params as $k => $v)
         {
             $body .= "$k" . "$v";
         }
-
         $body .= config::secret_key;
         return md5($body);
     }

+ 18 - 0
test/mh/TestRefill.php

@@ -272,4 +272,22 @@ class TestRefill extends TestCase
 
         $sn = $get_osn('充值成功:22934014758535263');
     }
+
+    public function testZX()
+    {
+        $provider = $this->getProvider('zhixin_fast');
+        $order_sn = $this->make_sn();
+        $resp = $provider->add(15652921127, 5, 10, ['order_sn' => $order_sn, 'regin_no' => 1]);
+        $resp = $provider->query(['order_sn' => $order_sn]);
+        $resp = $provider->balance();
+    }
+
+    public function testZXCB()
+    {
+        $content = '{"client_order_no":"17741706252802986862","up_order_no":"20240126150648323856096","product_type":"1","phone_no":"15652921127","deduction_amount":"1007.0000","recharge_status":"2","elecardID":"110101101232401261506580165004","sign":"68121ec19d480e96d3c1a9828c3f65b5","channel_type":"other"}';
+        $provider = $this->getProvider('zhixin_fast','RefillCallBack');
+        $content = json_decode($content,true);
+        $provider->verify($content);
+        $provider->notify($content);
+    }
 }