Ver código fonte

Merge branch 'rch' into raccount

stanley-king 1 ano atrás
pai
commit
9aad872d96

+ 69 - 23
data/config/xyz/refill.ini.php

@@ -10065,35 +10065,80 @@ $beirui_sec_phone = ['name' => 'beirui_sec', 'store_id' => 382, 'qualitys' => '1
 //        ]
     ],
     'official_sn' => true, 'refill_type' => 'api'];
-//
-//$beirui_trd_phone = ['name' => 'beirui_trd', 'store_id' => 383, 'qualitys' => '1',
-//    'amount' => [
-////        10 => [
-////            ['goods_id' => 9001, 'price' => 9.68, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ],
-////        20 => [
-////            ['goods_id' => 9002, 'price' => 19.36, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ],
-////        30 => [
-////            ['goods_id' => 9003, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ],
-////        50 => [
-////            ['goods_id' => 9004, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ],
+
+$beirui_trd_phone = ['name' => 'beirui_trd', 'store_id' => 383, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 9001, 'price' => 9.68, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ],
+//        20 => [
+//            ['goods_id' => 9002, 'price' => 19.36, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ],
+//        30 => [
+//            ['goods_id' => 9003, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ],
+//        50 => [
+//            ['goods_id' => 9004, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ],
 //        100 => [
 //            ['goods_id' => 9005, 'price' => 96.5, 'quality' => 1, 'card_type' => 'chinamobile'],
 //        ],
 //        200 => [
 //            ['goods_id' => 9006, 'price' => 193, 'quality' => 1, 'card_type' => 'chinamobile'],
 //        ],
-////        300 => [
-////            ['goods_id' => 9007, 'price' => 290.4, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ],
-////        500 => [
-////            ['goods_id' => 9008, 'price' => 484, 'quality' => 1, 'card_type' => 'chinamobile'],
-////        ]
-//    ],
-//    'official_sn' => true, 'refill_type' => 'api'];
+//        300 => [
+//            ['goods_id' => 9007, 'price' => 290.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ],
+//        500 => [
+//            ['goods_id' => 9008, 'price' => 484, 'quality' => 1, 'card_type' => 'chinamobile'],
+//        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
+$weisanhuo_phone = ['name' => 'weisanhuo', 'store_id' => 384, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 9009, 'price' => 9.68, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9009, 'price' => 9.4, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9009, 'price' => 9.57, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 9010, 'price' => 19.36, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9010, 'price' => 18.8, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9010, 'price' => 19.14, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        30 => [
+//            ['goods_id' => 9011, 'price' => 29.04, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9011, 'price' => 28.2, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9011, 'price' => 28.71, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        50 => [
+//            ['goods_id' => 9012, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9012, 'price' => 47, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9012, 'price' => 47.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        100 => [
+            ['goods_id' => 9013, 'price' => 95.2, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9013, 'price' => 94, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9013, 'price' => 95, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 9014, 'price' => 190.4, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9014, 'price' => 188, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9014, 'price' => 190, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 9015, 'price' => 285.6, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9015, 'price' => 282, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9015, 'price' => 287.1, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 9016, 'price' => 476, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 9016, 'price' => 470, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 9016, 'price' => 478.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
 
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_p hone],
@@ -10399,6 +10444,7 @@ $phone_providers = [
     ['name' => 'miaoxt_tax_seco', 'cfg' => $miaoxt_tax_seco_phone],
     ['name' => 'beirui_sec', 'cfg' => $beirui_sec_phone],
 //    ['name' => 'beirui_trd', 'cfg' => $beirui_trd_phone],
+        ['name' => 'weisanhuo', 'cfg' => $weisanhuo_phone],
 ];
 $config['phone_providers'] = $phone_providers;
 

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

@@ -7896,6 +7896,51 @@ $beirui_trd_phone = ['name' => 'beirui_trd', 'store_id' => 306, 'qualitys' => '1
     ],
     'official_sn' => true, 'refill_type' => 'api'];
 
+$yezipczy_phone = ['name' => 'yezipczy', 'store_id' => 307, 'qualitys' => '1',
+    'amount' => [
+//        10 => [
+//            ['goods_id' => 8466, 'price' => 10.025, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8466, 'price' => 10.05, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8466, 'price' => 10.17, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+//        20 => [
+//            ['goods_id' => 8468, 'price' => 20.05, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8468, 'price' => 20.1, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8468, 'price' => 20.34, 'quality' => 1, 'card_type' => 'chinatelecom']
+//        ],
+        30 => [
+            ['goods_id' => 8469, 'price' => 30, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8469, 'price' => 30.03, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8469, 'price' => 30.51, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        50 => [
+            ['goods_id' => 8470, 'price' => 50, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8470, 'price' => 50, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8470, 'price' => 50, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        100 => [
+            ['goods_id' => 8471, 'price' => 100, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8471, 'price' => 100, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8471, 'price' => 100, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        200 => [
+            ['goods_id' => 8472, 'price' => 200, 'quality' => 1, 'card_type' => 'chinamobile'],
+            ['goods_id' => 8472, 'price' => 200, 'quality' => 1, 'card_type' => 'chinaunicom'],
+            ['goods_id' => 8472, 'price' => 200, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        300 => [
+            ['goods_id' => 8473, 'price' => 300, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8473, 'price' => 300.3, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8473, 'price' => 300.3, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ],
+        500 => [
+            ['goods_id' => 8474, 'price' => 500, 'quality' => 1, 'card_type' => 'chinamobile'],
+//            ['goods_id' => 8474, 'price' => 500.5, 'quality' => 1, 'card_type' => 'chinaunicom'],
+//            ['goods_id' => 8474, 'price' => 500.5, 'quality' => 1, 'card_type' => 'chinatelecom']
+        ]
+    ],
+    'official_sn' => true, 'refill_type' => 'api'];
+
 $phone_providers = [
 //    ['name' => 'beixt', 'cfg' => $beixt_phone],
 //    ['name' => 'bxtwt', 'cfg' => $bxtwt_phone],
@@ -8149,6 +8194,7 @@ $phone_providers = [
     ['name' => 'miaoxt_tax_sec', 'cfg' => $miaoxt_tax_sec_phone],
     ['name' => 'liantuo_nation_trd', 'cfg' => $liantuo_nation_trd_phone],
     ['name' => 'beirui_trd', 'cfg' => $beirui_trd_phone],
+    ['name' => 'yezipczy', 'cfg' => $yezipczy_phone],
 ];
 
 $config['phone_providers'] = $phone_providers;

+ 34 - 0
helper/refill/api/xyz/weisanhuo/API.MD

@@ -0,0 +1,34 @@
+
+## 微三活 普充
+
+### 账号:
+- 用户名:bjfqs
+- 密码:bjfqs@2023
+- 密钥ID(secretId):231c9717118f4413b1611a3a87221795
+- 密钥值(secretKey):0109d2f30b414832a0f1e8c29720eff3
+### 后台地址:
+> http://124.70.69.117:50080
+
+## 店铺
+- 账号:weisanhuo
+- 密码:weisanhuo67890
+
+### 编码
+序号 商品名称 商品代码 面值 商品类型 品牌
+1 全国电信200元 k-dx-200 200 元 手机话费 电信
+2 全国电信100元 k-dx-100 100 元 手机话费 电信
+3 全国电信50元 k-dx-50 50 元 手机话费 电信
+4 全国电信30元 k-dx-30 30 元 手机话费 电信
+5 全国移动500元 k-yd-500 500 元 手机话费 移动
+6 全国移动300元 k-yd-300 300 元 手机话费 移动
+7 全国移动200元 k-yd-200 200 元 手机话费 移动
+8 全国移动100元 k-yd-100 100 元 手机话费 移动
+9 全国移动50元 k-yd-50 50 元 手机话费 移动
+10 全国移动30元 k-yd-30 30 元 手机话费 移动
+11 全国联通200元 k-lt-200 200 元 手机话费 联通
+12 全国联通100元 k-lt-100 100 元 手机话费 联通
+13 全国联通50元 k-lt-50 50 元 手机话费 联通
+14 全国联通30元 k-lt-30 30 元 手机话费 联通
+
+### 测试代码
+- cshf1

+ 40 - 0
helper/refill/api/xyz/weisanhuo/RefillCallBack.php

@@ -0,0 +1,40 @@
+<?php
+namespace refill\weisanhuo;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weisanhuo/config.php');
+
+use refill;
+
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $sign = config::sign($params, ['sign']);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public function notify($params): array
+    {
+        $status = $params['status'];
+        $order_sn = $params['outTradeNo'];
+        $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+
+        $order_id = $order_info['order_id'];
+        if ($status == 'success') {
+            $official_sn = $params['inTradeNo'];
+            Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $params['orderId']]);
+            return [$order_id, true, false, true, $official_sn];
+        } elseif ($status == 'failed') {
+            return [$order_id, false, true, true, ''];
+        } else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 153 - 0
helper/refill/api/xyz/weisanhuo/RefillPhone.php

@@ -0,0 +1,153 @@
+<?php
+
+namespace refill\weisanhuo;
+
+require_once(BASE_HELPER_RAPI_PATH . '/weisanhuo/config.php');
+
+use refill;
+use Log;
+
+class RefillPhone extends refill\IRefillPhone
+{
+    public function __construct($cfgs)
+    {
+        parent::__construct($cfgs);
+    }
+
+    private function req_params(int $card_no, int $card_type, string $order_sn, int $amount): array
+    {
+        $params['outTradeNo'] = $order_sn;
+        $params['secretId'] = config::SECRET_ID;
+        $params['account'] = $card_no;
+
+        $product_id = config::ProductIdS[$card_type][$amount] ?? false;
+        if ($product_id === false){
+            return [];
+        }
+        $params['packageCode'] = $product_id;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $params = $this->req_params($card_no, $card_type, $params['order_sn'], $amount);
+        if (empty($params)){
+            return [false, '产品编码错误', false];
+        }
+
+        $sign = config::sign($params,['outTradeNo']);
+        $params['sign'] = $sign;
+
+        $params = json_encode($params);
+        $resp = http_post_data(config::ORDER_URL, $params , config::ExtHeaders, $net_errno);
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+
+            $resp = json_decode($resp ,true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            }
+            if ($resp['success'] === false){
+                return [false, $resp['returnMessage'], false];
+            }
+
+            $status = $resp['data']['status'];
+            if ($status == 'waiting') {
+                return [true, $resp['data']['inTradeNo'], false];
+            } else {
+                return [false, $resp['data']['statusDesc'], false];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['secretId'] = config::SECRET_ID;
+
+        if(!empty($refill_info['ch_trade_no'])) {
+            $params['inTradeNo'] = $refill_info['ch_trade_no'];
+            $sign = config::sign($params, ['inTradeNo']);
+            $commit_check = false;
+        }
+        else {
+            $params['outTradeNo'] = $refill_info['order_sn'];
+            $sign = config::sign($params, ['outTradeNo']);
+            $commit_check = true;
+        }
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::QUERY_URL, $params, 'GET');
+        if (empty($resp)) {
+            return [false, '网络错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+
+            $resp = json_decode($resp, true);
+            if (empty($resp))
+            {
+                return [false, '网络错误', ''];
+            }
+            elseif ($resp['success'] === true)
+            {
+                $offical_sn = '';
+
+                if(!empty($resp['data']))
+                {
+                    $status = $resp['data']['status'];
+                    if ($status == 'success') {
+                        $offical_sn = $resp['data']['inTradeNo'];
+                        Model('refill_order')->edit($refill_info['order_id'], ['official_sn' => $offical_sn]);
+                        $order_state = ORDER_STATE_SUCCESS;
+                    } elseif ($status == 'failed') {
+                        $order_state = ORDER_STATE_CANCEL;
+                    } elseif ($status == 'waiting') {
+                        $order_state = ORDER_STATE_SEND;
+                    } else {
+                        return [false, $status, $offical_sn];
+                    }
+
+                    return [true, $order_state, $offical_sn];
+                }
+                elseif ((time() - $refill_info['commit_time']) >= 600) {
+                    return [true, ORDER_STATE_NOEXIST, $offical_sn];
+                }
+                else {
+                    return [true, ORDER_STATE_SEND, $offical_sn];
+                }
+            }
+            else
+            {
+                return [false, $resp['returnMessage'], ''];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['secretId'] = config::SECRET_ID;
+
+        $sign = config::sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::BALANCE_URL, $params, 'GET');
+
+        if (empty($resp)) {
+            return [false, '网络错误'];
+        } else {
+            Log::record($resp, Log::DEBUG);
+
+            $resp = json_decode($resp, true);
+            if ($resp['success'] === true) {
+                return [true, $resp['data']];
+            } else {
+                return [false, $resp['returnMessage']];
+            }
+        }
+    }
+}

BIN
helper/refill/api/xyz/weisanhuo/code.xlsx


+ 70 - 0
helper/refill/api/xyz/weisanhuo/config.php

@@ -0,0 +1,70 @@
+<?php
+namespace refill\weisanhuo;
+
+use mtopcard;
+class config
+{
+    const ORDER_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/single';
+    const QUERY_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/report/query';
+    const BALANCE_URL = 'http://124.70.69.117:50050/api/v1/rest/multi/charge/balance';
+
+    const SECRET_ID = '231c9717118f4413b1611a3a87221795';
+    const SECRET_KEY = '0109d2f30b414832a0f1e8c29720eff3';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_weisanhuo.php";
+    const ExtHeaders = ['Content-Type: application/json;charset=UTF-8'];
+
+    const ProductIdS = [
+        mtopcard\ChinaMobileCard =>
+            [
+                30 => 'k-yd-30',
+                50 => 'k-yd-50',
+                100 => 'k-yd-100',
+                200 => 'k-yd-200',
+                300 => 'k-yd-300',
+                500 => 'k-yd-500'
+            ],
+        mtopcard\ChinaUnicomCard =>
+            [
+                30 => 'k-lt-30',
+                50 => 'k-lt-50',
+                100 => 'k-lt-100',
+                200 => 'k-lt-200'
+            ],
+        mtopcard\ChinaTelecomCard =>
+            [
+                30 => 'k-dx-30',
+                50 => 'k-dx-50',
+                100 => 'k-dx-100',
+                200 => 'k-dx-200'
+            ]
+    ];
+
+    public static function sign(array $params, array $ignore = []): string
+    {
+        ksort($params);
+        $content = '';
+        foreach ($params as $key => $value) {
+            if (in_array($key, $ignore)) {
+                continue;
+            }
+
+            if(self::check_empty($value) === false) {
+                $key = strtolower($key);
+                $value = urlencode($value);
+                $content .= "$key=$value&";
+            }
+        }
+        $content .= "secretkey=" . config::SECRET_KEY;
+        return md5($content);
+    }
+
+    public static function check_empty($value): bool
+    {
+        if (!isset($value))
+            return true;
+        if (trim($value) === "null")
+            return true;
+
+        return false;
+    }
+}

BIN
helper/refill/api/xyz/weisanhuo/help.doc


+ 14 - 0
helper/refill/api/yl/yezipczy/API.MD

@@ -0,0 +1,14 @@
+### 椰子普充专用
+- 接口地址:https://admin.xyzshops.cn/merchant/#/login
+
+### 机构账号
+- yezipczy
+- dfsc_783x
+- 10496
+
+### 店铺账号
+- yezipczy
+- yezipczy67890
+- 
+### 密钥
+b701a31d53d9bd0776cf98423cde87e1

+ 76 - 0
helper/refill/api/yl/yezipczy/RefillCallBack.php

@@ -0,0 +1,76 @@
+<?php
+namespace refill\yezipczy;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yezipczy/config.php');
+use refill;
+class RefillCallBack implements refill\IRefillCallBack
+{
+    public function verify($params): bool
+    {
+        $input = $params;
+        unset($input['sign']);
+        $sign = $this->sign($input);
+        if ($params['sign'] == $sign) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    protected function check_empty($value): bool
+    {
+        if (!isset($value))
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($params): string
+    {
+        ksort($params);
+
+        $body = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+                if ($i == 0) {
+                    $body .= "{$k}" . "=" . urlencode($v);
+                } else {
+                    $body .= "&" . "{$k}" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        $body .= "&key=".config::KEY;
+        return md5($body);
+    }
+
+    public function notify($params): array
+    {
+        $status = $params['state'];
+        $order_sn = $params['order_sn'];
+        $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
+        if (empty($order_info)) {
+            return [false, false, false, false, ''];
+        }
+        $official_sn = strtolower($params['official_sn']) == 'null' ? '' : $params['official_sn'];
+
+        $order_id = $order_info['order_id'];
+        if ($status === 'SUCCESS') {
+            $data['ch_trade_no'] = $params['trade_no'];
+            $data['official_sn'] = $official_sn;
+            Model('refill_order')->edit($order_id, $data);
+            return [$order_id, true, false, true, $official_sn];
+        }
+        elseif ($status === 'CANCEL') {
+            Model('refill_order')->edit($order_id, ['ch_trade_no' => $params['trade_no']]);
+            return [$order_id, false, true, true, ''];
+        }
+        else {
+            return [$order_id, false, false, false, ''];
+        }
+    }
+}

+ 161 - 0
helper/refill/api/yl/yezipczy/RefillPhone.php

@@ -0,0 +1,161 @@
+<?php
+
+namespace refill\yezipczy;
+
+require_once(BASE_HELPER_RAPI_PATH . '/yezipczy/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, string $order_sn): array
+    {
+        $params['act'] = 'refill';
+        $params['op'] = 'add';
+        $params['mchid'] = config::MCH_ID;
+        $params['cardno'] = $phone;
+        $params['amount'] = $amount;
+        $params['order_sn'] = $order_sn;
+        $params['notifyurl'] = config::NOTIFY_URL;
+        return $params;
+    }
+
+    public function add($card_no, $card_type, $amount, $params, &$net_errno = 0): array
+    {
+        $params = $this->req_params($card_no, $amount, $params['order_sn']);
+        $sign = $this->sign($params);
+        $params['sign'] = $sign;
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST' , false , [] , $net_errno);
+
+        if (empty($resp)) {
+            return [false, '系统错误', true];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp ,true);
+            if (empty($resp)) {
+                return [false, '系统错误', true];
+            } elseif ($resp['code'] === 200) {
+                return [true, '', false];
+            } else {
+                return [false, $resp['message'], false];
+            }
+        }
+    }
+
+    public function query($refill_info): array
+    {
+        $params['act'] = 'refill';
+        $params['op'] = 'query';
+        $params['mchid'] = config::MCH_ID;
+        $params['order_sn'] = $refill_info['order_sn'];
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST');
+        if (empty($resp)) {
+            return [false, '系统错误', ''];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误', ''];
+            }
+            elseif ($resp['code'] === 200)
+            {
+                $official_sn = strtolower($resp['official_sn']) == 'null' ? '' : $resp['official_sn'];
+
+                $data = $resp['datas'];
+                if ($data['order_state'] == '40') {
+                    $save['ch_trade_no'] = $data['trade_no'];
+                    $save['official_sn'] = $official_sn;
+                    Model('refill_order')->edit($refill_info['order_id'], $save);
+                    $order_state = ORDER_STATE_SUCCESS;
+                } elseif ($data['order_state'] === '0') {
+                    Model('refill_order')->edit($refill_info['order_id'], ['ch_trade_no' => $data['trade_no']]);
+                    $order_state = ORDER_STATE_CANCEL;
+                } elseif (in_array($data['order_state'], ['10', '20', '30', '50'], true)) {
+                    $order_state = ORDER_STATE_SEND;
+                } else {
+                    return [false, $resp['message'], ''];
+                }
+                return [true, $order_state, $official_sn];
+            }
+            elseif ($resp['code'] === 202 && (time() - $refill_info['commit_time'] >= 600))
+            {
+                return [true, ORDER_STATE_NOEXIST, ''];
+            }
+            else
+            {
+                return [false, $resp['message'], ''];
+            }
+        }
+    }
+
+    public function balance(): array
+    {
+        $params['act'] = 'refill';
+        $params['op'] = 'balance';
+        $params['mchid'] = config::MCH_ID;
+        $params['sign'] = $this->sign($params);
+
+        $resp = http_request(config::ORDER_URL, $params , 'POST');
+
+        if (empty($resp)) {
+            return [false, '系统错误'];
+        }
+        else
+        {
+            Log::record($resp, Log::DEBUG);
+            $resp = json_decode($resp, true);
+            if (empty($resp)) {
+                return [false, '系统错误'];
+            } elseif ($resp['code'] === 200) {
+                return [true, ncPriceFormat($resp['datas']['balance'])];
+            } else {
+                return [false, $resp['message']];
+            }
+        }
+    }
+
+    protected function check_empty($value): bool
+    {
+        if (!isset($value))
+            return true;
+        if (trim($value) === "")
+            return true;
+
+        return false;
+    }
+
+    private function sign($params): string
+    {
+        ksort($params);
+
+        $body = "";
+        $i = 0;
+        foreach ($params as $k => $v) {
+            if (false === $this->check_empty($v) && "@" != substr($v, 0, 1)) {
+                if ($i == 0) {
+                    $body .= "{$k}" . "=" . urlencode($v);
+                } else {
+                    $body .= "&" . "{$k}" . "=" . urlencode($v);
+                }
+                $i++;
+            }
+        }
+
+        $body .= "&key=".config::KEY;
+
+        return md5($body);
+    }
+}

+ 13 - 0
helper/refill/api/yl/yezipczy/config.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace refill\yezipczy;
+
+class config
+{
+    const ORDER_URL = 'https://www.xyzshops.cn/mobile/index.php';
+
+    const MCH_ID = 10496;
+    const KEY = 'b701a31d53d9bd0776cf98423cde87e1';
+    const NOTIFY_URL = BASE_SITE_URL . "/mobile/callback/refill_yezipczy.php";
+
+}

+ 6 - 0
mobile/callback/refill_weisanhuo.php

@@ -0,0 +1,6 @@
+<?php
+$content = $_SERVER['post_content'] ?? [];
+$input = json_decode($content,true);
+refill\util::push_notify('weisanhuo',$input);
+
+echo ('success');

+ 4 - 0
mobile/callback/refill_yezipczy.php

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

+ 15 - 0
test/TestRefill.php

@@ -5808,6 +5808,21 @@ class TestRefill extends TestCase
         $provider = $this->getProvider('beirui_trd');
         $resp = $provider->balance();
     }
+
+    public function testweisanhuo()
+    {
+        $provider = $this->getProvider('weisanhuo');
+//        $resp = $provider->balance();
+//        $resp = $provider->add(13699279618, 4, 50, ['order_sn' => $this->make_sn()]);
+        $resp = $provider->query(['order_sn' => '24271700815859899563']);
+
+        $post = '{"operatorTradeNo":"","statusDesc":"交易成功","phone":"18780103116","outTradeNo":"202309250000000006","sign":"d793406757c1bb920fe518e9673a28ea","inTradeNo":"202309251766523539","status":"success","reportTime":"1695607732705"}';
+        $data = json_decode($post, true);
+        $provider = $this->getProvider('weisanhuo', 'RefillCallBack');
+
+        $ret = $provider->verify($data);
+//        $resp = $provider->notify($data);
+    }
 }