Browse Source

xianghongrui

xiaoyu 3 years atrás
parent
commit
5b7ae6b829

+ 17 - 17
data/config/win/refill.ini.php

@@ -1948,39 +1948,39 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
     ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
     'official_sn' => true, 'refill_type' => 'api'];
 
 
-$xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 87,'qualitys' => '1',
+$xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
     'amount' => [
     'amount' => [
         10 => [
         10 => [
-            ['goods_id' => 6797, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6797, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6949, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         20 => [
         20 => [
-            ['goods_id' => 6798, 'price' => 19, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6798, 'price' => 18.94, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6950, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         30 => [
         30 => [
-            ['goods_id' => 6799, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6799, 'price' => 28.41, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6951, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         50 => [
         50 => [
-            ['goods_id' => 6800, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6800, 'price' => 47.35, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6952, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         100 => [
         100 => [
-            ['goods_id' => 6801, 'price' => 95, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6801, 'price' => 94.7, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6953, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         200 => [
         200 => [
-            ['goods_id' => 6802, 'price' => 190, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6802, 'price' => 189.4, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6954, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         300 => [
         300 => [
-            ['goods_id' => 6803, 'price' => 285, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6803, 'price' => 284.1, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6955, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ],
         ],
         500 => [
         500 => [
-            ['goods_id' => 6804, 'price' => 475, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 6804, 'price' => 473.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+            ['goods_id' => 6956, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
         ]
         ]
     ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
     'official_sn' => true, 'refill_type' => 'api'];

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

@@ -1948,6 +1948,43 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
     ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
     'official_sn' => true, 'refill_type' => 'api'];
 
 
+$xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6949, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6950, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6951, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6952, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6953, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6954, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6955, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6956, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -2025,7 +2062,8 @@ $phone_providers = [
     ['name' => 'youhe', 'cfg' => $youhe_phone],
     ['name' => 'youhe', 'cfg' => $youhe_phone],
     ['name' => 'wenye', 'cfg' => $wenye_phone],
     ['name' => 'wenye', 'cfg' => $wenye_phone],
     ['name' => 'xinyang', 'cfg' => $xinyang_phone],
     ['name' => 'xinyang', 'cfg' => $xinyang_phone],
-    ['name' => 'guochuang', 'cfg' => $guochuang_phone]
+    ['name' => 'guochuang', 'cfg' => $guochuang_phone],
+    ['name' => 'xianghongrui', 'cfg' => $xianghongrui_phone]
 ];
 ];
 $config['phone_providers'] = $phone_providers;
 $config['phone_providers'] = $phone_providers;
 
 

+ 39 - 1
data/config/xyzadm/refill.ini.php

@@ -1948,6 +1948,43 @@ $guochuang_phone = ['name' => 'guochuang', 'store_id' => 106, 'qualitys' => '2',
     ],
     ],
     'official_sn' => true, 'refill_type' => 'api'];
     'official_sn' => true, 'refill_type' => 'api'];
 
 
+$xianghongrui_phone = ['name' => 'xianghongrui', 'store_id' => 107,'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 6949, 'price' => 9.48, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6949, 'price' => 9.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 6950, 'price' => 18.96, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6950, 'price' => 19, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        30 => [
+            ['goods_id' => 6951, 'price' => 28.44, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6951, 'price' => 28.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 6952, 'price' => 47.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6952, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 6953, 'price' => 94.8, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6953, 'price' => 95, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 6954, 'price' => 189.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6954, 'price' => 190, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 6955, 'price' => 284.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6955, 'price' => 285, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 6956, 'price' => 474, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 6956, 'price' => 475, 'quality' => 1, 'card_type' => 'chinaunicom,chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -2025,7 +2062,8 @@ $phone_providers = [
     ['name' => 'youhe', 'cfg' => $youhe_phone],
     ['name' => 'youhe', 'cfg' => $youhe_phone],
     ['name' => 'wenye', 'cfg' => $wenye_phone],
     ['name' => 'wenye', 'cfg' => $wenye_phone],
     ['name' => 'xinyang', 'cfg' => $xinyang_phone],
     ['name' => 'xinyang', 'cfg' => $xinyang_phone],
-    ['name' => 'guochuang', 'cfg' => $guochuang_phone]
+    ['name' => 'guochuang', 'cfg' => $guochuang_phone],
+    ['name' => 'xianghongrui', 'cfg' => $xianghongrui_phone]
 ];
 ];
 $config['phone_providers'] = $phone_providers;
 $config['phone_providers'] = $phone_providers;
 
 

+ 51 - 0
helper/refill/api/xyz/xianghongrui/RefillCallBack.php

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

+ 152 - 0
helper/refill/api/xyz/xianghongrui/RefillPhone.php

@@ -0,0 +1,152 @@
+<?php
+
+namespace refill\xianghongrui;
+
+require_once(BASE_HELPER_RAPI_PATH . '/xianghongrui/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['userid'] = config::USER_ID;
+        $params['productid'] = config::ProductIDS[$card_type][$amount];
+        $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)
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+        if(empty($params['productid'])) {
+            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 = intval($resp['resultno']);
+            if (in_array($resultno, [0, 2])) {
+                return [true, $resp['orderid'], false];
+            } elseif ($resultno == '5006' || $resultno == '9999') {
+                $net_errno = "HTTP-{$resultno}";
+                return [false, $resultno, false];
+            } else {
+                return [false, $resultno, false];
+            }
+        }
+    }
+
+    public function query($refill_info)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['sporderid'] = $refill_info['order_sn'];
+
+        $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
+            {
+                $resultno = intval($resp['resultno']);
+                if ($resultno === 1) {
+                    $updata['official_sn'] = $resp['remark1'];
+                    Model('refill_order')->edit($refill_info['order_id'], $updata);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($resultno === 9) {
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($resultno, [0,2])) {
+                    $order_state = ORDER_STATE_SEND;
+                } elseif ($resultno === 5007 && (time() - $refill_info['commit_time'] >= 600)) {
+                    $order_state = ORDER_STATE_NOEXIST;
+                } else {
+                    return [false, $resultno];
+                }
+                return [true, $order_state];
+            }
+        }
+    }
+
+    public function balance()
+    {
+        $params['userid'] = config::USER_ID;
+        $key = config::KEY;
+        $body = "userid={$params['userid']}&key={$key}";
+        $params['sign'] = md5($body);
+
+        $resp = http_request(config::BALANCE_UTL, $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
+            {
+                if($resp['resultno'] == 1) {
+                    return [true, $resp['balance']];
+                }else {
+                    return [false, $resp['resultno']];
+                }
+
+            }
+        }
+    }
+
+    private function sign($params)
+    {
+        $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 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 json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
+    }
+}

+ 34 - 0
helper/refill/api/xyz/xianghongrui/config.php

@@ -0,0 +1,34 @@
+<?php
+
+
+namespace refill\xianghongrui;
+
+use mtopcard;
+class config
+{
+    //yd948 dl95
+    const ORDER_URL = 'http://123.60.50.146:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.60.50.146:9086/searchpay.do';
+    const BALANCE_UTL = 'http://123.60.50.146:9086/searchbalance.do';
+
+    const USER_ID= '10002503';
+    const KEY = 'ZcWJfd4Jt63JAwiymPEXzGDHyjy8H62F';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_xianghongrui.php";
+    const operator = [
+        mtopcard\ChinaMobileCard  => 'yd',
+        mtopcard\ChinaUnicomCard  => 'lt',
+        mtopcard\ChinaTelecomCard => 'dx'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;charset=utf-8'];
+    const ProductIDS = [
+        mtopcard\ChinaMobileCard => [
+            30 => '30000005171', 50 => '30000005172', 100 => '30000005173', 200 => '30000005174'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000005175', 50 => '30000005176', 100 => '30000005177', 200 => '30000005178'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000005179', 50 => '30000005180', 100 => '30000005181', 200 => '30000005182'
+        ]
+    ];
+}

+ 28 - 0
helper/refill/api/xyz/xianghongrui/账号.txt

@@ -0,0 +1,28 @@
+http://123.60.50.146:7080/
+账号:yezi
+密码:yezi123456
+id:    10002503
+密钥:ZcWJfd4Jt63JAwiymPEXzGDHyjy8H62F
+
+
+
+
+下单地址:http://123.60.50.146:9086/onlinepay.do
+余额查询地址:http://123.60.50.146:9086/searchbalance.do
+查单地址:http://123.60.50.146:9086/searchpay.do
+
+
+全国电信30元直充   30000005179
+全国电信50元直充  30000005180
+全国电信100元直充  30000005181
+全国电信200元直充   30000005182
+ 
+全国移动话费快充30元      30000005171
+全国移动话费快充50元      30000005172
+全国移动话费快充100元     30000005173
+全国移动话费快充200元     30000005174
+
+全国联通话费快充30元    30000005175
+全国联通话费快充50元    30000005176
+全国联通话费快充100元    30000005177
+全国联通话费快充200元     30000005178

BIN
helper/refill/api/xyz/xianghongrui/通信充值接口.doc


+ 4 - 0
mobile/callback/refill_xianghongrui.php

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

+ 6 - 3
test/TestRefill.php

@@ -695,12 +695,15 @@ class TestRefill extends TestCase
         [$goods_id,$price] = $providers->goods(2,10,4,1,[]);
         [$goods_id,$price] = $providers->goods(2,10,4,1,[]);
     }
     }
 
 
-    public function testXianghongtui()
+    public function testXianghongrui()
     {
     {
         $providers = new refill\xianghongrui\RefillPhone([]);
         $providers = new refill\xianghongrui\RefillPhone([]);
 //        $resp = $providers->balance();
 //        $resp = $providers->balance();
-        $resp = $providers->add(18074608795, 6, 30, ['order_sn' => $this->make_sn()]);
-//        $resp = $providers->query(['order_sn' => '82951628231038096078']);
+//        $resp = $providers->add(18500608333, 5, 50, ['order_sn' => $this->make_sn()]);
+//        $resp = $providers->query(['order_sn' => '87691628758730981608']);
+        $body = '{"orderid":"BAT21081216581941649","sporderid":"87691628758730981608","userid":"10002503","merchantsubmittime":"20210812165918","resultno":"1","parvalue":"50","remark1":"110103353052108121658550256634","payno":"110103353052108121658550256634","fundbalance":"-47.5","sign":"EF34F6FB6D37E4FCB92DCD8F41CC67E1"}';
+        $params = json_decode($body, true);
+        refill\RefillFactory::instance()->notify('xianghongrui', $params);
     }
     }
 
 
     public function testAmingjd()
     public function testAmingjd()