xiaoyu před 3 roky
rodič
revize
5c2c2d7ea5

+ 14 - 1
data/config/win/refill.ini.php

@@ -2841,6 +2841,18 @@ $xiaoniu_hf_phone = ['name' => 'xiaoniu_hf', 'store_id' => 141, 'qualitys' => '3
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$shuoruan_phone = ['name' => 'shuoruan', 'store_id' => 142, 'qualitys' => '2',
+    'amount' => [
+//        10 => [['goods_id' => 7219, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 7220, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        30 => [['goods_id' => 7221, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 7222, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 7223, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 7224, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 7225, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 7226, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
@@ -2949,7 +2961,8 @@ $phone_providers = [
     ['name' => 'pushang', 'cfg' => $pushang_phone],
     ['name' => 'huafutong', 'cfg' => $huafutong_phone],
     ['name' => 'dinghui', 'cfg' => $dinghui_phone],
-    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone]
+    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone],
+    ['name' => 'shuoruan', 'cfg' => $shuoruan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -2841,6 +2841,18 @@ $xiaoniu_hf_phone = ['name' => 'xiaoniu_hf', 'store_id' => 141, 'qualitys' => '3
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$shuoruan_phone = ['name' => 'shuoruan', 'store_id' => 142, 'qualitys' => '2',
+    'amount' => [
+//        10 => [['goods_id' => 7219, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 7220, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        30 => [['goods_id' => 7221, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 7222, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 7223, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 7224, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 7225, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 7226, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
@@ -2949,7 +2961,8 @@ $phone_providers = [
     ['name' => 'pushang', 'cfg' => $pushang_phone],
     ['name' => 'huafutong', 'cfg' => $huafutong_phone],
     ['name' => 'dinghui', 'cfg' => $dinghui_phone],
-    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone]
+    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone],
+    ['name' => 'shuoruan', 'cfg' => $shuoruan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 14 - 1
data/config/xyzadm/refill.ini.php

@@ -2841,6 +2841,18 @@ $xiaoniu_hf_phone = ['name' => 'xiaoniu_hf', 'store_id' => 141, 'qualitys' => '3
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$shuoruan_phone = ['name' => 'shuoruan', 'store_id' => 142, 'qualitys' => '2',
+    'amount' => [
+//        10 => [['goods_id' => 7219, 'price' => 9.97, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        20 => [['goods_id' => 7220, 'price' => 19.94, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        30 => [['goods_id' => 7221, 'price' => 29.91, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        50 => [['goods_id' => 7222, 'price' => 49.85, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        100 => [['goods_id' => 7223, 'price' => 99.7, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+        200 => [['goods_id' => 7224, 'price' => 199.4, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        300 => [['goods_id' => 7225, 'price' => 299.1, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']],
+//        500 => [['goods_id' => 7226, 'price' => 498.5, 'quality' => 2, 'card_type' => 'chinamobile,chinaunicom,chinatelecom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
@@ -2949,7 +2961,8 @@ $phone_providers = [
     ['name' => 'pushang', 'cfg' => $pushang_phone],
     ['name' => 'huafutong', 'cfg' => $huafutong_phone],
     ['name' => 'dinghui', 'cfg' => $dinghui_phone],
-    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone]
+    ['name' => 'xiaoniu_hf', 'cfg' => $xiaoniu_hf_phone],
+    ['name' => 'shuoruan', 'cfg' => $shuoruan_phone]
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 16 - 15
helper/refill/api/xyz/shuoruan/RefillPhone.php

@@ -19,12 +19,14 @@ class RefillPhone extends refill\IRefillPhone
     {
         $params['action'] = $action;
         $sign = $this->sign($params);
-        $params['sign'] = $sign;
-        $params['agentAccount'] = config::ACCOUNT;
-        $params = json_encode($params);
+        $rea_params['sign'] = $sign;
+        $rea_params['agentAccount'] = config::ACCOUNT;
+        $rea_params['busiBody'] = $params;
+        $rea_params = json_encode($rea_params);
 
         $url = config::API_URL;
-        return http_post_data($url, $params, config::ExtHeaders, $net_errno);
+        $resp = http_post_data($url, $rea_params, config::ExtHeaders, $net_errno);
+        return iconv('GB2312', 'UTF-8', $resp);
     }
 
     private function req_params(int $phone,int $amount, string $order_sn)
@@ -51,9 +53,9 @@ class RefillPhone extends refill\IRefillPhone
             $resp = json_decode($resp, true);
             if (empty($resp)) {
                 return [false, '系统错误', true];
-            } elseif (intval($resp['errorCode']) === 1) {
+            } elseif ($resp['errorCode'] === 1) {
                 return [true, $resp['chargeId'], false];
-            } elseif (in_array($resp['errorCode'], [-992, -993, -994, -995, -996, -997, -998])) {
+            } elseif (in_array($resp['errorCode'], [-992, -993, -994, -995, -996, -997, -998], true)) {
                 $net_errno = $resp['errorCode'];
                 return [false, $resp['errorDesc'], false];
             } else {
@@ -64,7 +66,8 @@ class RefillPhone extends refill\IRefillPhone
 
     public function query($refill_info)
     {
-        $resp = $this->url_request($refill_info['order_sn'],'CX');
+        $params['orderId'] = $refill_info['order_sn'];
+        $resp = $this->url_request($params,'CX');
 
         if (empty($resp)) {
             return [false, '系统错误'];
@@ -76,21 +79,19 @@ class RefillPhone extends refill\IRefillPhone
 
             if (empty($resp)) {
                 return [false, '系统错误'];
-            } elseif (intval($resp['errorCode']) === 1) {
+            } elseif ($resp['errorCode'] === 1) {
                 $status = $resp['orderStatuInt'];
-                if (in_array($status, [11, 16])) {
-                    $updata['official_sn'] = $resp['transo'];
-                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                if (in_array($status, ['11', '16'], true)) {
                     $order_state = ORDER_STATE_SUCCESS;
-                } elseif (in_array($status, [20, 21, 26])) {
+                } elseif (in_array($status, ['20', '21', '26'], true)) {
                     $order_state = ORDER_STATE_CANCEL;
-                } elseif (in_array($status, [0, 1, 2, 6])) {
+                } elseif (in_array($status, ['0', '1', '2', '6'], true)) {
                     $order_state = ORDER_STATE_SEND;
                 } else {
                     return [false, $resp['errorDesc']];
                 }
                 return [true, $order_state];
-            } elseif (intval($resp['errorCode']) === -201 && (time() - $refill_info['commit_time'] >= 180)) {
+            } elseif ($resp['errorCode'] === -201 && (time() - $refill_info['commit_time'] >= 180)) {
                 return [true, ORDER_STATE_NOEXIST];
             } else {
                 return [false, $resp['errorDesc']];
@@ -112,7 +113,7 @@ class RefillPhone extends refill\IRefillPhone
 
             if (empty($resp)) {
                 return [false, '系统错误'];
-            } elseif (intval($resp['errorCode']) === 1) {
+            } elseif ($resp['errorCode'] === 1) {
                 return [true, $resp['agentBalance']];
             } else {
                 return [false, $resp['errorDesc']];

+ 1 - 1
helper/refill/api/xyz/shuoruan/config.php

@@ -11,5 +11,5 @@ class config
     const ACCOUNT = '18600608333';
     const KEY = '471D690CFB902BD8';
     const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_shuoruan.php";
-    const ExtHeaders = ['Content-Type: application/json'];
+    const ExtHeaders = ['Content-Type: application/json;charset=GB2312'];
 }

+ 4 - 1
helper/refill/api/xyz/shuoruan/北京椰子.txt

@@ -4,4 +4,7 @@
 开发接口资料
 接口文档网址:http://apidoc.sy666.com/web/#/3
 接口订单提交地址:
-http://api.sohan.hk:50080/API
+http://api.sohan.hk:50080/API
+
+http://oshop.sohan.hk/
+账号:18600608333

+ 4 - 0
mobile/callback/refill_shuoruan.php

@@ -0,0 +1,4 @@
+<?php
+
+refill\util::push_notify('shuoruan',$_POST);
+echo ('OK');

+ 43 - 35
test/TestRefill.php

@@ -632,8 +632,8 @@ class TestRefill extends TestCase
 
     public function testTianyan()
     {
-        $providers = $this->getProvider('tianyan');
-        $resp = $providers->add(18500608333, 5, 1, ['order_sn' => $this->make_sn()]);
+        $providers = new refill\tianyan\RefillPhone([]);
+//        $resp = $providers->add(18500608333, 5, 10, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '71241628067981955316', 'card_no' => 18500608333, 'card_type' => 5]);
 //        $resp = $providers->balance();
         $params['amount'] = '100.00';
@@ -649,7 +649,7 @@ class TestRefill extends TestCase
         $params['ticketNo'] = '110103353022108050819140250945';
         $params['company'] = 'lt';
         $params['status'] = '2';
-//        refill\RefillFactory::instance()->notify('tianyan', $params);
+        refill\RefillFactory::instance()->notify('tianyan', $params);
     }
 
     public function testYunsuoyaoman()
@@ -772,21 +772,21 @@ class TestRefill extends TestCase
 
     public function testWangliantx()
     {
-        $providers = $this->getProvider('wangliantx');
-        $resp = $providers->balance();
+//        $providers = $this->getProvider('wangliantx');
+//        $resp = $providers->balance();
 //        for ($i = 1; $i<=1; $i++){
 //            $resp = $providers->add(18074608795, 6, 50, [
 //                'order_sn' => $this->make_sn(),
 //                'regin_no' => 1
 //            ]);
 //        }
-//        $resp = $providers->query(['order_sn' => '5064760687879181122498']);
+//        $resp = $providers->query(['order_sn' => '85901629801033376170']);
 
-//        $body = '{"userid":"10073664","sporderid":"85901629801033376170","orderid":"C5C5D4F49DB61A8773664","resultno":"1","merchantsubmittime":"20210824183109","ordermoney":"47.6","verifystring":"b6a873ecd6dc9cea3a410c6386cdab84","sign":"4a80e2a8c7b07c8aacada4feedd581bd","supnumber":"1000000083421082418345386156"}';
-//        $params = json_decode($body, true);
-//        $providers = $this->getProvider('wangliantx', 'RefillCallBack');
-//        $ret = $providers->verify($params);
-//        $resp = $providers->notify($params);
+        $body = '{"userid":"10073664","sporderid":"85901629801033376170","orderid":"C5C5D4F49DB61A8773664","resultno":"1","merchantsubmittime":"20210824183109","ordermoney":"47.6","verifystring":"b6a873ecd6dc9cea3a410c6386cdab84","sign":"4a80e2a8c7b07c8aacada4feedd581bd","supnumber":"1000000083421082418345386156"}';
+        $params = json_decode($body, true);
+        $providers = $this->getProvider('wangliantx', 'RefillCallBack');
+        $ret = $providers->verify($params);
+        $resp = $providers->notify($params);
     }
 
     public function testZhuojian()
@@ -938,16 +938,17 @@ class TestRefill extends TestCase
 
     public function testGuochuang_nation()
     {
-//        $providers = $this->getProvider('guochuang_nation');
+        $providers = $this->getProvider('guochuang_nation');
 //        $resp = $providers->add(18500608333, 5, 1, ['order_sn' => $this->make_sn(), 'regin_no' => 1]);
+        $resp = $providers->query(['order_sn' => '4372390688043259849812']);
 
-        $body = '{"account":"18500608333","evidence":"N/A","evidenceType":"","id":"D2021090718185107657","inTime":"2021/09/07 18:19:05","money":"1","outerId":"65261631009929751933","status":"SUCCESS"}';
-        $params['ts'] = 1631009945;
-        $params['sign'] = 'C53F921EB5573EF4D0C757C5B5D4185D';
-        $params['body'] = $body;
-        $providers = $this->getProvider('guochuang_nation','RefillCallBack');
-        $ret = $providers->verify($params);
-        $resp = $providers->notify($params);
+//        $body = '{"account":"19982440060","evidence":"1000000083421102010443856304","evidenceType":"","id":"D2021102010210473815","inTime":"2021/10/20 10:31:14","money":"100","outerId":"1659990688040464576756","status":"SUCCESS"}';
+//        $params['ts'] = 1634697074;
+//        $params['sign'] = 'C93583DEF43208A26983BC5427CFFF12';
+//        $params['body'] = $body;
+//        $providers = $this->getProvider('guochuang_nation','RefillCallBack');
+//        $ret = $providers->verify($params);
+//        $resp = $providers->notify($params);
     }
 
     public function testTianyanman()
@@ -999,15 +1000,11 @@ class TestRefill extends TestCase
 //        $resp = $providers->add(13699279618, 4, 100, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '68221631775122967358']);
 
-//        $body = '{"phone":"13699279618","orderNo":"F2109161452121045530","status":"success","otherNo":"68221631775122967358","msg":"提交/充值成功","ext":"524501553021467113"}';
-//        $params = json_decode($body, true);
+        $body = '{"phone":"13699279618","orderNo":"F2109161452121045530","status":"success","otherNo":"68221631775122967358","msg":"提交/充值成功","ext":"524501553021467113"}';
+        $params = json_decode($body, true);
         $providers = $this->getProvider('hangtong','RefillCallBack');
-//        $ret = $providers->verify($params);
-//        $resp = $providers->notify($params);
-
-        $body = '{"phone":"18651376439","orderNo":"F2110181020213141546","status":"fail","otherNo":"4185270687867621074422","msg":"提交/充值失败","ext":null}';
-        $inputs = json_decode($body,true) ?? [];
-            $resp = $providers->notify($inputs);
+        $ret = $providers->verify($params);
+        $resp = $providers->notify($params);
     }
 
     public function testJinfeng()
@@ -1195,16 +1192,27 @@ class TestRefill extends TestCase
         $data = $providers->notify($params);
     }
 
-    public function testXiaoniu_hf()
+    public function testShuoruan()
     {
-//        $providers = $this->getProvider('xiaoniu_hf');
+//        $providers = $this->getProvider('shuoruan');
 //        $resp = $providers->balance();
-//        $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
-//        $resp = $providers->query(['order_sn' => '64601634527198572270']);
-
-        $body = '{"content":"","realAmt":"0","status":"2","timestamp":"20211018112328","sign":"b69b420b0bfe950ea9f1d92fa1ed3b53","orderNo":"XN20211018112005318283580","mOrderNo":"64601634527198572270"}';
-        $params = json_decode($body, true);
-        $providers = $this->getProvider('xiaoniu_hf','RefillCallBack');
+//        $resp = $providers->add(13699279618, 4, 10, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '80261634802627091026']);
+
+        $params['Action'] = 'CX';
+        $params['AgentAccount'] = '18600608333';
+        $params['Agentbalance'] = '-9.970';
+        $params['Orderid'] = '80261634802627091026';
+        $params['Chargeid'] = '2162076796';
+        $params['Orderstatu_int'] = '16';
+        $params['Orderstatu_text'] = '缴费成功_';
+        $params['TransCash'] = '10.000';
+        $params['OrderPayment'] = '9.970';
+        $params['Errorcode'] = '0000';
+        $params['Errormsg'] = '';
+        $params['Sign'] = '654fbc24c3d0878247bc3be3ed699f16';
+
+        $providers = $this->getProvider('shuoruan','RefillCallBack');
         $ret = $providers->verify($params);
         $data = $providers->notify($params);
     }