Ver código fonte

dev new channel

zb727 1 ano atrás
pai
commit
96713c6e5d

+ 29 - 4
data/config/mh/refill.ini.php

@@ -222,12 +222,12 @@ $seven_kami = ['name' => 'seven_kami', 'store_id' => 387, 'qualitys' => '3',
         ],
         50 => [
             ['goods_id' => 9023, 'price' => 49.975, 'quality' => 3, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9023, 'price' => 49.70,  'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9023, 'price' => 49.00,  'quality' => 3, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9023, 'price' => 49.995, 'quality' => 3, 'card_type' => 'chinatelecom'],
         ],
         100 => [
             ['goods_id' => 9024, 'price' => 99.95, 'quality' => 3, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9024, 'price' => 94.70, 'quality' => 3, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9024, 'price' => 94.20, 'quality' => 3, 'card_type' => 'chinaunicom'],
             ['goods_id' => 9024, 'price' => 99.99, 'quality' => 3, 'card_type' => 'chinatelecom']
         ],
     ],
@@ -253,6 +253,30 @@ $gy_normal = ['name' => 'gy_normal', 'store_id' => 388, 'qualitys' => '1',
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$gy_fast = ['name' => 'gy_fast', 'store_id' => 389, 'qualitys' => '2',
+    'amount' => [
+        50 => [
+            ['goods_id' => 9039, 'price' => 50.15,  'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9039, 'price' => 50.35,  'quality' => 2, 'card_type' => 'chinatelecom'],
+        ],
+        100 => [
+            ['goods_id' => 9040, 'price' => 100.5, 'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9040, 'price' => 100.3, 'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9040, 'price' => 100.7, 'quality' => 2, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 9041, 'price' => 201,    'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9041, 'price' => 200.6,  'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9041, 'price' => 201.4,  'quality' => 2, 'card_type' => 'chinatelecom'],
+        ],
+        300 => [
+            ['goods_id' => 9042, 'price' => 301.5,  'quality' => 2, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9042, 'price' => 300.9,  'quality' => 2, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9042, 'price' => 302.1,  'quality' => 2, 'card_type' => 'chinatelecom'],
+        ],
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
     ['name' => 'dixin_normal', 'cfg' => $dixin_normal],
     ['name' => 'dixin_slow', 'cfg' => $dixin_slow],
@@ -264,7 +288,8 @@ $phone_providers = [
     ['name' => 'kefei_fast', 'cfg' => $kefei_fast],
     ['name' => 'dixin_fast', 'cfg' => $dixin_fast],
     ['name' => 'seven_kami', 'cfg' => $seven_kami],
-    ['name' => 'gy_normal', 'cfg' => $gy_normal]
+    ['name' => 'gy_normal', 'cfg' => $gy_normal],
+    ['name' => 'gy_fast', 'cfg' => $gy_fast]
 ];
 
 $config['phone_providers'] = $phone_providers;
@@ -291,5 +316,5 @@ $config['sms_mchids'] = [];
 
 #风险流水号管理
 $config['risk_official_sn'] = [
-    'exclude_stores' => [377, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388]
+    'exclude_stores' => [377, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389]
 ];

+ 50 - 0
helper/refill/api/mh/guitong_fast/RefillCallBack.php

@@ -0,0 +1,50 @@
+<?php
+namespace refill\guitong_fast;
+
+require_once(BASE_HELPER_RAPI_PATH . '/guitong_fast/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')->getOrderInfo(['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/mh/guitong_fast/RefillPhone.php

@@ -0,0 +1,141 @@
+<?php
+
+namespace refill\guitong_fast;
+
+require_once(BASE_HELPER_RAPI_PATH . '/guitong_fast/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);
+    }
+}

+ 15 - 0
helper/refill/api/mh/guitong_fast/api.txt

@@ -0,0 +1,15 @@
+正式环境:
+话费下单地址:http://47.98.242.182:10186/plat/api/old/submitorder
+查询地址:http://47.98.242.182:10186/plat/api/old/queryorder
+查询余额地址:http://47.98.242.182:10186/plat/api/old/queryBalance
+
+
+ID:200355
+
+秘钥:081c57c4502f4033a0e142eefbecb1ea
+
+对接文档地址:https://docs.qq.com/doc/DWkV1VkxQVk13eEtQ
+
+客户端地址:http://47.98.242.182:10186/plat/index
+账号:北京美嗨三网
+密码: 55668899

+ 27 - 0
helper/refill/api/mh/guitong_fast/config.php

@@ -0,0 +1,27 @@
+<?php
+
+
+namespace refill\guitong_fast;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://47.98.242.182:10186/plat/api/old/submitorder';
+    const QUERY_URL= 'http://47.98.242.182:10186/plat/api/old/queryorder';
+    const BALANCE_URL = 'http://47.98.242.182:10186/plat/api/old/queryBalance';
+
+    const USER_ID= '200355';
+    const KEY = '081c57c4502f4033a0e142eefbecb1ea';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_guitong_fast.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
+    ];
+}

+ 12 - 0
helper/refill/api/mh/gy_fast/api.txt

@@ -0,0 +1,12 @@
+https://admin.xyzshops.cn/merchant/#/
+
+zhixinkc
+erc_yu78
+
+10505
+beaf87f87c6bcb8a98b853c207ca9aef
+
+
+## 店铺
+- 账号:GY002
+- 密码:GY002@888

+ 1 - 1
helper/refill/api/mh/gy_fast/config.php

@@ -4,7 +4,7 @@ namespace refill\gy_fast;
 
 class config
 {
-    public const MCH_ID = 10503;
+    public const MCH_ID = 10505;
     public const KEY = 'beaf87f87c6bcb8a98b853c207ca9aef';
 
     public const ORDER_URL = 'https://www.xyzshops.cn/mobile/index.php';

+ 9 - 5
helper/refill/api/mh/gy_normal/api.txt

@@ -1,7 +1,11 @@
-https://ylweb.xyzshops.cn/merchant/#/login
+https://admin.xyzshops.cn/merchant/#/login
 
-yezidianxin03
-yezidx03
+zhixinltong
+schoi_78
 
-10311
-b7a2ad26ca0dc2e13599a8f7c529677d
+10503
+beaf87f87c6bcb8a98b853c207ca9aef
+
+## 店铺
+- 账号:GY001
+- 密码:GY001@888

+ 8 - 0
racc/callback/mh/guitong_fast.php

@@ -0,0 +1,8 @@
+<?php
+
+$content = $_SERVER['post_content'];
+Log::record("guitong_fast content=$content",Log::DEBUG);
+
+refill\util::push_notify('guitong_fast',$_POST);
+
+echo ('ok');

+ 1 - 1
racc/callback/mh/gy_fast.php

@@ -1,7 +1,7 @@
 <?php
 
 $content = $_SERVER['post_content'];
-Log::record("gy_normal content=$content",Log::DEBUG);
+Log::record("gy_fast content=$content",Log::DEBUG);
 
 refill\util::push_notify('gy_fast',$_POST);