Selaa lähdekoodia

椰子:壹仟带票&尊泥快充

lowkeyman 1 vuosi sitten
vanhempi
commit
1c53921d89

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

@@ -10610,6 +10610,124 @@ $yeyepucnt_phone = ['name' => 'yeyepucnt', 'store_id' => 396, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$zunni_phone = ['name' => 'zunni', 'store_id' => 397, 'qualitys' => '2',
+    'amount' => [
+        1 => [
+            ['goods_id' => 9121, 'price' => 1.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        2 => [
+            ['goods_id' => 9122, 'price' => 2.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        3 => [
+            ['goods_id' => 9123, 'price' => 3.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        4 => [
+            ['goods_id' => 9124, 'price' => 4.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        5 => [
+            ['goods_id' => 9125, 'price' => 5.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        6 => [
+            ['goods_id' => 9126, 'price' => 6.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        7 => [
+            ['goods_id' => 9127, 'price' => 7.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        8 => [
+            ['goods_id' => 9128, 'price' => 8.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        9 => [
+            ['goods_id' => 9129, 'price' => 9.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        10 => [
+            ['goods_id' => 9113, 'price' => 10.35, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9113, 'price' => 10.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        11 => [
+            ['goods_id' => 9130, 'price' => 11.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        12 => [
+            ['goods_id' => 9131, 'price' => 12.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        13 => [
+            ['goods_id' => 9132, 'price' => 13.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        14 => [
+            ['goods_id' => 9133, 'price' => 14.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        15 => [
+            ['goods_id' => 9134, 'price' => 15.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        16 => [
+            ['goods_id' => 9135, 'price' => 16.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        17 => [
+            ['goods_id' => 9136, 'price' => 17.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        18 => [
+            ['goods_id' => 9137, 'price' => 18.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        19 => [
+            ['goods_id' => 9138, 'price' => 19.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        20 => [
+            ['goods_id' => 9114, 'price' => 20.7, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9114, 'price' => 20.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        21 => [
+            ['goods_id' => 9139, 'price' => 21.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        22 => [
+            ['goods_id' => 9140, 'price' => 22.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        23 => [
+            ['goods_id' => 9141, 'price' => 23.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        24 => [
+            ['goods_id' => 9142, 'price' => 24.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        25 => [
+            ['goods_id' => 9143, 'price' => 25.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        26 => [
+            ['goods_id' => 9144, 'price' => 26.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        27 => [
+            ['goods_id' => 9145, 'price' => 27.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        28 => [
+            ['goods_id' => 9146, 'price' => 28.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        29 => [
+            ['goods_id' => 9147, 'price' => 29.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+        30 => [
+            ['goods_id' => 9115, 'price' => 31.05, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9115, 'price' => 30.1, 'quality' => 2, 'card_type' => 'chinaunicom'],
+        ],
+//        50 => [
+//            ['goods_id' => 9116, 'price' => 50, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9116, 'price' => 50, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        100 => [
+//            ['goods_id' => 9117, 'price' => 100, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9117, 'price' => 100, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        200 => [
+//            ['goods_id' => 9118, 'price' => 207.4, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9118, 'price' => 206, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        300 => [
+//            ['goods_id' => 9119, 'price' => 300, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9119, 'price' => 300, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        500 => [
+//            ['goods_id' => 9120, 'price' => 500, 'quality' => 2, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9120, 'price' => 500, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_p hone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -10915,7 +11033,7 @@ $phone_providers = [
     ['name' => 'beirui_sec', 'cfg' => $beirui_sec_phone],
 //    ['name' => 'beirui_trd', 'cfg' => $beirui_trd_phone],
     ['name' => 'weisanhuo', 'cfg' => $weisanhuo_phone],
-//    ['name' => 'yiqian_tax', 'cfg' => $yiqian_tax_phone],
+    ['name' => 'yiqian_tax', 'cfg' => $yiqian_tax_phone],
     ['name' => 'miaoxt_fs_three', 'cfg' => $miaoxt_fs_three_phone],
     ['name' => 'yuntian_trd', 'cfg' => $yuntian_trd_phone],
     ['name' => 'yeyekami_fast', 'cfg' => $yeyekami_fast_phone],
@@ -10927,6 +11045,7 @@ $phone_providers = [
     ['name' => 'xingchuang_trd', 'cfg' => $xingchuang_trd_phone],
     ['name' => 'menshang_sec', 'cfg' => $menshang_sec_phone],
     ['name' => 'yeyepucnt', 'cfg' => $yeyepucnt_phone],
+    ['name' => 'zunni', 'cfg' => $zunni_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 3 - 3
helper/refill/api/xyz/yiqian_tax/API.MD

@@ -1,12 +1,12 @@
 
 ## 壹仟含税
-> copy from dashang
 - 用户编号(userId): 261
-- 密钥(privateKey):c739d5f68333deaeb6ae04d30e60e836896587968219656fcf66c1708c76f9d7
+- 密钥(privateKey):c739d5f68333deaeb6ae04d30e60e83689658796821965
+- 6fcf66c1708c76f9d7
 
 - 登录名: youlaiyouwang
 - 登录密码:sup123456
-- 后台地址:47.94.208.3:616
+- 后台地址:47.94.208.3:6165
 
 - 接口文档地址: https://shimo.im/docs/5bqnr2OZw9SDz4qy/read
 - 查询地址:http://47.94.208.3:6160/unicomAync/buy.do

+ 1 - 1
helper/refill/api/xyz/yiqian_tax/RefillCallBack.php

@@ -21,7 +21,7 @@ class RefillCallBack implements refill\IRefillCallBack
     {
         $userid = config::USER_ID;
         $key = config::KEY;
-        $content = "{$params['bizId']}{$params['downstreamSerialno']}{$params['ejId']}{$params['status']}{$userid}{$key}";
+        $content = "{$params['bizId']}{$params['downstreamSerialno']}{$params['ejId']}{$params['status']}$userid$key";
         return md5($content);
     }
 

+ 4 - 5
helper/refill/api/xyz/yiqian_tax/RefillPhone.php

@@ -19,7 +19,7 @@ class RefillPhone extends refill\IRefillPhone
     {
         $params['userId'] = config::USER_ID;
         $params['itemId'] = config::Products[$card_type][$amount];
-        $params['checkItemFacePrice'] = $amount * 1000;
+        $params['itemPrice'] = $amount * 1000;
         $params['amt'] = 1;
         $params['uid'] = $phone;
         $params['serialno'] = $order_sn;
@@ -68,7 +68,7 @@ class RefillPhone extends refill\IRefillPhone
         $params['userId'] = config::USER_ID;
         $params['serialno'] = $refill_info['order_sn'];
         $key = config::KEY;
-        $content = "{$params['serialno']}{$params['userId']}{$key}";
+        $content = "{$params['serialno']}{$params['userId']}$key";
         $params['sign'] = md5($content);
 
         $resp = http_request(config::QUERY_URL, $params);
@@ -124,7 +124,7 @@ class RefillPhone extends refill\IRefillPhone
     {
         $params['userId'] = config::USER_ID;
         $key = config::KEY;
-        $body = "{$params['userId']}{$key}";
+        $body = "{$params['userId']}$key";
         $params['sign'] = md5($body);
 
         $resp = http_request(config::BALANCE_URL, $params);
@@ -150,8 +150,7 @@ class RefillPhone extends refill\IRefillPhone
     {
         $userid = config::USER_ID;
         $key = config::KEY;
-        $content = "{$params['amt']}{$params['checkItemFacePrice']}{$params['dtCreate']}{$params['itemId']}{$params['itemPrice']}{$params['serialno']}";
-        $content .= "{$params['uid']}{$userid}{$key}";
+        $content = "{$params['dtCreate']}{$params['itemId']}{$params['serialno']}{$params['uid']}$userid$key";
         return md5($content);
     }
 }

BIN
helper/refill/api/xyz/yiqian_tax/含税下游对接供货接口文档-话费【返回卡号或凭证】(2).docx


+ 59 - 0
helper/refill/api/xyz/zunni/API.MD

@@ -0,0 +1,59 @@
+
+## 尊泥-快充
+
+### 账号:
+- 登陆账号:guoyan
+- 登陆密码:123321
+- ID:10002864
+- 秘钥:enWANzzDnS7ZdzzYzER88bzHYitYXRhY
+### 下游客户注册和登录地址:
+> http://123.60.37.241:7080/
+- api接口文档地址:
+ - https://www.showdoc.com.cn/AQL666666/
+- 话费下单地址:
+ - http://123.60.37.241:9086/onlinepay.do
+- 订单主动查询地址:
+ - http://123.60.37.241:9086/searchpay.do
+- 余额查询:
+- http://123.60.37.241:9086/searchbalance.do
+## 店铺
+- 账号:zunni
+- 密码:zunni67890
+
+### 编码
+- 全国移动
+  101685	全国移动话费10元直充
+  101686	全国移动话费20元直充
+  101687	全国移动话费30元直充
+
+- 全国联通
+  101704	全国联通话费20元直充
+  101705	全国联通话费30元直充
+  1017031	全国联通话费11元直充
+  1017032	全国联通话费12元直充
+  1017033	全国联通话费13元直充
+  1017034	全国联通话费14元直充
+  1017035	全国联通话费15元直充
+  1017036	全国联通话费16元直充
+  1017037	全国联通话费17元直充
+  1017038	全国联通话费18元直充
+  1017039	全国联通话费19元直充
+  1017041	全国联通话费21元直充
+  1017042	全国联通话费22元直充
+  1017043	全国联通话费23元直充
+  1017044	全国联通话费24元直充
+  1017045	全国联通话费25元直充
+  1017046	全国联通话费26元直充
+  1017047	全国联通话费27元直充
+  1017048	全国联通话费28元直充
+  1017049	全国联通话费29元直充
+  101697	全国联通话费4元直充
+  101698	全国联通话费5元直充
+  101699	全国联通话费6元直充
+  101700	全国联通话费7元直充
+  101701	全国联通话费8元直充
+  101702	全国联通话费9元直充
+  101703	全国联通话费10元直充
+  101694	全国联通话费1元直充
+  101695	全国联通话费2元直充
+  101696	全国联通话费3元直充

+ 49 - 0
helper/refill/api/xyz/zunni/RefillCallBack.php

@@ -0,0 +1,49 @@
+<?php
+namespace refill\zunni;
+
+require_once(BASE_HELPER_RAPI_PATH . '/zunni/config.php');
+
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = $this->sign($params);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&orderid={$params['orderid']}&sporderid={$params['sporderid']}&merchantsubmittime={$params['merchantsubmittime']}";
+        $content .= "&resultno={$params['resultno']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function notify($params): array
+    {
+        $status = intval($params['resultno']);
+        $order_sn = $params['sporderid'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status === 1) {
+            $official_sn = strtolower($params['remark1']) == 'null' ? '' : $params['remark1'];
+            $data['official_sn'] = $official_sn;
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status === 9) {
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 163 - 0
helper/refill/api/xyz/zunni/RefillPhone.php

@@ -0,0 +1,163 @@
+<?php
+
+namespace refill\zunni;
+
+require_once(BASE_HELPER_RAPI_PATH . '/zunni/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, $card_type, string $order_sn): array
+    {
+        $params['userid'] = config::USER_ID;
+        $productid = config::ProductIdS[$card_type][$amount] ?? false;
+        if ($productid === false){
+            return [];
+        }
+
+        $params['productid'] = $productid;
+        $params['price'] = $amount;
+        $params['num'] = 1;
+        $params['mobile'] = $phone;
+        $params['spordertime'] = date("YmdHis");
+        $params['sporderid'] = $order_sn;
+        $params['back_url'] = config::NOTIFY_URL;
+        $params['paytype'] = config::operator[$card_type];
+
+        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);
+        if (empty($params)) {
+            return [false, '产品编码有误', false];
+        }
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $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 = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            }
+
+            $resultno = $resp['resultno'];
+            if (in_array($resultno, ['0', '2'], true)) {
+                return [true, $resp['orderid'], false];
+            } elseif (in_array($resultno, config::ERR_NOS, true)) {
+                return [false, $resultno, false];
+            } elseif ($resultno === '9999' || $resultno === '5006') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, true];
+            } else {
+                //未知结果码
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resultno, true];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&sporderid={$params['sporderid']}&key={$key}";
+        $params['sign'] = strtoupper(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 = $this->xmlToArray($resp);
+            if (empty($resp))
+            {
+                return [false, '网络错误', ''];
+            }
+            else
+            {
+                $official_sn = !empty($resp['remark1']) ? $resp['remark1'] : '';
+
+                $resultno = $resp['resultno'];
+                if ($resultno === '1') {
+                    $updata['official_sn'] = $official_sn;
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($resultno === '9') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($resultno === '5007' && (time() - $refill_info['commit_time'] > 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    $order_state = ORDER_STATE_SEND;
+                }
+
+                return [true, $order_state, $official_sn];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = strtoupper(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 = $this->xmlToArray($resp);
+            if (empty($resp)) {
+                return [false, '网络错误'];
+            } elseif ($resp['resultno'] === '1') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['resultno']];
+            }
+        }
+    }
+
+    private function sign($params): string
+    {
+        $userid = config::USER_ID;
+        $key = config::KEY;
+        $content = "userid={$userid}&productid={$params['productid']}&price={$params['price']}&num={$params['num']}&mobile={$params['mobile']}&spordertime={$params['spordertime']}";
+        $content .= "&sporderid={$params['sporderid']}&key={$key}";
+        return strtoupper(md5($content));
+    }
+
+    public function xmlToArray($xml)
+    {
+        $replace_str = str_replace(' ','','encoding="gb2312"');
+        $xml = mb_convert_encoding($xml,"UTF-8","gb2312");
+        $xml = str_replace($replace_str, "encoding='utf-8'", $xml);
+        return refill\util::xmlToArray($xml);
+    }
+}

+ 72 - 0
helper/refill/api/xyz/zunni/config.php

@@ -0,0 +1,72 @@
+<?php
+
+
+namespace refill\zunni;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.60.37.241:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.60.37.241:9086/searchpay.do';
+    const BALANCE_URL = 'http://123.60.37.241:9086/searchbalance.do';
+
+    const USER_ID= '10002864';
+    const KEY = 'enWANzzDnS7ZdzzYzER88bzHYitYXRhY';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_zunni.php";
+
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ERR_NOS = [
+        '5001', '5002', '5003', '5004', '5005', '5008', '5009', '5010', '5011', '5012', '7001'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                10 => '101685',
+                20 => '101686',
+                30 => '101687',
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                1 => '101694',
+                2 => '101695',
+                3 => '101696',
+                4 => '101697',
+                5 => '101698',
+                6 => '101699',
+                7 => '101700',
+                8 => '101701',
+                9 => '101702',
+                10 => '101703',
+                11 => '1017031',
+                12 => '1017032',
+                13 => '1017033',
+                14 => '1017034',
+                15 => '1017035',
+                16 => '1017036',
+                17 => '1017037',
+                18 => '1017038',
+                19 => '1017039',
+                20 => '101704',
+                21 => '1017041',
+                22 => '1017042',
+                23 => '1017043',
+                24 => '1017044',
+                25 => '1017045',
+                26 => '1017046',
+                27 => '1017047',
+                28 => '1017048',
+                29 => '1017049',
+                30 => '101705',
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+
+            ]
+    ];
+}

+ 4 - 0
mobile/callback/refill_zunni.php

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

+ 6 - 2
test/TestRefill.php

@@ -5822,8 +5822,6 @@ class TestRefill extends TestCase
     {
         $provider = $this->getProvider('yiqian_tax');
         $resp = $provider->balance();
-        $resp = $provider->add(13699279618, 4, 100, ['order_sn' => $this->make_sn()]);
-        $resp = $provider->query(['order_sn' => '56641701227303096134']);
     }
 
     public function testmiaoxt_fs_three()
@@ -5988,6 +5986,12 @@ class TestRefill extends TestCase
         $resp = $provider->balance();
     }
 
+    public function testzunni()
+    {
+        $provider = $this->getProvider('zunni');
+        $resp = $provider->balance();
+    }
+
 }