소스 검색

椰子:兴创3号,门上2号,椰林:门上1号,门上分省

lowkeyman 1 년 전
부모
커밋
51e18c3325

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

@@ -10500,45 +10500,90 @@ $kachong_new_phone = ['name' => 'kachong_new', 'store_id' => 393, 'qualitys' =>
 
 $xingchuang_trd_phone = ['name' => 'xingchuang_trd', 'store_id' => 394, 'qualitys' => '1',
     'amount' => [
+//        10 => [
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9089, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        20 => [
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9090, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        30 => [
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9091, 'price' => 30, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        50 => [
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9092, 'price' => 50, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+        100 => [
+            ['goods_id' => 9093, 'price' => 97.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9093, 'price' => 100, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9093, 'price' => 100, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+        200 => [
+            ['goods_id' => 9094, 'price' => 194.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9094, 'price' => 200, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9094, 'price' => 200, 'quality' => 1, 'card_type' => 'chinatelecom'],
+        ],
+//        300 => [
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9095, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ],
+//        500 => [
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9096, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$menshang_sec_phone = ['name' => 'menshang_sec', 'store_id' => 395, 'qualitys' => '1',
+    'amount' => [
         10 => [
-//            ['goods_id' => 9089, 'price' => 9.7, 'quality' => 1, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 9089, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 9089, 'price' => 9.75, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 9097, 'price' => 9.65, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9097, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9097, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         20 => [
-//            ['goods_id' => 9090, 'price' => 19.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 9090, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 9090, 'price' => 19.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 9098, 'price' => 19.3, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9098, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9098, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         30 => [
-            ['goods_id' => 9091, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9091, 'price' => 28.26, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 9091, 'price' => 29.25, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//            ['goods_id' => 9099, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9099, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9099, 'price' => 29.01, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         50 => [
-            ['goods_id' => 9092, 'price' => 48.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9092, 'price' => 47.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 9092, 'price' => 48.75, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 9100, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9100, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9100, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         100 => [
-            ['goods_id' => 9093, 'price' => 97.2, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9093, 'price' => 94.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 9093, 'price' => 97.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 9101, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9101, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9101, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
         200 => [
-            ['goods_id' => 9094, 'price' => 194.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-            ['goods_id' => 9094, 'price' => 188.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
-            ['goods_id' => 9094, 'price' => 195, 'quality' => 1, 'card_type' => 'chinatelecom'],
-        ],
-        300 => [
-            ['goods_id' => 9095, 'price' => 290.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 9095, 'price' => 282, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 9095, 'price' => 292.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
+            ['goods_id' => 9102, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 9102, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 9102, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinatelecom']
         ],
+//        300 => [
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9103, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
 //        500 => [
-//            ['goods_id' => 9096, 'price' => 485, 'quality' => 1, 'card_type' => 'chinamobile'],
-//            ['goods_id' => 9096, 'price' => 470, 'quality' => 1, 'card_type' => 'chinaunicom'],
-//            ['goods_id' => 9096, 'price' => 487.5, 'quality' => 1, 'card_type' => 'chinatelecom'],
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9104, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
 //        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
@@ -10857,7 +10902,8 @@ $phone_providers = [
 //    ['name' => 'huifen_fast', 'cfg' => $huifen_fast_phone],
         ['name' => 'xingchuang_sec', 'cfg' => $xingchuang_sec_phone],
     ['name' => 'kachong_new', 'cfg' => $kachong_new_phone],
-//    ['name' => 'xingchuang_trd', 'cfg' => $xingchuang_trd_phone],
+    ['name' => 'xingchuang_trd', 'cfg' => $xingchuang_trd_phone],
+    ['name' => 'menshang_sec', 'cfg' => $menshang_sec_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

+ 84 - 0
data/config/yl/refill.ini.php

@@ -8068,6 +8068,88 @@ $xingchuang_fs_phone = ['name' => 'xingchuang_fs', 'store_id' => 310, 'qualitys'
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$menshang_phone = ['name' => 'menshang', 'store_id' => 311, 'qualitys' => '1',
+    'amount' => [
+        10 => [
+            ['goods_id' => 8499, 'price' => 9.67, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8499, 'price' => 10, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8499, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        20 => [
+            ['goods_id' => 8500, 'price' => 19.34, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8500, 'price' => 20, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8500, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        30 => [
+//            ['goods_id' => 8501, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8501, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8501, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8502, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8502, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8502, 'price' => 48.35, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8503, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8503, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8503, 'price' => 96.7, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8504, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8504, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8504, 'price' => 193.4, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8505, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8506, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$menshang_fs_phone = ['name' => 'menshang_fs', 'store_id' => 312, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8507, 'price' => 10, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8507, 'price' => 10, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8508, 'price' => 20, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8508, 'price' => 20, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 8509, 'price' => 28.35, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8509, 'price' => 28.14, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8510, 'price' => 47.25, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8510, 'price' => 46.9, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8511, 'price' => 94.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8511, 'price' => 93.8, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8512, 'price' => 189, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8512, 'price' => 187.6, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+//        300 => [
+//            ['goods_id' => 8513, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8513, 'price' => 300, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        500 => [
+//            ['goods_id' => 8514, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8514, 'price' => 500, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -8325,6 +8407,8 @@ $phone_providers = [
     ['name' => 'yzpuchong2', 'cfg' => $yzpuchong2_phone],
     ['name' => 'xingchuang_nation', 'cfg' => $xingchuang_nation_phone],
     ['name' => 'xingchuang_fs', 'cfg' => $xingchuang_fs_phone],
+    ['name' => 'menshang', 'cfg' => $menshang_phone],
+    ['name' => 'menshang_fs', 'cfg' => $menshang_fs_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

+ 43 - 0
helper/refill/api/xyz/menshang_sec/API.MD

@@ -0,0 +1,43 @@
+
+## 门上全国2号
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清0095
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002649
+- 密钥:2b3tMhAz7khJw8tfFyAJyFJ6e2Ec7rNw
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang_sec
+- 密码:menshang_sec67890
+
+## 编码
+- 商品编号 商品名称
+- 30000000739 全国电信200元直充
+- 30000000738 全国电信100元直充
+- 30000000737 全国电信50元直充
+- 30000000736 全国电信30元直充
+
+
+- 商品编号 商品名称
+- 30000000992 全国联通200元直充
+- 30000000733 全国联通100元直充
+- 30000000732 全国联通50元直充
+- 30000000731 全国联通30元直充
+
+
+- 商品编号 商品名称
+- 30000000911 全国移动200元直充
+- 30000000910 全国移动100元直充
+- 30000000909 全国移动50元直充
+- 商品编号 商品名称
+- 30000000907 全国移动20元直充
+- 30000000906 全国移动10元直充

BIN
helper/refill/api/xyz/menshang_sec/API.doc


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

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

+ 155 - 0
helper/refill/api/xyz/menshang_sec/RefillPhone.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace refill\menshang_sec;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_sec/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;
+        $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): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $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'] = 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'] = 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 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);
+    }
+}

+ 46 - 0
helper/refill/api/xyz/menshang_sec/config.php

@@ -0,0 +1,46 @@
+<?php
+
+
+namespace refill\menshang_sec;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL= 'http://123.249.40.234:9086/searchbalance.do';
+    const USER_ID= '10002649';
+    const KEY = '2b3tMhAz7khJw8tfFyAJyFJ6e2Ec7rNw';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang_sec.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 => '30000000906',
+            20 => '30000000907',
+            50 => '30000000909',
+            100 => '30000000910',
+            200 => '30000000911'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000000731',
+            50 => '30000000732',
+            100 => '30000000733',
+            200 => '30000000992'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000000736',
+            50 => '30000000737',
+            100 => '30000000738',
+            200 => '30000000739'
+        ],
+    ];
+}

+ 2 - 17
helper/refill/api/xyz/xingchuang_trd/API.MD

@@ -19,21 +19,6 @@
 - xingchuang_trd67890
 
 ### 产品编码
-#### 全国
-> 联通30-200,折扣 942产品编码:
-- 30 2000030
-- 50 2000050
-- 100 2000100
-- 200 2000200
 
-> 移动全国的30-200,折扣 968产品编码:
-- 30 1000030
-- 50 1000050
-- 100 1000100
-- 200 1000200
-- 300 1000300
-
-> 全国电信 50-200 折扣:975
-- 全国电信50元 3000050
-- 全国电信100元 3000100
-- 全国电信200元 3000200
+福庆顺全国3	全国移动100元	1000100
+福庆顺全国3	全国移动200元	1000200

+ 2 - 2
helper/refill/api/xyz/xingchuang_trd/RefillCallBack.php

@@ -16,7 +16,7 @@ class RefillCallBack implements refill\IRefillCallBack
         }
     }
 
-    private function sign($params)
+    private function sign($params): string
     {
         $userid = config::USER_ID;
         $key = config::KEY;
@@ -25,7 +25,7 @@ class RefillCallBack implements refill\IRefillCallBack
         return md5($content);
     }
 
-    public function notify($params)
+    public function notify($params): array
     {
         $status = intval($params['nFlag']);
         $order_sn = $params['szOrderId'];

+ 14 - 6
helper/refill/api/xyz/xingchuang_trd/RefillPhone.php

@@ -14,14 +14,19 @@ class RefillPhone extends refill\IRefillPhone
         parent::__construct($cfgs);
     }
 
-    private function req_params(int $phone, int $amount, int $card_type, string $order_sn)
+    private function req_params(int $phone, int $amount, int $card_type, string $order_sn): array
     {
         $params['szAgentId'] = config::USER_ID;
         $params['szOrderId'] = $order_sn;
         $params['szPhoneNum'] = $phone;
         $params['nMoney'] = $amount;
         $params['nSortType'] = config::operator[$card_type];
-        $params['szProductId'] = config::Product[$card_type][$amount];
+
+        $productId = config::Product[$card_type][$amount] ?? false;
+        if ($productId === false) {
+            return [];
+        }
+        $params['szProductId'] = $productId;
         $params['nProductClass'] = 1;
         $params['nProductType'] = 1;
         $params['szTimeStamp'] = date("Y-m-d H:i:s");
@@ -29,10 +34,13 @@ class RefillPhone extends refill\IRefillPhone
         return $params;
     }
 
-    public function add($card_no, $card_type, $amount, $params,&$net_errno = 0)
+    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['szVerifyString'] = $sign;
@@ -65,7 +73,7 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
-    public function query($refill_info)
+    public function query($refill_info): array
     {
         $params['szAgentId'] = config::USER_ID;
         $params['szOrderId'] = $refill_info['order_sn'];
@@ -109,7 +117,7 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
-    public function balance()
+    public function balance(): array
     {
         $params['szAgentId'] = config::USER_ID;
         $key = config::KEY;
@@ -135,7 +143,7 @@ class RefillPhone extends refill\IRefillPhone
         }
     }
 
-    private function sign($params)
+    private function sign($params): string
     {
         $userid = config::USER_ID;
         $key = config::KEY;

+ 2 - 12
helper/refill/api/xyz/xingchuang_trd/config.php

@@ -26,22 +26,12 @@ class config
 
     const Product = [
         mtopcard\ChinaMobileCard => [
-            30  => 1000030,
-            50  => 1000050,
-            100 => 1000100,
-            200 => 1000200,
-            300 => 1000300,
+            100  => 1000100,
+            200  => 1000200,
         ],
         mtopcard\ChinaUnicomCard => [
-            30  => 2000030,
-            50  => 2000050,
-            100 => 2000100,
-            200 => 2000200,
         ],
         mtopcard\ChinaTelecomCard => [
-            50  => 3000050,
-            100 => 3000100,
-            200 => 3000200,
         ],
     ];
 }

+ 43 - 0
helper/refill/api/yl/menshang/API.MD

@@ -0,0 +1,43 @@
+
+## 门上全国1号
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清全国wt
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002648
+- 密钥:PHMtTBf535FGsEJXCBb8wbT5hPPm3SQX
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang
+- 密码:menshang67890
+
+## 编码
+- 商品编号 商品名称
+- 30000000739 全国电信200元直充
+- 30000000738 全国电信100元直充
+- 30000000737 全国电信50元直充
+- 30000000736 全国电信30元直充
+
+
+- 商品编号 商品名称
+- 30000000992 全国联通200元直充
+- 30000000733 全国联通100元直充
+- 30000000732 全国联通50元直充
+- 30000000731 全国联通30元直充
+
+
+- 商品编号 商品名称
+- 30000000911 全国移动200元直充
+- 30000000910 全国移动100元直充
+- 30000000909 全国移动50元直充
+- 商品编号 商品名称
+- 30000000907 全国移动20元直充
+- 30000000906 全国移动10元直充

BIN
helper/refill/api/yl/menshang/API.doc


+ 49 - 0
helper/refill/api/yl/menshang/RefillCallBack.php

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

+ 155 - 0
helper/refill/api/yl/menshang/RefillPhone.php

@@ -0,0 +1,155 @@
+<?php
+
+namespace refill\menshang;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang/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;
+        $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): array
+    {
+        $order_sn = $params['order_sn'];
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn);
+
+        $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'] = 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'] = 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 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);
+    }
+}

+ 46 - 0
helper/refill/api/yl/menshang/config.php

@@ -0,0 +1,46 @@
+<?php
+
+
+namespace refill\menshang;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL= 'http://123.249.40.234:9086/searchbalance.do';
+    const USER_ID= '10002648';
+    const KEY = 'PHMtTBf535FGsEJXCBb8wbT5hPPm3SQX';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang.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 => '30000000906',
+            20 => '30000000907',
+            50 => '30000000909',
+            100 => '30000000910',
+            200 => '30000000911'
+        ],
+        mtopcard\ChinaUnicomCard => [
+            30 => '30000000731',
+            50 => '30000000732',
+            100 => '30000000733',
+            200 => '30000000992'
+        ],
+        mtopcard\ChinaTelecomCard => [
+            30 => '30000000736',
+            50 => '30000000737',
+            100 => '30000000738',
+            200 => '30000000739'
+        ],
+    ];
+}

BIN
helper/refill/api/yl/menshang_fs/20240126_all.jpg


+ 89 - 0
helper/refill/api/yl/menshang_fs/API.MD

@@ -0,0 +1,89 @@
+
+## 门上分省
+> copy dongyefs
+
+### 账号信息
+- 后台登录地址:http://123.249.40.234:10060
+- 登录名:福清分省
+- 初始密码:123456
+
+### 接口信息
+- 用户id:10002650
+- 密钥:reFifPhfPrNFF4Jxim5EmybMSfcHmfRx
+
+## 接口地址
+话费充值接口:http://123.249.40.234:9086/onlinepay.do
+订单查询接口:http://123.249.40.234:9086/searchpay.do
+账户余额查询接口:http://123.249.40.234:9086/searchbalance.do
+
+## 店铺账号
+- 账号:menshang_fs
+- 密码:menshang_fs67890
+
+## 编码
+- 商品编号 商品名称
+- 35577 湖北移动200元直充
+- 3520 湖北移动100元直充
+- 3519 湖北移动50元直充
+- 3518 湖北移动30元直充
+- 商品编号 商品名称
+- 36578 山东移动200元直充
+- 3624 山东移动100元直充
+- 3623 山东移动50元直充
+- 3622 山东移动30元直充
+- 商品编号
+- 商品名称
+- 315621 广西移动200元直充
+- 31562 广西移动100元直充
+- 31561 广西移动50元直充
+- 31560 广西移动30元直充
+- 商品编号 商品名称
+- 318624 天津移动200元直充
+- 31874 天津移动100元直充
+- 31873 天津移动50元直充
+- 31872 天津移动30元直充
+- 商品编号 商品名称
+- 328631 青海移动200元直充
+- 328106 青海移动100元直充
+- 328105 青海移动50元直充
+- 328104 青海移动30元直充
+- 商品编号 商品名称
+- 274591 湖南电信200元直充
+- 274331 湖南电信100元直充
+- 274330 湖南电信50元直充
+- 274329 湖南电信30元直充
+- 商品编号 商品名称
+- 271588 四川电信200元直充
+- 271316 四川电信100元直充
+- 271315 四川电信50元直充
+- 271314 四川电信30元直充
+- 商品编号 商品名称
+- 270587 山东电信200元直充
+- 270311 山东电信100元直充
+- 270310 山东电信50元直充
+- 270309 山东电信30元直充
+- 商品编号 商品名称
+- 282601 天津电信200元直充
+- 282371 天津电信100元直充
+- 282370 天津电信50元直充
+- 282369 天津电信30元直充
+- 商品编号 商品名称
+- 276593 河北电信200元直充
+- 276341 河北电信100元直充
+- 276340 河北电信50元直充
+- 276339 河北电信30元直充
+- 商品编号 商品名称
+- 289609 宁夏电信200元直充
+- 289406 宁夏电信100元直充
+- 289405 宁夏电信50元直充
+- 289404 宁夏电信30元直充
+- 商品编号 商品名称
+- 290610 青海电信200元直充
+- 290411 青海电信100元直充
+- 290410 青海电信50元直充
+- 290409 青海电信30元直充 正常
+- 商品编号 商品名称
+- 269586 湖北电信200元直充
+- 269306 湖北电信100元直充
+- 269305 湖北电信50元直充
+- 269304 湖北电信30元直充

BIN
helper/refill/api/yl/menshang_fs/API.doc


+ 49 - 0
helper/refill/api/yl/menshang_fs/RefillCallBack.php

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

+ 174 - 0
helper/refill/api/yl/menshang_fs/RefillPhone.php

@@ -0,0 +1,174 @@
+<?php
+
+namespace refill\menshang_fs;
+
+require_once(BASE_HELPER_RAPI_PATH . '/menshang_fs/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    public function goods($quality,int $amount,int $card_type,$regin_no,$other)
+    {
+        [$goods_id, $price] = parent::goods($quality,$amount,$card_type,$regin_no,$other);
+        if($goods_id <= 0) return [0,0];
+        $key = "{$card_type}-{$amount}-{$regin_no}";
+        $price = config::Price[$key];
+        if(empty($price)) {
+            Log::record("channel cannot find price where name={$this->mName}, goods_id = {$goods_id} card_type={$card_type} amount={$amount} regin_no={$regin_no}",Log::ERR);
+            return [0,0];
+        } else {
+            return [$goods_id,ncPriceFormat($price)];
+        }
+    }
+
+    private function req_params(int $phone, int $amount, $card_type, string $order_sn, $regin_no)
+    {
+        $params['userid'] = config::USER_ID;
+        $params['productid'] = config::product_id[$card_type][$regin_no][$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'];
+        $regin_no = $params['regin_no'] ?? -1;
+        if($regin_no <= 0) {
+            return [false, '省份获取错误', false];
+        }
+        $params = $this->req_params($card_no, $amount, $card_type, $order_sn, $regin_no);
+        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 = $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'] = 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 = $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'] = 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 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);
+    }
+}

+ 93 - 0
helper/refill/api/yl/menshang_fs/config.php

@@ -0,0 +1,93 @@
+<?php
+namespace refill\menshang_fs;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://123.249.40.234:9086/onlinepay.do';
+    const QUERY_URL= 'http://123.249.40.234:9086/searchpay.do';
+    const BALANCE_URL = 'http://123.249.40.234:9086/searchbalance.do';
+
+    const USER_ID= '10002650';
+    const KEY = 'reFifPhfPrNFF4Jxim5EmybMSfcHmfRx';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_menshang_fs.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'
+    ];
+    const ExtHeaders = ['Content-Type:application/x-www-form-urlencoded;'];
+
+    const product_id = [
+        mtopcard\ChinaMobileCard => [
+            17 => [
+                30 => '3518', 50 => '3519', 100 => '3520', 200 => '35577'
+            ],//湖北
+            15 => [
+                30 => '3622', 50 => '3623', 100 => '3624', 200 => '36578'
+            ],//山东
+            20 => [
+                30 => '31560', 50 => '31561', 100 => '31562', 200 => '315621'
+            ],//广西
+            2 => [
+                30 => '31872', 50 => '31873', 100 => '31874', 200 => '318624'
+            ],//天津
+            29 => [
+                30 => '328104', 50 => '328105', 100 => '328106', 200 => '328631'
+            ],//青海
+        ],
+
+        mtopcard\ChinaUnicomCard => [
+
+        ],
+
+        mtopcard\ChinaTelecomCard => [
+            18 => [
+                30 => '274329', 50 => '274330', 100 => '274331', 200 => '274591'
+            ],//湖南
+            23 => [
+                30 => '271314', 50 => '271315', 100 => '271316', 200 => '271588'
+            ],//四川
+            15 => [
+                30 => '270309', 50 => '270310', 100 => '270311', 200 => '270587'
+            ],//山东
+            2 => [
+                30 => '282369', 50 => '282370', 100 => '282371', 200 => '282601'
+            ],//天津
+            3 => [
+                30 => '276339', 50 => '276340', 100 => '276341', 200 => '276593'
+            ],//河北
+            30 => [
+                30 => '289404', 50 => '289405', 100 => '289406', 200 => '289609'
+            ],//宁夏
+            29 => [
+                30 => '290409', 50 => '290410', 100 => '290411', 200 => '290610'
+            ],//青海
+            17 => [
+                30 => '269304', 50 => '269305', 100 => '269306', 200 => '269586'
+            ],//湖北
+        ]
+    ];
+    //key格式 卡类型-面值-regin_no
+    const Price = [
+        //移动
+        "4-30-17" => 28.56, "4-50-17" => 47.6, "4-100-17" => 95.2, "4-200-17" => 190.4,//湖北 17
+        "4-30-15" => 28.56, "4-50-15" => 47.6, "4-100-15" => 95.2, "4-200-15" => 190.4,//山东 15
+        "4-30-20" => 28.56, "4-50-20" => 47.6, "4-100-20" => 95.2, "4-200-20" => 190.4,//广西 20
+        "4-30-2" => 28.56, "4-50-2" => 47.6, "4-100-2" => 95.2, "4-200-2" => 190.4,//天津 2
+        "4-30-29" => 28.56, "4-50-29" => 47.6, "4-100-29" => 95.2, "4-200-29" => 190.4,//青海 29
+
+        //电信
+        "6-30-18" => 27.69, "6-50-18" => 46.15, "6-100-18" => 92.3, "6-200-18" => 184.6,//湖南 18
+        "6-30-23" => 27.24, "6-50-23" => 45.4, "6-100-23" => 90.8, "6-200-23" => 181.6,//四川 23
+        "6-30-15" => 27.69, "6-50-15" => 46.15, "6-100-15" => 92.3, "6-200-15" => 184.6,//山东 15
+        "6-30-2" => 27.75, "6-50-2" => 46.25, "6-100-2" => 92.5, "6-200-2" => 185,//天津 2
+        "6-30-3" => 28.26, "6-50-3" => 47.1, "6-100-3" => 94.2, "6-200-3" => 188.4,//河北 3
+        "6-30-30" => 28.26, "6-50-30" => 47.1, "6-100-30" => 94.2, "6-200-30" => 188.4,//宁夏 30
+        "6-30-29" => 27.84, "6-50-29" => 46.4, "6-100-29" => 92.8, "6-200-29" => 185.6,//青海 29
+        "6-30-17" => 28.2, "6-50-17" => 47, "6-100-17" => 94, "6-200-17" => 188,//湖北 17
+    ];
+}

+ 4 - 0
mobile/callback/refill_menshang.php

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

+ 4 - 0
mobile/callback/refill_menshang_fs.php

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

+ 4 - 0
mobile/callback/refill_menshang_sec.php

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

+ 23 - 0
test/TestRefill.php

@@ -5957,6 +5957,29 @@ class TestRefill extends TestCase
     {
         $provider = $this->getProvider('xingchuang_trd');
         $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang_sec()
+    {
+        $provider = $this->getProvider('menshang_sec');
+        $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang()
+    {
+        $provider = $this->getProvider('menshang');
+        $resp = $provider->balance();
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
+    }
+
+    public function testmenshang_fs()
+    {
+        $provider = $this->getProvider('menshang_fs');
+        $resp = $provider->balance();
+//        $resp = $provider->add(15811535608, 6, 30, ['order_sn' => $this->make_sn(), 'regin_no' => 3]);
+        $resp = $provider->query(['order_sn' => '56641701227303096134']);
     }
 
 }