Explorar o código

椰林,秒信通带票2号(miaoxt_tax_sec)

zhaoming hai 1 ano
pai
achega
84daf19e6b

+ 34 - 34
data/config/xyz/refill.ini.php

@@ -9933,46 +9933,46 @@ $liantuo_high_phone = ['name' => 'liantuo_high', 'store_id' => 379, 'qualitys' =
 
 $miaoxt_tax_trd_phone = ['name' => 'miaoxt_tax_trd', 'store_id' => 380, 'qualitys' => '2',
     'amount' => [
-        10 => [
-            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
-        ],
-        20 => [
-            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
-        ],
-        30 => [
-            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
-        ],
+//        10 => [
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8977, 'price' => 10, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8978, 'price' => 20, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8979, 'price' => 30, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
         50 => [
-            ['goods_id' => 8980, 'price' => 50, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8980, 'price' => 50, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8980, 'price' => 50, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8980, 'price' => 52.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8980, 'price' => 51.65, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8980, 'price' => 52.1, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 8981, 'price' => 100, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8981, 'price' => 100, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8981, 'price' => 100, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8981, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 8982, 'price' => 200, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8982, 'price' => 200, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8982, 'price' => 200, 'quality' => 2, 'card_type' => 'chinatelecom']
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8982, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinatelecom']
         ],
-        300 => [
-            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
-        ],
-        500 => [
-            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
-            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
-        ]
+//        300 => [
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8983, 'price' => 300, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8984, 'price' => 500, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 

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

@@ -7793,6 +7793,51 @@ $liantuo_fs_phone = ['name' => 'liantuo_fs', 'store_id' => 303, 'qualitys' => '1
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$miaoxt_tax_sec_phone = ['name' => 'miaoxt_tax_sec', 'store_id' => 304, 'qualitys' => '2',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8435, 'price' => 10.025, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8435, 'price' => 10.05, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8435, 'price' => 10.17, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8436, 'price' => 20.05, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8436, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8436, 'price' => 20.34, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 8437, 'price' => 30.105, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8437, 'price' => 30.03, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8437, 'price' => 30.51, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+        50 => [
+            ['goods_id' => 8438, 'price' => 52.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8438, 'price' => 51.65, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8438, 'price' => 52.1, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8439, 'price' => 103.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8440, 'price' => 206.6, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8441, 'price' => 300.75, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8441, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8441, 'price' => 300.3, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8442, 'price' => 501.25, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8442, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8442, 'price' => 500.5, 'quality' => 2, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -8043,6 +8088,7 @@ $phone_providers = [
     ['name' => 'beirui_fs', 'cfg' => $beirui_fs_phone],
     ['name' => 'liantuo_nation', 'cfg' => $liantuo_nation_phone],
     ['name' => 'liantuo_fs', 'cfg' => $liantuo_fs_phone],
+    ['name' => 'miaoxt_tax_sec', 'cfg' => $miaoxt_tax_sec_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

+ 22 - 0
helper/refill/api/yl/miaoxt_tax_sec/API.MD

@@ -0,0 +1,22 @@
+
+## 秒信通带票2号
+
+### 账号信息
+- 后台登录地址:http://47.118.46.242:10186/plat/index
+- 登录名:23111302
+- 初始密码:yl123456
+
+### 接口信息
+- ID:200137
+- 密钥:918a37966def4aaf833fec0bfce511bd
+## 接口地址
+- 话费下单地址:http://47.118.46.242:10186/plat/api/old/submitorder
+- 查询地址:http://47.118.46.242:10186/plat/api/old/queryorder
+- 查询余额地址:http://47.118.46.242:10186/plat/api/old/queryBalance
+
+## API 文档
+> https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+## 店铺账号
+- 账号:miaoxt_tax_sec
+- 密码:miaoxt_tax_sec67890

+ 52 - 0
helper/refill/api/yl/miaoxt_tax_sec/RefillCallBack.php

@@ -0,0 +1,52 @@
+<?php
+namespace refill\miaoxt_tax_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/miaoxt_tax_sec/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['szVerifyString'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nDemo={$params['nDemo']}&fSalePrice={$params['fSalePrice']}";
+        $content .= "&nFlag={$params['nFlag']}&szKey={$key}";
+        return md5($content);
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['nFlag']);
+        $order_sn = $params['szOrderId'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+
+        $order_id = $order_info['order_id'];
+        $official_sn = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+
+        if ($status === 2) {
+            $data['official_sn'] = $official_sn;
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true, $official_sn];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true, true, ''];
+        }
+        else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 141 - 0
helper/refill/api/yl/miaoxt_tax_sec/RefillPhone.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace refill\miaoxt_tax_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/miaoxt_tax_sec/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $order_sn;
+        $params['szPhoneNum'] = $phone;
+        $params['nMoney'] = $amount;
+        $params['nSortType'] = config::operator[$card_type];
+        $params['nProductClass'] = 1;
+        $params['nProductType'] = 1;
+        $params['szTimeStamp'] = date("Y-m-d H:i:s");
+        $params['szNotifyUrl'] = config::NOTIFY_URL;
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $sign;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $resp = http_request(config::ORDER_URL, $params, 'POST', false, config::ExtHeaders, $net_errno);
+
+        if (empty($resp)) {
+            return [false, '网络错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            $nRtn = intval($resp['nRtn']);
+
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn == 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS)) {
+                if($nRtn === 2003) {
+                    refill\util::set_black($card_no);
+                }
+                return [false, $resp['szRtnCode'], false];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $params['szOrderId'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szOrderId={$params['szOrderId']}&szKey={$key}";
+        $params['szVerifyString'] = md5($content);
+
+        $resp = http_request(config::QUERY_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, '网络错误', ''];
+            }
+            $official_sn = $resp['szRtnMsg'] ?? '';
+
+            $status = intval($resp['nRtn']);
+            if ($status === 5012) {
+                $updata['official_sn'] = $official_sn;
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif ($status === 5011) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $status, ''];
+            }
+            return [true, $order_state, $official_sn];
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['szAgentId'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$params['szAgentId']}&szKey={$key}";
+        $params['szVerifyString'] = 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['nRtn'] == 0) {
+                return [true, $resp['fBalance']];
+            } else {
+                return [false, $resp['szRtnCode']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "szAgentId={$userid}&szOrderId={$params['szOrderId']}&szPhoneNum={$params['szPhoneNum']}&nMoney={$params['nMoney']}&nSortType={$params['nSortType']}";
+        $content .= "&nProductClass={$params['nProductClass']}&nProductType={$params['nProductType']}&szTimeStamp={$params['szTimeStamp']}&szKey={$key}";
+        return md5($content);
+    }
+}

+ 27 - 0
helper/refill/api/yl/miaoxt_tax_sec/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\miaoxt_tax_sec;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.118.46.242:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.118.46.242:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.118.46.242:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200137';
+    const KEY = '918a37966def4aaf833fec0bfce511bd';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_miaoxt_tax_sec.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 1,
+        mtopcard\ChinaUnicomCard  => 2,
+        mtopcard\ChinaTelecomCard => 3
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+
+    const ERR_NOS = [
+        1000,1001,1003,1004,2001,2002,2003,2020,2021,1006,2030,3003
+    ];
+}

+ 4 - 0
mobile/callback/refill_miaoxt_tax_sec.php

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

+ 7 - 0
test/TestRefill.php

@@ -5782,6 +5782,13 @@ class TestRefill extends TestCase
         $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
     }
 
+    public function testmiaoxt_tax_sec()
+    {
+        $provider = $this->getProvider('miaoxt_tax_sec');
+        $resp = $provider->balance();
+//        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+    }
+
 }