xiaoyu 2 éve
szülő
commit
5c614db047

+ 73 - 27
data/config/xyz/refill.ini.php

@@ -5095,33 +5095,33 @@ $ruixundaman_phone = ['name' => 'ruixundaman', 'store_id' => 201, 'qualitys' =>
 
 $ruizhi_tax_phone = ['name' => 'ruizhi_tax', 'store_id' => 202, 'qualitys' => '2',
     'amount' => [
-        1  => [
-            ['goods_id' => 8047, 'price' => 1.085, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        2  => [
-            ['goods_id' => 8048, 'price' => 2.17, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        3  => [
-            ['goods_id' => 8049, 'price' => 3.255, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        4  => [
-            ['goods_id' => 8050, 'price' => 4.34, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        5 => [
-            ['goods_id' => 7697, 'price' => 5.425, 'quality' => 2, 'card_type' => 'chinaunicom']
-        ],
-        6  => [
-            ['goods_id' => 8051, 'price' => 6.51, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        7  => [
-            ['goods_id' => 8052, 'price' => 7.595, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        8  => [
-            ['goods_id' => 8053, 'price' => 8.68, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
-        9  => [
-            ['goods_id' => 8054, 'price' => 9.765, 'quality' => 2, 'card_type' => 'chinaunicom'],
-        ],
+//        1  => [
+//            ['goods_id' => 8047, 'price' => 1.085, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        2  => [
+//            ['goods_id' => 8048, 'price' => 2.17, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        3  => [
+//            ['goods_id' => 8049, 'price' => 3.255, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        4  => [
+//            ['goods_id' => 8050, 'price' => 4.34, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        5 => [
+//            ['goods_id' => 7697, 'price' => 5.425, 'quality' => 2, 'card_type' => 'chinaunicom']
+//        ],
+//        6  => [
+//            ['goods_id' => 8051, 'price' => 6.51, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        7  => [
+//            ['goods_id' => 8052, 'price' => 7.595, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        8  => [
+//            ['goods_id' => 8053, 'price' => 8.68, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
+//        9  => [
+//            ['goods_id' => 8054, 'price' => 9.765, 'quality' => 2, 'card_type' => 'chinaunicom'],
+//        ],
         10 => [
             ['goods_id' => 7698, 'price' => 10.98, 'quality' => 2, 'card_type' => 'chinamobile'],
             ['goods_id' => 7698, 'price' => 10.62, 'quality' => 2, 'card_type' => 'chinaunicom'],
@@ -7739,6 +7739,51 @@ $douxun_sec_copy_phone = ['name' => 'douxun_sec_copy', 'store_id' => 285, 'quali
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$ruizhi_tax_copy_phone = ['name' => 'ruizhi_tax_copy', 'store_id' => 286, 'qualitys' => '3',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8373, 'price' => 10.98, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8373, 'price' => 10.62, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8373, 'price' => 11.1, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 8374, 'price' => 21.96, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8374, 'price' => 21.04, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8374, 'price' => 21.5, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 8375, 'price' => 31.25, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8375, 'price' => 31.56, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8375, 'price' => 31.95, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8376, 'price' => 52.15, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8376, 'price' => 52.05, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8376, 'price' => 52.75, 'quality' => 3, 'card_type' => 'chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 8377, 'price' => 104, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8377, 'price' => 103.95, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8377, 'price' => 104.5, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8378, 'price' => 208, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8378, 'price' => 207.9, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8378, 'price' => 208.6, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 8379, 'price' => 312, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8379, 'price' => 311.85, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8379, 'price' => 312.9, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 8380, 'price' => 520, 'quality' => 3, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8380, 'price' => 519.75, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8380, 'price' => 521.5, 'quality' => 3, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -7980,6 +8025,7 @@ $phone_providers = [
     ['name' => 'miaoxt_tax_copy', 'cfg' => $miaoxt_tax_copy_phone],
     ['name' => 'douxun_copy', 'cfg' => $douxun_copy_phone],
     ['name' => 'douxun_sec_copy', 'cfg' => $douxun_sec_copy_phone],
+    ['name' => 'ruizhi_tax_copy', 'cfg' => $ruizhi_tax_copy_phone],
 
 ];
 $config['phone_providers'] = $phone_providers;

+ 55 - 0
helper/refill/api/xyz/ruizhi_tax_copy/RefillCallBack.php

@@ -0,0 +1,55 @@
+<?php
+
+
+namespace refill\ruizhi_tax_copy;
+
+require_once(BASE_HELPER_RAPI_PATH . '/ruizhi_tax_copy/config.php');
+
+
+use refill;
+use Log;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        unset($input['voucher']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+        $str = implode('', $params);
+        $str .= config::KEY;
+        return strtoupper(md5($str));
+    }
+
+    public function notify($params)
+    {
+        $status = $params['state'];
+        $order_sn = $params['user_order'];
+        $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'];
+
+        if ($status === 'success') {
+            $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true];
+        } elseif ($status === 'failed') {
+            return [$order_id, false, true, true];
+        } else {
+            return [$order_id, false, false, false];
+        }
+    }
+}

+ 137 - 0
helper/refill/api/xyz/ruizhi_tax_copy/RefillPhone.php

@@ -0,0 +1,137 @@
+<?php
+
+namespace refill\ruizhi_tax_copy;
+
+require_once(BASE_HELPER_RAPI_PATH . '/ruizhi_tax_copy/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 $card_type, int $amount, string $order_sn)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['create_time'] = date("YmdHis");
+        $params['buy_type'] = 1;
+        $params['account'] = $phone;
+        $params['product_id'] = config::PRODUCT[$card_type][$amount];
+        $params['amount'] = $amount;
+        $params['user_order'] = $order_sn;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $card_type, $amount, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = https_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);
+
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($resp['status'] === '0') {
+                return [true, $resp['order_id'], false];
+            } elseif (in_array($resp['status'], config::ERRCODES, true)) {
+                return [false, $resp['msg'], false];
+            } elseif (in_array($resp['status'], ['110', '113', '-999'], true)) {
+                $net_errno = "HTTP-{$resp['status']}";
+                return [false, $resp['msg'], true];
+            } else {
+                $net_errno = "HTTP-998";
+                return [false, $resp['msg'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['create_time'] = date("YmdHis");
+        $params['user_order'] = $refill_info['order_sn'];
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+        $resp = https_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, '网络错误'];
+            }
+            elseif ($resp['status'] === '0')
+            {
+                $status = $resp['state'];
+                if ($status === 'success') {
+                    $order_state = ORDER_STATE_SUCCESS;
+                    $updata['official_sn'] = $resp['voucher'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                } elseif ($status === 'failed') {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif ($status === 'untreated') {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $status];
+                }
+                return [true, $order_state];
+            }
+            else
+            {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['userid'] = config::USER_ID;
+        $params['create_time'] = date("YmdHis");
+        $params['sign'] = $this->sign($params);
+
+        $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['status'] === '0') {
+                return [true, $resp['balance']];
+            } else {
+                return [false, $resp['msg']];
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        ksort($params);
+        $str = implode('', $params);
+        $str .= config::KEY;
+        return strtoupper(md5($str));
+    }
+}

+ 37 - 0
helper/refill/api/xyz/ruizhi_tax_copy/account.txt

@@ -0,0 +1,37 @@
+客户端入口:http://47.104.129.40:80/
+下单接口:http://47.104.129.40:80/recharge/buy.do
+订单查询:http://47.104.129.40:80/recharge/query.do
+余额查询:http://47.104.129.40:80/user/balance.do
+帐号:BJquwa
+密码:BJquwa
+用户编号:10713
+秘钥:8F3F96FD1A6C
+
+20029	全国移动5元
+20001	全国移动10元
+20002	全国移动20元
+20003	全国移动30元
+20004	全国移动50元
+20005	全国移动100元
+20006	全国移动200元
+20007	全国移动300元
+20008	全国移动500元
+
+20009	全国联通10元
+20010	全国联通20元
+20011	全国联通30元
+20012	全国联通50元
+20013	全国联通100元
+20014	全国联通200元
+20015	全国联通300元
+20016	全国联通500元
+
+20047	全国电信5元
+20017	全国电信10元
+20018	全国电信20元
+20019	全国电信30元
+20020	全国电信50元
+20021	全国电信100元
+20022	全国电信200元
+20023	全国电信300元
+20024	全国电信500元

+ 51 - 0
helper/refill/api/xyz/ruizhi_tax_copy/config.php

@@ -0,0 +1,51 @@
+<?php
+
+
+namespace refill\ruizhi_tax_copy;
+
+use mtopcard;
+
+class config
+{
+    //回调地址需上游配置
+    const ORDER_URL = 'http://47.104.129.40:80/recharge/buy.do';
+    const QUERY_URL = 'http://47.104.129.40:80/recharge/query.do';
+    const BALANCE_URL = 'http://47.104.129.40:80/user/balance.do';
+    const USER_ID = '10713';
+    const KEY = '8F3F96FD1A6C';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_ruizhi_tax.php";
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const PRODUCT = [
+        mtopcard\ChinaMobileCard => [
+            10  => 20001,
+            20  => 20002,
+            30  => 20003,
+            50  => 20004,
+            100 => 20005,
+            200 => 20006,
+            300 => 20007,
+            500 => 20008
+        ],
+        mtopcard\ChinaUnicomCard => [
+            10  => 20009,
+            20  => 20010,
+            30  => 20011,
+            50  => 20012,
+            100 => 20013,
+            200 => 20014,
+            300 => 20015,
+            500 => 20016
+        ],
+        mtopcard\ChinaTelecomCard => [
+            10  => 20017,
+            20  => 20018,
+            30  => 20019,
+            50  => 20020,
+            100 => 20021,
+            200 => 20022,
+            300 => 20023,
+            500 => 20024
+        ],
+    ];
+    const ERRCODES = ['101', '102', '103', '104', '105', '106', '107', '108', '109', '100', '112', '115', '116', '117', '118', '119', '120'];
+}

BIN
helper/refill/api/xyz/ruizhi_tax_copy/互联网增值业务接口文档(技术文档).pdf