Explorar el Código

cangbu feinimoshu kangkai lechong lingzhman moxj_fs moxj_new moxj_yd balance api

xiaoyu hace 3 años
padre
commit
02bf94b921

+ 2 - 0
admin/templates/default/provider.order.stats.php

@@ -380,6 +380,7 @@
         //多选
         let selest_nc
         let default_no_mch = $('input[name="default_no_mch"]').val().split(',');
+        console.log('name', default_no_mch);
         
         $.get('index.php?act=refill_order&op=provider_data',function(data) {
             data = JSON.parse(data)
@@ -387,6 +388,7 @@
             if (default_no_mch) {
                 for (let index = 0; index < default_no_mch.length; index++) {
                     for (let j = 0; j < data.length; j++) {
+
                         if (default_no_mch[index] == data[j].value) {
                             data[j].selected = true
                             

+ 27 - 0
helper/refill/api/xyz/cangbu/RefillPhone.php

@@ -101,6 +101,33 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['customerId'] = config::MCH_ID;
+        $params['timestamp'] = time();
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+        if(empty($resp)) {
+            return [false, '网络错误'];
+        }else{
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+            elseif($resp['code'] == 1)
+            {
+                return [true,$resp['data']['balance']];
+            }
+            else
+            {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
     private function sign($params)
     {
         $content = '';

+ 1 - 0
helper/refill/api/xyz/cangbu/config.php

@@ -9,6 +9,7 @@ class config
     //yd 950 dl949
     const ORDER_URL = 'https://api.irecycle.top/queryBuy';
     const QUERY_URL= 'https://api.irecycle.top/queryBizOrder';
+    const BALANCE_URL= 'https://api.irecycle.top//queryBalance';
 
     const MCH_ID= '112';
     const KEY = 'zs53xG61NinhlrXskhR0xnAaOyM7yG';

+ 15 - 2
helper/refill/api/xyz/feinimoshu_hf/RefillPhone.php

@@ -97,11 +97,24 @@ class RefillPhone extends refill\IRefillPhone
         $sign = $this->sign($params);
         $params['signature'] = $sign;
 
-        $resp = http_request(config::QUERY_URL,$params);
+        $resp = http_request(config::BALANCE_URL,$params);
         if($resp === false) {
+            return [false, '网络错误'];
         }
         else {
-
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            }
+            elseif($resp['code'] == 1)
+            {
+                return [true,$resp['data']['account']];
+            }
+            else
+            {
+                return [false, $resp['info']];
+            }
         }
     }
 

+ 29 - 0
helper/refill/api/xyz/kangkai/RefillPhone.php

@@ -142,6 +142,35 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['Account'] = config::Account;
+        $params['sign'] = $this->sign(['Account' => $params['Account']]);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST');
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp))
+            {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['Code'] == 0)
+            {
+                return [true, $resp['Balance']];
+            }
+            else
+            {
+                return [false, $resp['Message']];
+            }
+        }
+    }
+
     private function sign($params)
     {
         $content = '';

+ 1 - 0
helper/refill/api/xyz/kangkai/config.php

@@ -10,6 +10,7 @@ class config
     const ORDER_URL = 'http://8.142.133.14:8080/telapi.aspx?v=H1.1&action=charge';
     const QUERY_URL = 'http://8.142.133.14:8080/telapi.aspx?v=H1.1&action=queryReport';
     const GET_PACKAGE_URL = 'http://8.142.133.14:8080/telapi.aspx?v=H1.1&action=getPackage';
+    const BALANCE_URL = 'http://8.142.133.14:8080/telapi.aspx?v=H1.1&action=getBalance';
 
     const Account = '18500608333';
     const ApiKey = '0fa1c183841942659d77747987230da3';

+ 27 - 0
helper/refill/api/xyz/lechong/RefillPhone.php

@@ -103,6 +103,33 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['agentcode'] = config::AgentCode;
+        $params['time'] = date("YmdHis");
+        $key = config::KEY;
+        $body = "{$params['agentcode']}{$params['time']}{$key}";
+        $params['sign'] = md5($body);
+
+        $resp = http_request(config::BALANCE_URL, $params, 'POST', false, config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['recode'] == 'b100') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
     private function sign($params)
     {
         $agentcode = config::AgentCode;

+ 1 - 0
helper/refill/api/xyz/lechong/config.php

@@ -9,6 +9,7 @@ class config
     //957
     const ORDER_URL = 'http://121.196.177.34:1012/api/md5/submitorder';
     const QUERY_URL= 'http://121.196.177.34:1012/api/md5/queryorder';
+    const BALANCE_URL= 'http://121.196.177.34:1012/api/md5/getbalance';
 
     const AgentCode= '202108021753';
     const KEY = '5BCE4762BC53B3EECB113A0285BF64DC';

+ 26 - 0
helper/refill/api/xyz/lingzhman/RefillPhone.php

@@ -106,6 +106,32 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['timestamp'] = date("YmdHis");
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } else {
+                if ($resp['status'] === 'success') {
+                    return [true, $resp['balance']];
+                } else {
+                    return [false, $resp['descriptor']];
+                }
+            }
+        }
+    }
+
     private function sign($params)
     {
         $data['account'] = $params['account'];

+ 1 - 0
helper/refill/api/xyz/lingzhman/config.php

@@ -8,6 +8,7 @@ class config
 {
     const ORDER_URL = 'http://47.99.65.204/flow-receiver/fee/recharge';
     const QUERY_URL = 'http://47.99.65.204/flow-receiver/fee/query/single';
+    const BALANCE_URL = 'http://47.99.65.204/flow-receiver/fee/balance/query';
     const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_lingzhman.php';
     const ACCOUNT = 'yzmc';
     const KEY = 'b225132ca8fc47d98c245fc231623dbb';

+ 25 - 0
helper/refill/api/xyz/lingzhman48/RefillPhone.php

@@ -106,6 +106,31 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['account'] = config::ACCOUNT;
+        $params['timestamp'] = date("YmdHis");
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params);
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } else {
+                if ($resp['status'] === 'success') {
+                    return [true, $resp['balance']];
+                } else {
+                    return [false, $resp['descriptor']];
+                }
+            }
+        }
+    }
     private function sign($params)
     {
         $data['account'] = $params['account'];

+ 1 - 0
helper/refill/api/xyz/lingzhman48/config.php

@@ -9,6 +9,7 @@ class config
     //895
     const ORDER_URL = 'http://47.99.65.204/flow-receiver/fee/recharge';
     const QUERY_URL = 'http://47.99.65.204/flow-receiver/fee/query/single';
+    const BALANCE_URL = 'http://47.99.65.204/flow-receiver/fee/balance/query';
     const NOTIFY_URL = BASE_SITE_URL . '/mobile/callback/refill_lingzhman48.php'; //需联系上游配置
     const ACCOUNT = 'yz1988';
     const KEY = '30ba2a10cdb9464fac671c3e4c0cfb97';

+ 29 - 0
helper/refill/api/xyz/moxj_fs/RefillPhone.php

@@ -97,6 +97,35 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['partner_id'] = config::PARTNER_ID;
+        $content = $params['partner_id'] . config::KEY;
+        $params['sign'] = md5($content);
+
+        $resp = http_request(config::BALANCE_URL, $params , 'POST' , false , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 1)
+            {
+                return [true, $resp['data']['balance']];
+            }
+            else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
     private function sign($params)
     {
         $key = config::KEY;

+ 1 - 0
helper/refill/api/xyz/moxj_fs/config.php

@@ -9,6 +9,7 @@ class config
 {
     const ORDER_URL = 'http://45.200.141.165/api/receiveOrder';
     const QUERY_URL = 'http://45.200.141.165/api/queryOrder';
+    const BALANCE_URL = 'http://45.200.141.165/api/quotaQuery';
 
     const PARTNER_ID = '32';
     const KEY = 'a78818d925529026a129c95bf2aa0318';

+ 29 - 1
helper/refill/api/xyz/moxj_new/RefillPhone.php

@@ -93,7 +93,35 @@ class RefillPhone extends refill\IRefillPhone
                 return [true, ORDER_STATE_NOEXIST];
             }
             else {
-                return [false, $resp['message']];
+                return [false, $resp['msg']];
+            }
+
+        }
+    }
+
+    public function balance()
+    {
+        $params['partner_no'] = config::MCH_ID;
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::BALANCE_URL, $params);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 3100)
+            {
+                return [true, $resp['balance']];
+            }
+            else {
+                return [false, $resp['msg']];
             }
 
         }

+ 1 - 0
helper/refill/api/xyz/moxj_new/config.php

@@ -6,6 +6,7 @@ class config
 {
     const ORDER_URL = 'http://118.31.228.170/pushQuickOrder';
     const QUERY_URL = 'http://118.31.228.170/pushOrderQuery';
+    const BALANCE_URL = 'http://118.31.228.170/balance';
 
     const MCH_ID = '300459017';
     const KEY = 'pWQxKXdOiKOMmZhsCOgiygmleBmHBpZx';

+ 29 - 0
helper/refill/api/xyz/moxj_yd/RefillPhone.php

@@ -97,6 +97,35 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
+    public function balance()
+    {
+        $params['merchant_id'] = config::MCH_ID;
+        $params['sign'] = $this->sign($params);
+        $params = json_encode($params);
+
+        $resp = http_post_data(config::BALANCE_URL, $params , config::ExtHeaders);
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            }
+            elseif ($resp['code'] == 0)
+            {
+                return [true, $resp['data']['balance']];
+            }
+            else {
+                return [false, $resp['message']];
+            }
+
+        }
+    }
+
     private function sign($params)
     {
         ksort($params);

+ 1 - 0
helper/refill/api/xyz/moxj_yd/config.php

@@ -5,6 +5,7 @@ class config
 {
     const ORDER_URL = 'http://47.107.49.200/api/recharge/order/add';
     const QUERY_URL = 'http://47.107.49.200/api/recharge/order/find';
+    const BALANCE_URL = 'http://47.107.49.200/api/recharge/balance/get';
 
     const MCH_ID = '76505818';
     const KEY = 'e10f918a7a6649ba985f6460b09d1015';

+ 30 - 22
test/TestRefill.php

@@ -277,7 +277,8 @@ class TestRefill extends TestCase
     public function testFeinimoshu_hf()
     {
         $providers = new refill\feinimoshu_hf\RefillPhone([]);
-        $resp = $providers->query(['order_sn' => '3708210680873565742704']);
+//        $resp = $providers->query(['order_sn' => '3708210680873565742704']);
+        $resp = $providers->balance();
     }
 
     public function testFeiniaoPhone()
@@ -381,10 +382,11 @@ class TestRefill extends TestCase
     {
         $providers = new refill\moxj_fs\RefillPhone([]);
 //        $resp = $providers->add(15139608757, 4, 100, ['order_sn' => $this->make_sn()]);
-        $resp = $providers->query(['order_sn' => '42741624242693157165']);
-        $data = '{"amount":"100","charge_type":"2","code":"1","partner_id":"58","phone":"15139608757","sign":"30d193dba4101e50851ed0efabb75fb1","partner_order_no":"42741624242693157165","official_order_id":"20210621103211948830"}';
-        $params = json_decode($data , true);
+//        $resp = $providers->query(['order_sn' => '42741624242693157165']);
+//        $data = '{"amount":"100","charge_type":"2","code":"1","partner_id":"58","phone":"15139608757","sign":"30d193dba4101e50851ed0efabb75fb1","partner_order_no":"42741624242693157165","official_order_id":"20210621103211948830"}';
+//        $params = json_decode($data , true);
 //        refill\RefillFactory::instance()->notify('moxj_fs',$params);
+        $resp = $providers->balance();
     }
 
     public function testZanzanquickPhone()
@@ -410,11 +412,12 @@ class TestRefill extends TestCase
     public function testMoxj_ydPhone()
     {
         $providers = new refill\moxj_yd\RefillPhone([]);
-        $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '52101624413125875436']);
-        $data = '{"customer_order_no":"47651624412877257722","status":1,"merchant_id":"76505818","sign":"c185a0f2152b3ac3ee3f29009dec5a6b"}';
-        $params = json_decode($data , true);
+//        $data = '{"customer_order_no":"47651624412877257722","status":1,"merchant_id":"76505818","sign":"c185a0f2152b3ac3ee3f29009dec5a6b"}';
+//        $params = json_decode($data , true);
 //        refill\RefillFactory::instance()->notify('moxj_yd',$params);
+        $resp = $providers->balance();
     }
 
     public function testXingzyPhone()
@@ -461,10 +464,11 @@ class TestRefill extends TestCase
     {
         $providers = new refill\lingzhman\RefillPhone([]);
 //        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
-        $resp = $providers->query(['order_sn' => '29771625215707976538']);
-        $data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
-        $params = json_decode($data, true);
+//        $resp = $providers->query(['order_sn' => '29771625215707976538']);
+//        $data = '{"orderNo":"F2107021536431562574","status":"019","consumerNo":"60191625211393862930","voucherNo":null,"mobile":"18500608333"}';
+//        $params = json_decode($data, true);
 //        refill\RefillFactory::instance()->notify('lingzhman',$params);
+        $resp = $providers->balance();
     }
 
     public function testQijutangPhone()
@@ -495,9 +499,10 @@ class TestRefill extends TestCase
         $providers = new refill\cangbu\RefillPhone([]);
 //        $resp = $providers->add(18500608333, 5, 100, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '35041626071052333060']);
-        $data = '{"customerId":"112","tmporder":"35041626071052333060","orderno":"s16260710607417944801112","number":"18500608333","money":"100","amount":"94.9000","code":"1","cardno":"","voucher":"110103307042107121424210550266","sign":"de463c3d389a4afe4a2c58257972121a"}';
-        $params = json_decode($data, true);
-        refill\RefillFactory::instance()->notify('cangbu',$params);
+//        $data = '{"customerId":"112","tmporder":"35041626071052333060","orderno":"s16260710607417944801112","number":"18500608333","money":"100","amount":"94.9000","code":"1","cardno":"","voucher":"110103307042107121424210550266","sign":"de463c3d389a4afe4a2c58257972121a"}';
+//        $params = json_decode($data, true);
+//        refill\RefillFactory::instance()->notify('cangbu',$params);
+        $resp = $providers->query_balance();
     }
 
     public function testCangbukami()
@@ -544,9 +549,10 @@ class TestRefill extends TestCase
         $providers = new refill\moxj_new\RefillPhone([]);
 //        $resp = $providers->add(18500608333, 5, 30, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '33301627887529587739', 'card_no' => 13699279618]);
-        $body = '{"code":"2101","official_order_no":"0","partner_no":"300459017","partner_order_no":"33301627887529587739","phone":"18500608333","amount":"30","isp":"cucc","charge_time":"0","sign":"A512D612C823DFBCA9B4BC42134CC164"}';
-        $params = json_decode($body, true);
-        refill\RefillFactory::instance()->notify('moxj_new', $params);
+//        $body = '{"code":"2101","official_order_no":"0","partner_no":"300459017","partner_order_no":"33301627887529587739","phone":"18500608333","amount":"30","isp":"cucc","charge_time":"0","sign":"A512D612C823DFBCA9B4BC42134CC164"}';
+//        $params = json_decode($body, true);
+//        refill\RefillFactory::instance()->notify('moxj_new', $params);
+        $resp = $providers->balance();
     }
 
     public function testKangkai()
@@ -554,9 +560,10 @@ class TestRefill extends TestCase
         $providers = new refill\kangkai\RefillPhone([]);
 //        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '25431627898461762024']);
-        $body = '{"TaskID":"267459","Mobile":"18500608333","Status":"5","ReportTime":"2021-08-02T18:02:01.777","ReportCode":"7:","OutTradeNo":"25431627898461762024","Price":"44.2500","ReceiptNum":"","Sign":"f0934a621fd0b076373f77a9bf8d7051"}';
-        $params = json_decode($body, true);
-        refill\RefillFactory::instance()->notify('kangkai', $params);
+//        $body = '{"TaskID":"267459","Mobile":"18500608333","Status":"5","ReportTime":"2021-08-02T18:02:01.777","ReportCode":"7:","OutTradeNo":"25431627898461762024","Price":"44.2500","ReceiptNum":"","Sign":"f0934a621fd0b076373f77a9bf8d7051"}';
+//        $params = json_decode($body, true);
+//        refill\RefillFactory::instance()->notify('kangkai', $params);
+        $resp = $providers->balance();
     }
 
     public function testLechong()
@@ -564,9 +571,10 @@ class TestRefill extends TestCase
         $providers = new refill\lechong\RefillPhone([]);
 //        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
 //        $resp = $providers->query(['order_sn' => '55641627902450221838']);
-        $body = '{"sellerid":"55641627902450221838","agentcode":"202108021753","account":"MTg1MDA2MDgzMzM=","value":"50","payvalue":"47.8500","voucher":"","createtime":"20210802190739","endtime":"20210802191008","state":"4","remark":"","time":"20210802191008","sign":"0e2d69318d03871d887debd498cc50f2"}';
-        $params = json_decode($body, true);
-        refill\RefillFactory::instance()->notify('lechong', $params);
+//        $body = '{"sellerid":"55641627902450221838","agentcode":"202108021753","account":"MTg1MDA2MDgzMzM=","value":"50","payvalue":"47.8500","voucher":"","createtime":"20210802190739","endtime":"20210802191008","state":"4","remark":"","time":"20210802191008","sign":"0e2d69318d03871d887debd498cc50f2"}';
+//        $params = json_decode($body, true);
+//        refill\RefillFactory::instance()->notify('lechong', $params);
+        $resp = $providers->balance();
     }
 
     public function testAmingjd()