Browse Source

Merge branch 'raccount' of 39.97.239.116:gyfl/xyzshop into raccount

stanley-king 1 year ago
parent
commit
c127e36679

+ 1 - 0
admin/include/limit.php

@@ -44,6 +44,7 @@ $_limit =  array(
         array('name'=> '公司信息管理', 'op'=>null, 'act'=>'refill_company'),
         array('name'=> '充值拦截设置', 'op'=>null, 'act'=>'refill_config'),
         array('name'=> '卡密管理', 'op'=>null, 'act'=>'card_key'),
+        array('name'=> '增值业务管理', 'op'=>null, 'act'=>'refill_third'),
         array('name'=> '库存管理', 'op'=>null, 'act'=>'refill_stock'),
         array('name'=> '成功率监控', 'op'=>null, 'act'=>'refill_analysis'),
         array('name'=> '订单手动处理', 'op'=>null, 'act'=>'refill_order_manual'),

+ 28 - 1
admin/templates/default/refill.buyback.order.php

@@ -228,6 +228,13 @@
                     </a>
                 </td>
             </tr>
+            <tr>
+                <td>
+                    <a href="#" class="btns" onclick="hCopyOrderSn(event)">
+                        <span><i class="icon-edit"></i>拷贝订单号</span>
+                    </a>
+                </td>
+            </tr>
         </table>
     </form>
 
@@ -369,4 +376,24 @@
             }
         })
     });
-</script> 
+
+    function hCopyOrderSn(e) {
+        copy_some(2)
+    }
+
+    function copy_some(col) {
+        let str = ''
+        $('#tbody tr').each(function() {
+            let res = $(this).find('td').eq(col).text()
+            str += res + '\n'
+        })
+        let oInput = document.createElement("textarea");
+        oInput.style.border = "0 none";
+        oInput.style.color = "transparent";
+        oInput.value = str;
+        document.body.appendChild(oInput);
+        oInput.select(); // 选择对象
+        document.execCommand("Copy"); // 执行浏览器复制命令
+        oInput.parentNode.removeChild(oInput)
+    }
+</script>

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

@@ -9071,6 +9071,19 @@ $meixu_sec_phone = ['name' => 'meixu_sec', 'store_id' => 336, 'qualitys' => '2',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$tianchen_trd_phone = ['name' => 'tianchen_trd', 'store_id' => 337, 'qualitys' => '2',
+    'amount' => [
+//        10 => [['goods_id' => 8727, 'price' => 9.96, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        20 => [['goods_id' => 8728, 'price' => 19.92, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        30 => [['goods_id' => 8729, 'price' => 29.88, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        50 => [['goods_id' => 8730, 'price' => 49, 'quality' => 2, 'card_type' => 'chinaunicom']],
+        100 => [['goods_id' => 8731, 'price' => 99.6, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        200 => [['goods_id' => 8732, 'price' => 200.8, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        300 => [['goods_id' => 8733, 'price' => 301.2, 'quality' => 2, 'card_type' => 'chinaunicom']],
+//        500 => [['goods_id' => 8734, 'price' => 502, 'quality' => 2, 'card_type' => 'chinaunicom']]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -9351,6 +9364,7 @@ $phone_providers = [
     ['name' => 'quanzhen_hf', 'cfg' => $quanzhen_hf_phone],
     ['name' => 'quanzhen_hf_man', 'cfg' => $quanzhen_hf_man_phone],
     ['name' => 'meixu_sec', 'cfg' => $meixu_sec_phone],
+    ['name' => 'tianchen_trd', 'cfg' => $tianchen_trd_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 
@@ -9456,7 +9470,7 @@ $yilexin_third = ['name' => 'yilexin', 'store_id' => 328, 'qualitys' => '1',
     'amount' => [
         100 => [['goods_id' => 8675, 'price' => 99, 'quality' => 1, 'card_type' => 'third']],
     ],
-    'official_sn' => true, 'refill_type' => 'fetch'];
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $shenzhouquany_third = ['name' => 'shenzhouquany', 'store_id' => 333, 'qualitys' => '1',
     'amount' => [

BIN
helper/refill/api/xyz/guochuang/20230606陕西电信调价函.jpg


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

@@ -95,7 +95,7 @@ class config
         "5-20-23" => 20.08, "5-30-23" => 30.12, "5-50-23" => 50.2, "5-100-23" => 100.4, "5-200-23" => 200.8, "5-300-23" => 301.2, "5-500-23" => 502,//四川 23
         "5-10-31" => 10.22, "5-20-31" => 20.22, "5-30-31" => 30.24, "5-50-31" => 50.25, "5-100-31" => 100.3, "5-200-31" => 200.4, "5-300-31" => 300.6, "5-500-31" => 501,//新疆 31
         //电信
-        "6-10-27" => 10.015, "6-20-27" => 20.03, "6-30-27" => 30.045, "6-50-27" => 50.075, "6-100-27" => 100.15, "6-200-27" => 200.3, "6-300-27" => 299.4, "6-500-27" => 499,//陕西 27
+        "6-10-27" => 10.01, "6-20-27" => 20.02, "6-30-27" => 30.03, "6-50-27" => 50.05, "6-100-27" => 100.1, "6-200-27" => 200.2, "6-300-27" => 300.3, "6-500-27" => 500.5,//陕西 27
         "6-10-4" => 9.935, "6-20-4" => 19.87, "6-30-4" => 29.805, "6-50-4" => 49.675, "6-100-4" => 99.35, "6-200-4" => 198.7, "6-300-4" => 298.05, "6-500-4" => 496.75,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.21, "6-20-15" => 20.22, "6-30-15" => 30.231, "6-50-15" => 50.25, "6-100-15" => 100.3, "6-200-15" => 200.3, "6-300-15" => 300.45, "6-500-15" => 500.75,//山东 15

BIN
helper/refill/api/xyz/meixu_fs/20230606辽宁 广东 移动调价函.png


+ 2 - 2
helper/refill/api/xyz/meixu_fs/config.php

@@ -113,8 +113,8 @@ class config
 
     const Price = [
         //移动
-        "4-10-6" => 9.688, "4-20-6" => 19.376, "4-30-6" => 29.064, "4-50-6" => 48.44, "4-100-6" => 96.88, "4-200-6" => 197.76, "4-300-6" => 290.64, "4-500-6" => 484.4,//辽宁 6
-        "4-30-19" => 29.844, "4-50-19" => 49.74, "4-100-19" => 99.48, "4-200-19" => 198.96, "4-300-19" => 298.44, "4-500-19" => 497.4,//广东 19
+        "4-10-6" => 9.708, "4-20-6" => 19.416, "4-30-6" => 29.124, "4-50-6" => 48.54, "4-100-6" => 97.08, "4-200-6" => 194.16, "4-300-6" => 291.24, "4-500-6" => 485.4,//辽宁 6
+        "4-30-19" => 29.994, "4-50-19" => 49.99, "4-100-19" => 99.98, "4-200-19" => 199.96, "4-300-19" => 299.94, "4-500-19" => 499.9,//广东 19
         "4-10-13" => 9.973, "4-20-13" => 19.946, "4-30-13" => 29.919, "4-50-13" => 49.865, "4-100-13" => 99.73, "4-200-13" => 199.46, "4-300-13" => 299.19, "4-500-13" => 498.65,//福建 13
         "4-10-29" => 9.888, "4-20-29" => 19.776, "4-30-29" => 29.664, "4-50-29" => 49.44, "4-100-29" => 98.88, "4-200-29" => 197.76, "4-300-29" => 296.64, "4-500-29" => 494.4,//青海 29
         "4-50-10" => 49.85, "4-100-10" => 99.7, "4-200-10" => 199.4,//江苏 10

+ 10 - 0
helper/refill/api/xyz/tianchen_trd/API信息.txt

@@ -0,0 +1,10 @@
+对接文档:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+ID:100324
+账号:TCGYkami
+初始密码:123456
+秘钥:0020c00cc76549b5b929c0e3648aae91
+客户端地址:http://47.114.98.104:10081/plat/index
+
+提交地址:http://47.114.98.104:10081/plat/api/old/submitorder
+查询地址:http://47.114.98.104:10081/plat/api/old/queryorder
+查询余额地址:http://47.114.98.104:10081/plat/api/old/queryBalance

+ 50 - 0
helper/refill/api/xyz/tianchen_trd/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\tianchen_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tianchen_trd/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)
+    {
+        $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)
+    {
+        $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'];
+
+        if ($status === 2) {
+            $data['official_sn'] = strtolower($params['szRtnMsg']) == 'null' ? '' : $params['szRtnMsg'];
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false,true];
+        }
+        elseif ($status === 3) {
+            return [$order_id, false, true,true];
+        }
+        else {
+            return [$order_id, false, false,false];
+        }
+    }
+}

+ 141 - 0
helper/refill/api/xyz/tianchen_trd/RefillPhone.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace refill\tianchen_trd;
+
+require_once(BASE_HELPER_RAPI_PATH . '/tianchen_trd/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)
+    {
+        $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;
+        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, $amount, $card_type, $order_sn);
+
+        $sign = $this->sign($params);
+        $params['szVerifyString'] = $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 = json_decode($resp, true);
+
+            $nRtn = $resp['nRtn'];
+            if (empty($resp)) {
+                return [false, '网络错误', true];
+            } elseif ($nRtn === 0) {
+                return [true, '', false];
+            } elseif (in_array($nRtn, config::ERR_NOS, true)) {
+                return [false, $resp['szRtnCode'], false];
+            } elseif (in_array($nRtn, [2050, 999], true)) {
+                $net_errno = "HTTP-{$nRtn}";
+                return [false, $resp['szRtnCode'], true];
+            } else {
+                $err = 998;
+                $net_errno = "HTTP-{$err}";
+                return [false, $resp['szRtnCode'], true];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $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, '网络错误'];
+            }
+
+            $status = $resp['nRtn'];
+            if ($status === 5012) {
+                $updata['official_sn'] = $resp['szRtnMsg'];
+                Model('refill_order')->edit($refill_info['order_id'], $updata);
+                $order_state = ORDER_STATE_SUCCESS;
+            } elseif ($status === 5013) {
+                $order_state = ORDER_STATE_CANCEL;
+            } elseif (in_array($status, [5011,5019],true)) {
+                $order_state = ORDER_STATE_SEND;
+            } elseif ($status === 5005 && (time() - $refill_info['commit_time'] >= 300)) {
+                $order_state = ORDER_STATE_NOEXIST;
+            } else {
+                return [false, $resp['szRtnMsg']];
+            }
+
+            return [true, $order_state];
+        }
+    }
+
+    public function balance()
+    {
+        $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)
+    {
+        $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);
+    }
+}

+ 25 - 0
helper/refill/api/xyz/tianchen_trd/config.php

@@ -0,0 +1,25 @@
+<?php
+namespace refill\tianchen_trd;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.114.98.104:10081/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.114.98.104:10081/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.114.98.104:10081/plat/api/old/queryBalance';
+
+    const USER_ID= '100324';
+    const KEY = '0020c00cc76549b5b929c0e3648aae91';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_tianchen_trd.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 - 4
helper/refill/api/xyz/yilexin/RefillThird.php

@@ -6,7 +6,7 @@ require_once(BASE_HELPER_RAPI_PATH . '/yilexin/config.php');
 
 use refill;
 
-class RefillThird extends refill\IRefillThird
+class RefillPhone extends refill\IRefillThird
 {
     public function __construct($cfgs)
     {
@@ -15,9 +15,9 @@ class RefillThird extends refill\IRefillThird
 
     public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
     {
-        $mod_fetch = Model('fetch_order');
-        $count = $mod_fetch->store_order_count($this->store_id());
-        return [config::PROCESS_ABILITY >= $count, '',false];
+//        $mod_fetch = Model('fetch_order');
+//        $count = $mod_fetch->store_order_count($this->store_id());
+        return [true, '',false];
     }
 
     public function query($refill_info)

+ 1 - 1
helper/refill/api/yl/guochuang/config.php

@@ -95,7 +95,7 @@ class config
         "5-20-23" => 20.08, "5-30-23" => 30.12, "5-50-23" => 50.2, "5-100-23" => 100.4, "5-200-23" => 200.8, "5-300-23" => 301.2, "5-500-23" => 502,//四川 23
         "5-10-31" => 10.22, "5-20-31" => 20.22, "5-30-31" => 30.24, "5-50-31" => 50.25, "5-100-31" => 100.3, "5-200-31" => 200.4, "5-300-31" => 300.6, "5-500-31" => 501,//新疆 31
         //电信
-        "6-10-27" => 10.015, "6-20-27" => 20.03, "6-30-27" => 30.045, "6-50-27" => 50.075, "6-100-27" => 100.15, "6-200-27" => 200.3, "6-300-27" => 299.4, "6-500-27" => 499,//陕西 27
+        "6-10-27" => 10.01, "6-20-27" => 20.02, "6-30-27" => 30.03, "6-50-27" => 50.05, "6-100-27" => 100.1, "6-200-27" => 200.2, "6-300-27" => 300.3, "6-500-27" => 500.5,//陕西 27
         "6-10-4" => 9.935, "6-20-4" => 19.87, "6-30-4" => 29.805, "6-50-4" => 49.675, "6-100-4" => 99.35, "6-200-4" => 198.7, "6-300-4" => 298.05, "6-500-4" => 496.75,//山西 4
         "6-10-18" => 10.04, "6-20-18" => 20.08, "6-30-18" => 30.12, "6-50-18" => 50.15, "6-100-18" => 100.3, "6-200-18" => 200.6, "6-300-18" => 300.9, "6-500-18" => 501.5,//湖南 18
         "6-10-15" => 10.21, "6-20-15" => 20.22, "6-30-15" => 30.231, "6-50-15" => 50.25, "6-100-15" => 100.3, "6-200-15" => 200.3, "6-300-15" => 300.45, "6-500-15" => 500.75,//山东 15

+ 4 - 0
mobile/callback/refill_tianchen_trd.php

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