Browse Source

chore: remove coinpay & optimize user index

Cat 3 years ago
parent
commit
5d60d4f6aa

+ 0 - 8
app/routes.php

@@ -99,9 +99,6 @@ return function (SlimApp $app): void {
         // getUserAllURL
         $this->get('/getUserAllURL', App\Controllers\UserController::class . ':getUserAllURL');
 
-        // getPcClient
-        $this->get('/getPcClient', App\Controllers\UserController::class . ':getPcClient');
-
         //Reconstructed Payment System
         $this->post('/payment/purchase/{type}', App\Services\Payment::class . ':purchase');
         $this->get('/payment/purchase/{type}', App\Services\Payment::class . ':purchase');
@@ -112,7 +109,6 @@ return function (SlimApp $app): void {
         $this->get('/notify/{type}', App\Services\Payment::class . ':notify');
         $this->post('/notify/{type}', App\Services\Payment::class . ':notify');
         $this->post('/status/{type}', App\Services\Payment::class . ':getStatus');
-        // $this->post('/coinpay/notify',  App\Services\CoinPayment::class. ':notify');
     });
 
     // Auth
@@ -311,8 +307,4 @@ return function (SlimApp $app): void {
     $app->group('/sub', function (): void {
         $this->get('/{token}/{subtype}', App\Controllers\SubController::class . ':getContent');
     });
-
-    $app->group('/getClient', function (): void {
-        $this->get('/{token}', App\Controllers\UserController::class . ':getClientfromToken');
-    });
 };

+ 0 - 74
config/.config.example.php

@@ -238,80 +238,6 @@ $_ENV['display_ios_topup']    = 0;         //满足等级要求后,累计充
 $_ENV['ios_account']          = '';        //iOS账户
 $_ENV['ios_password']         = '';        //iOS密码
 
-#用户中心首页添加其他客户端的支持,可配合 subconverter 等 Api
-$_ENV['userCenterClient']     = [
-    'iOS'     => [
-        [
-            'name'           => 'Loon',
-            'support'        => 'SS/SSR/VMess',
-            'download_urls'  => [
-                [
-                    'name' => '本站下载',
-                    'url'  => 'https://google.com',
-                ],
-                [
-                    'name' => '官方下载',
-                    'url'  => 'https://baidu.com',
-                ]
-            ],
-            'tutorial_url'   => '/doc/#/iOS/Loon',
-            'description'    => '其他说明.',
-            'subscribe_urls' => [
-                [
-                    'name' => 'SS 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=2',
-                ],
-                [
-                    'name' => 'SSR 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=1',
-                ],
-                [
-                    'name' => 'V2Ray 订阅',
-                    'type' => 'copy',
-                    'url'  => '%userUrl%?sub=3',
-                ]
-            ]
-        ]
-    ],
-    'macOS'   => [],
-    'Linux'   => [],
-    'Router'  => [],
-    'Android' => [],
-    'Windows' => [
-        [
-            'name'           => 'Netch',
-            'support'        => 'SS/SSR/VMess',
-            'download_urls'  => [
-                [
-                    'name' => '官方下载',
-                    'url'  => 'https://github.com/NetchX/Netch/releases',
-                ]
-            ],
-            'tutorial_url'   => '/doc/#/Windows/Netch',
-            'description'    => '其他说明.',
-            'subscribe_urls' => [
-                [
-                    'name' => 'SS 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=2',
-                ],
-                [
-                    'name' => 'SSR 订阅',
-                    'type' => 'href',
-                    'url'  => '%userUrl%?sub=1',
-                ],
-                [
-                    'name' => 'V2Ray 订阅',
-                    'type' => 'copy',
-                    'url'  => '%userUrl%?sub=3',
-                ]
-            ]
-        ]
-    ]
-];
-
 //节点检测-----------------------------------------------------------------------------------------------
 #GFW检测,请通过crontab进行【开启/关闭】
 $_ENV['detect_gfw_interval']             = 3600;                                                               //检测间隔,单位:秒,低于推荐值会爆炸

+ 0 - 20
config/settings.json

@@ -499,26 +499,6 @@
         "default": "",
         "mark": "theadpay_key"
     },
-    {
-        "id": null,
-        "item": "coinpay_appid",
-        "value": "",
-        "class": "coinpay",
-        "is_public": 0,
-        "type": "string",
-        "default": "",
-        "mark": "CoinPay应用ID"
-    },
-    {
-        "id": null,
-        "item": "coinpay_secret",
-        "value": "",
-        "class": "coinpay",
-        "is_public": 0,
-        "type": "string",
-        "default": "",
-        "mark": "CoinPay验证密钥"
-    },
     {
         "id": null,
         "item": "user_center_bg",

+ 0 - 1
phpinsights.php

@@ -47,7 +47,6 @@ return [
         'storage',
 
         // TODO: mute legacy contents error
-        'src/Services/Gateway/CoinPay/CoinPayDataBase.php',
         'src/Services/Gateway/Epay',
         'src/Services/Mail.php',
         'src/Services/Password.php',

+ 0 - 1
resources/clients/README.txt

@@ -1 +0,0 @@
-请将已解压的客户端存放在对应文件夹中

+ 0 - 3
resources/clients/ss-win/使用注意.txt

@@ -1,3 +0,0 @@
-尊敬的用户您好:
-
-    如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

+ 0 - 3
resources/clients/ssr-win/使用注意.txt

@@ -1,3 +0,0 @@
-尊敬的用户您好:
-
-    如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

+ 0 - 3
resources/clients/v2rayn-win/使用注意.txt

@@ -1,3 +0,0 @@
-尊敬的用户您好:
-
-    如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

+ 0 - 45
resources/views/material/admin/setting.tpl

@@ -273,22 +273,6 @@
 
                                         <button id="submit_payment" type="submit" class="btn btn-block btn-brand">提交</button>
                                     </div>
-                                    
-                                    <div class="tab-pane fade" id="coinpay">
-                                        <p class="form-control-guide"><i class="material-icons">info</i>此处申请: <a href="https://www.coinpayapp.com" target="view_window">https://www.coinpayapp.com</a></p>
-                                        <!-- coinpay_appid -->
-                                        <div class="form-group form-group-label">
-                                            <label class="floating-label">CoinPay应用ID</label>
-                                            <input class="form-control maxwidth-edit" id="coinpay_appid" value="{$settings['coinpay_appid']}">
-                                        </div>
-                                        <!-- coinpay_secret -->
-                                        <div class="form-group form-group-label">
-                                            <label class="floating-label">CoinPay验证密钥</label>
-                                            <input class="form-control maxwidth-edit" id="coinpay_secret" value="{$settings['coinpay_secret']}">
-                                        </div>
-
-                                        <button id="submit_coinpay" type="submit" class="btn btn-block btn-brand">提交</button>
-                                    </div>
 
                                     <div class="tab-pane fade" id="payjs">
                                         <p class="form-control-guide"><i class="material-icons">info</i>此处申请: <a href="https://payjs.cn" target="view_window">https://payjs.cn</a></p>
@@ -1693,35 +1677,6 @@
     })
 </script>
 
-<script>
-    window.addEventListener('load', () => {
-        $$.getElementById('submit_coinpay').addEventListener('click', () => {
-            $.ajax({
-                type: "POST",
-                url: "/admin/setting",
-                dataType: "json",
-                data: {
-                    class: 'coinpay',
-                    coinpay_appid: $$getValue('coinpay_appid'),
-                    coinpay_secret: $$getValue('coinpay_secret')
-                },
-                success: data => {
-                    $("#result").modal();
-                    $$.getElementById('msg').innerHTML = data.msg;
-                    if (data.ret) {
-                        window.setTimeout("location.href='/admin/setting'", {$config['jump_delay']});
-                    }
-                },
-                error: jqXHR => {
-                    alert(`发生错误:${
-                            jqXHR.status
-                            }`);
-                }
-            })
-        })
-    })
-</script>
-
 <script>
     window.addEventListener('load', () => {
         $$.getElementById('submit_custom_background_image').addEventListener('click', () => {

+ 0 - 61
resources/views/material/user/index.tpl

@@ -345,37 +345,6 @@
                                                     </li>
                                                 </ul>
                                             </nav>
-                                            {function name=printClient items=null}
-                                                {foreach $items as $item}
-                                                    <hr/>
-                                                    <p><span class="icon icon-lg text-white">filter_9_plus</span> {$item['name']} - [ {$item['support']} ]:</p>
-                                                    <p>
-                                                        应用下载:
-                                                        {foreach $item['download_urls'] as $download_url}
-                                                        {if !$download_url@first}.{/if}
-                                                        <a class="btn-dl" href="{$download_url['url']}"><i class="material-icons icon-sm">cloud_download</i> {$download_url['name']}</a>
-                                                        {/foreach}
-                                                    </p>
-                                                    {if isset($item['description'])}
-                                                    <p>
-                                                        相关说明:
-                                                        {$item['description']}
-                                                    </p>
-                                                    {/if}
-                                                    <p>
-                                                        使用方式:
-                                                        {foreach $item['subscribe_urls'] as $subscribe_url}
-                                                        {if !$subscribe_url@first}.{/if}
-                                                        {$url=$subscribe_url['url']|replace:'%userUrl%':$subInfo['link']}
-                                                        {if $subscribe_url['type'] == 'href'}
-                                                        <a class="btn-dl" href="{$url}"><i class="material-icons icon-sm">send</i> {$subscribe_url['name']}</a>
-                                                        {else}
-                                                        <a class="copy-text btn-dl" data-clipboard-text="{$url}"><i class="material-icons icon-sm">send</i> {$subscribe_url['name']}</a>
-                                                        {/if}
-                                                        {/foreach}
-                                                    </p>
-                                                {/foreach}
-                                            {/function}
                                             <div class="tab-pane fade active in" id="sub_center_universal_subscription">
                                                 <p>此处为通用订阅,适用于多种应用的订阅。</p>
                                                 <hr/>
@@ -459,11 +428,6 @@
                                                         <a class="btn-dl" href="clash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('Windows',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Windows']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Windows']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_mac">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Surge - [ SS/VMess ]:</p>
@@ -522,11 +486,6 @@
                                                         <a class="btn-dl" href="clash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('macOS',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['macOS']) != 0}
-                                                    {printClient items=$config['userCenterClient']['macOS']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_ios">
                                             {if $display_ios_class>=0}
@@ -610,11 +569,6 @@
                                                         <a class="btn-dl" href="stash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('iOS',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['iOS']) != 0}
-                                                    {printClient items=$config['userCenterClient']['iOS']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_android">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> SS - [ SS ]:</p>
@@ -665,11 +619,6 @@
                                                         <a class="btn-dl" href="clash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('Android',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Android']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Android']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_linux">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Clash for Windows - [ SS/VMess/Trojan ]:</p>
@@ -686,11 +635,6 @@
                                                         <a class="btn-dl" href="clash://install-config?url={urlencode($subInfo['clash'])}"><i class="material-icons icon-sm">send</i> 配置一键导入</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('Linux',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Linux']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Linux']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                             <div class="tab-pane fade" id="sub_center_router">
                                                 <p><span class="icon icon-lg text-white">filter_1</span> Koolshare 固件路由器/软路由:</p>
@@ -699,11 +643,6 @@
                                                         <a class="btn-dl" href="https://github.com/hq450/fancyss_history_package"><i class="material-icons icon-sm">cloud_download</i> FancySS 下载页面</a>
                                                     </p>
                                                 <hr/>
-                                            {if array_key_exists('Router',$config['userCenterClient'])}
-                                                {if count($config['userCenterClient']['Router']) != 0}
-                                                    {printClient items=$config['userCenterClient']['Router']}
-                                                {/if}
-                                            {/if}
                                             </div>
                                         </div>
                                     </div>

+ 0 - 3
src/Controllers/Admin/SettingController.php

@@ -52,9 +52,6 @@ final class SettingController extends BaseController
             case 'theadpay':
                 $list = ['theadpay_url', 'theadpay_mchid', 'theadpay_key'];
                 break;
-            case 'coinpay':
-                $list = ['coinpay_appid', 'coinpay_secret'];
-                break;
             case 'paymentwall':
                 $list = ['pmw_publickey', 'pmw_privatekey', 'pmw_widget', 'pmw_height'];
                 break;

+ 0 - 73
src/Controllers/UserController.php

@@ -25,7 +25,6 @@ use App\Services\Captcha;
 use App\Services\Config;
 use App\Services\Payment;
 use App\Utils\Check;
-use App\Utils\ClientProfiles;
 use App\Utils\Cookie;
 use App\Utils\DatatablesHelper;
 use App\Utils\GA;
@@ -1196,76 +1195,4 @@ final class UserController extends BaseController
             ->registerClass('Tools', Tools::class)
             ->fetch('user/subscribe_log.tpl');
     }
-
-    /**
-     * 获取包含订阅信息的客户端压缩档,PHP 需安装 zip 扩展
-     *
-     * @param array    $args
-     */
-    public function getPcClient(Request $request, Response $response, array $args)
-    {
-        $zipArc = new \ZipArchive();
-        $user_token = LinkController::generateSSRSubCode($this->user->id);
-        $type = trim($request->getQueryParams()['type']);
-        // 临时文件存放路径
-        $temp_file_path = BASE_PATH . '/storage/';
-        // 客户端文件存放路径
-        $client_path = BASE_PATH . '/resources/clients/';
-        switch ($type) {
-            case 'ss-win':
-                $user_config_file_name = 'gui-config.json';
-                $content = ClientProfiles::getSSPcConf($this->user);
-                break;
-            case 'ssr-win':
-                $user_config_file_name = 'gui-config.json';
-                $content = ClientProfiles::getSSRPcConf($this->user);
-                break;
-            case 'v2rayn-win':
-                $user_config_file_name = 'guiNConfig.json';
-                $content = ClientProfiles::getV2RayNPcConf($this->user);
-                break;
-            default:
-                return 'gg';
-        }
-        $temp_file_path .= $type . '_' . $user_token . '.zip';
-        $client_path .= $type . '/';
-        // 文件存在则先删除
-        if (is_file($temp_file_path)) {
-            unlink($temp_file_path);
-        }
-        // 超链接文件内容
-        $site_url_content = '[InternetShortcut]' . PHP_EOL . 'URL=' . $_ENV['baseUrl'];
-        // 创建 zip 并添加内容
-        $zipArc->open($temp_file_path, \ZipArchive::CREATE);
-        $zipArc->addFromString($user_config_file_name, $content);
-        $zipArc->addFromString('点击访问_' . $_ENV['appName'] . '.url', $site_url_content);
-        Tools::folderToZip($client_path, $zipArc, strlen($client_path));
-        $zipArc->close();
-
-        $newResponse = $response->withHeader('Content-type', ' application/octet-stream')->withHeader('Content-Disposition', ' attachment; filename=' . $type . '.zip');
-        $newResponse->write(file_get_contents($temp_file_path));
-        unlink($temp_file_path);
-
-        return $newResponse;
-    }
-
-    /**
-     * 从使用同数据库的其他面板下载客户端[内置节点]
-     *
-     * @param array    $args
-     */
-    public function getClientfromToken(Request $request, Response $response, array $args)
-    {
-        $token = $args['token'];
-        $Etoken = Token::where('token', '=', $token)->where('create_time', '>', time() - 60 * 10)->first();
-        if ($Etoken === null) {
-            return '下载链接已失效,请刷新页面后重新点击.';
-        }
-        $user = User::find($Etoken->user_id);
-        if ($user === null) {
-            return null;
-        }
-        $this->user = $user;
-        return $this->getPcClient($request, $response, $args);
-    }
 }

+ 0 - 47
src/Services/CoinPayment.php

@@ -1,47 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services;
-
-use App\Models\Setting;
-use App\Services\Gateway\CoinPay;
-
-final class CoinPayment
-{
-    public static function getClient()
-    {
-        $configs = Setting::getClass('coinpay');
-        return new CoinPay($configs['coinpay_secret'], $configs['coinpay_appid']);
-    }
-
-    public static function notify($request, $response, $args)
-    {
-        return self::getClient()->notify($request, $response, $args);
-    }
-
-    public static function returnHTML($request, $response, $args)
-    {
-        return self::getClient()->getReturnHTML($request, $response, $args);
-    }
-
-    public static function purchaseHTML()
-    {
-        $coinpay_secret = Setting::obtain('coinpay_secret');
-        if (self::getClient() !== null && $coinpay_secret !== '') {
-            return self::getClient()->getPurchaseHTML();
-        }
-
-        return '';
-    }
-
-    public static function getStatus($request, $response, $args)
-    {
-        return self::getClient()->getStatus($request, $response, $args);
-    }
-
-    public static function purchase($request, $response, $args)
-    {
-        return self::getClient()->purchase($request, $response, $args);
-    }
-}

+ 0 - 2
src/Services/Config.php

@@ -119,8 +119,6 @@ final class Config
             'auto_detect_ban_time' => $_ENV['auto_detect_ban_time'],
             'auto_detect_ban' => $_ENV['auto_detect_ban'],
 
-            'userCenterClient' => $_ENV['userCenterClient'],
-
             'sentry_dsn' => ! isset($_ENV['sentry_dsn']) ? $_ENV['sentry_dsn'] : null,
         ];
     }

+ 0 - 188
src/Services/Gateway/CoinPay.php

@@ -1,188 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway;
-
-use App\Models\Paylist;
-use App\Models\Setting;
-use App\Services\Auth;
-use App\Services\Gateway\CoinPay\CoinPayApi;
-use App\Services\Gateway\CoinPay\CoinPayConfig;
-use App\Services\Gateway\CoinPay\CoinPayException;
-use App\Services\Gateway\CoinPay\CoinPayUnifiedOrder;
-use Psr\Http\Message\ResponseInterface;
-use Slim\Http\Request;
-use Slim\Http\Response;
-
-final class CoinPay extends AbstractPayment
-{
-    private $coinPaySecret;
-    private $coinPayGatewayUrl;
-    private $coinPayAppId;
-
-    public function __construct($coinPaySecret, $coinPayAppId)
-    {
-        $configs = Setting::getClass('coinpay');
-        $this->coinPaySecret = $configs['coinpay_secret'];
-        $this->coinPayAppId = $configs['coinpay_appid'];
-        $this->coinPayGatewayUrl = 'https://openapi.coinpay.la/'; // 网关地址
-    }
-
-    public static function _name(): string
-    {
-        return 'coinpay';
-    }
-
-    public static function _enable(): bool
-    {
-        return self::getActiveGateway('coinpay');
-    }
-
-    public static function _readableName(): string
-    {
-        return 'CoinPay 支持BTC、ETH、USDT等数十种数字货币';
-    }
-
-    public function purchase(Request $request, Response $response, array $args): ResponseInterface
-    {
-        // set timezone
-        date_default_timezone_set('Asia/Hong_Kong');
-        /*请求参数*/
-        $amount = $request->getParam('price');
-        //var_dump($request->getParam("price"));die();
-        $user = Auth::getUser();
-        $pl = new Paylist();
-        $pl->userid = $user->id;
-        $pl->total = $amount;
-        $pl->tradeno = self::generateGuid();
-        $pl->save();
-        //商户订单号,商户网站订单系统中唯一订单号,必填
-        $out_trade_no = $pl->tradeno;
-        //订单名称,必填
-        $subject = $pl->id . 'UID:' . $user->id . ' 充值' . $amount . '元';
-        //付款金额,必填
-        $total_fee = (float) $amount;
-
-        $report_data = new CoinPayUnifiedOrder();
-        $report_data->setSubject($subject);
-        $report_data->setOutTradeNo($out_trade_no);
-        $report_data->setTotalAmount($total_fee);
-        $report_data->setTimestamp(date('Y-m-d H:i:s', time()));
-        $report_data->setReturnUrl($_ENV['baseUrl'] . '/user/code');
-        $report_data->setNotifyUrl(self::getCallbackUrl());
-//        $report_data->SetBody(json_encode($pl));
-//        $report_data->SetTransCurrency("CNY");
-//        $report_data->SetAttach("");
-        $config = new CoinPayConfig();
-        try {
-            $url = CoinPayApi::unifiedOrder($config, $report_data);
-            return $response->withJson(['code' => 0, 'url' => $this->coinPayGatewayUrl . 'api/gateway?' . $url]);
-        } catch (CoinPayException $exception) {
-            print_r($exception->getMessage());
-            die;
-        }
-    }
-
-    public function verify($data, $sign): bool
-    {
-        $payConfig = new CoinPayConfig();
-        if ($sign === self::sign($data, $payConfig->getSecret())) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 异步通知
-     *
-     * @param array $args
-     */
-    public function notify($request, $response, $args): ResponseInterface
-    {
-        $raw = file_get_contents('php://input');
-        file_put_contents(BASE_PATH . '/coinpay_purchase.log', $raw . "\r\n", FILE_APPEND);
-        $data = json_decode($raw, true);
-        if (is_null($data)) {
-            file_put_contents(BASE_PATH . '/coinpay_purchase.log', "返回数据异常\r\n", FILE_APPEND);
-            echo 'fail';
-            die;
-        }
-        // 签名验证
-        $sign = $data['sign'];
-        unset($data['sign']);
-        $resultVerify = self::verify($data, $sign);
-        $isPaid = $data !== null && $data['trade_status'] !== null && $data['trade_status'] === 'TRADE_SUCCESS';
-        if ($resultVerify) {
-            if ($isPaid) {
-                $this->postPayment($data['out_trade_no'], 'CoinPay');
-                echo 'success';
-                file_put_contents(BASE_PATH . '/coinpay_purchase.log', "订单{$data['out_trade_no']}支付成功\r\n" . json_encode($data) . "\r\n", FILE_APPEND);
-            } else {
-                echo 'success';
-                file_put_contents(BASE_PATH . '/coinpay_purchase.log', "订单{$data['out_trade_no']}未支付自动关闭成功\r\n" . json_encode($data) . "\r\n", FILE_APPEND);
-            }
-        } else {
-            echo 'fail';
-            file_put_contents(BASE_PATH . '/coinpay_purchase.log', "订单{$data['out_trade_no']}签名验证失败或者订单未支付成功\r\n" . json_encode($data) . "\r\n", FILE_APPEND);
-        }
-        die;
-    }
-
-    public static function getPurchaseHTML(): string
-    {
-        return '<div class="card-inner">
-						<div class="form-group pull-left">
-                            <p class="modal-title">CoinPay 支持BTC、ETH、USDT等数十种数字货币</p>
-                            <div class="form-group form-group-label">
-                                <label class="floating-label" for="amount-coinpay">充值金额</label>
-                                <input id="amount-coinpay" class="form-control maxwidth-edit" name="amount-coinpay" />
-                            </div>
-                             <a class="btn btn-flat waves-attach" id="submitCoinPay" style="padding: 8px 24px;color: #fff;background: #1890ff;"><span class="icon">check</span>&nbsp;充&nbsp;值&nbsp;</a>
-                        </div>
-                    </div>
-                        <script>
-                        window.onload = function(){
-        $("#submitCoinPay").click(function() {
-            var price = parseFloat($("#amount-coinpay").val());
-            if (isNaN(price)) {
-                $("#result").modal();
-                $("#msg").html("非法的金额!");
-                return false;
-            }
-            $(\'#readytopay\').modal();
-            $("#readytopay").on(\'shown.bs.modal\', function () {
-                $.ajax({
-                    \'url\': "/user/payment/purchase/coinpay",
-                    \'data\': {
-                        \'price\': price,
-                    },
-                    \'dataType\': \'json\',
-                    \'type\': "POST",
-                    success: (data) => {
-                        if (data.code == 0) {
-                            $("#result").modal();
-                            $("#msg").html("正在跳转CoinPay支付网关...");
-                            window.location.href = data.url;
-                        } else {
-                            $("#result").modal();
-                            $$.getElementById(\'msg\').innerHTML = data.msg;
-                            console.log(data);
-                        }
-                    }
-                });
-            });
-        });
-    };</script>
-';
-    }
-
-    private function sign($value, $secret)
-    {
-        ksort($value);
-        reset($value);
-        $sign_param = implode('&', $value);
-        $signature = hash_hmac('sha256', $sign_param, $secret, true);
-        return base64_encode($signature);
-    }
-}

+ 0 - 69
src/Services/Gateway/CoinPay/CoinPayApi.php

@@ -1,69 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-final class CoinPayApi
-{
-    /**
-     * 统一下单,CoinPayUnifiedOrder、total_amount、必填
-     *
-     * @param CoinPayConfigInterface $config "配置对象"
-     *
-     * @throws CoinPayException
-     */
-    public static function unifiedOrder(CoinPayConfigInterface $config, CoinPayUnifiedOrder $inputObj, int $timeOut = 6): string
-    {
-        if (! $inputObj->isSubjectSet()) {
-            throw new CoinPayException('缺少统一支付接口必填参数subject!');
-        }
-        if (! $inputObj->isTimestampSet()) {
-            throw new CoinPayException('缺少统一支付接口必填参数timestamp!');
-        }
-        if (! $inputObj->isOutTradeNoSet()) {
-            throw new CoinPayException('缺少统一支付接口必填参数out_trade_no!');
-        }
-        if (! $inputObj->isTotalAmountSet()) {
-            throw new CoinPayException('缺少统一支付接口必填参数total_amount!');
-        }
-
-        //异步通知url未设置,则使用配置文件中的url
-        if (! $inputObj->isNotifyUrlSet() && $config->getNotifyUrl() !== '') {
-            $inputObj->setNotifyUrl($config->getNotifyUrl());
-        }
-        if (! $inputObj->isReturnUrlSet() && $config->getReturnUrl() !== '') {
-            $inputObj->setReturnUrl($config->getReturnUrl());
-        }
-        if (! $inputObj->isAttachSet() && $config->getAttach() !== '') {
-            $inputObj->setAttach($config->getAttach());
-        }
-        if (! $inputObj->isBodySet() && $config->getBody() !== '') {
-            $inputObj->setBody($config->getBody());
-        }
-        if (! $inputObj->isTransCurrencySet() && $config->getTransCurrency() !== '') {
-            $inputObj->setTransCurrency($config->getTransCurrency());
-        }
-
-        // 设置AppID于随机字符串
-        $inputObj->setAppid($config->getAppId());
-        $inputObj->setNonce_str(self::getNonceStr());
-
-        //签名
-        $inputObj->setSign($config->getSecret());
-        return http_build_query($inputObj->returnArray());
-    }
-
-    /**
-     * 返回随机字符串
-     */
-    public static function getNonceStr(int $length = 32): string
-    {
-        $chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
-        $str = '';
-        for ($i = 0; $i < $length; $i++) {
-            $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
-        }
-        return $str;
-    }
-}

+ 0 - 66
src/Services/Gateway/CoinPay/CoinPayConfig.php

@@ -1,66 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-use App\Models\Setting;
-
-final class CoinPayConfig extends CoinPayConfigInterface
-{
-    /**
-     * 系统secret加密字符串
-     * 【注意:请勿泄露该key,如果不慎泄露请登录后台进行重置该key】
-     */
-    public function getSecret(): string
-    {
-        return Setting::obtain('coinpay_secret');
-    }
-
-    /**
-     * 设置当前应用AppID
-     */
-    public function getAppId(): string
-    {
-        return Setting::obtain('coinpay_appid');
-    }
-
-    /**
-     * 设置默认POST回调url
-     */
-    public function getNotifyUrl(): string
-    {
-        return Setting::obtain('coinpay_notify');
-    }
-
-    /**
-     * 设置同步返回url
-     */
-    public function getReturnUrl(): string
-    {
-        return Setting::obtain('coinpay_return');
-    }
-
-    /**
-     * 设置当前提交参数字符编码 默认UTF-8
-     */
-    public function getPostCharset(): string
-    {
-        return 'UTF-8';
-    }
-
-    public function getAttach(): string
-    {
-        return '';
-    }
-
-    public function getTransCurrency(): string
-    {
-        return '';
-    }
-
-    public function getBody(): string
-    {
-        return '';
-    }
-}

+ 0 - 32
src/Services/Gateway/CoinPay/CoinPayConfigInterface.php

@@ -1,32 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-abstract class CoinPayConfigInterface
-{
-    // 系统加密key
-    abstract public function getSecret(): string;
-
-    // 支付回调url
-    abstract public function getNotifyUrl(): string;
-
-    // 同步返回url
-    abstract public function getReturnUrl(): string;
-
-    // 设置应用AppID
-    abstract public function getAppId(): string;
-
-    //附加数据,按原样返回,不填写默认为空.
-    abstract public function getAttach(): string;
-
-    // body数据.不填写默认为空
-    abstract public function getBody(): string;
-
-    // 货币代号,不填写默认为CNY  可选值为CNY USD
-    abstract public function getTransCurrency(): string;
-
-    // 表单提交字符集编码
-    abstract public function getPostCharset(): string;
-}

+ 0 - 76
src/Services/Gateway/CoinPay/CoinPayDataBase.php

@@ -1,76 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-abstract class CoinPayDataBase
-{
-    private $values = [];
-
-    /**
-     * 设置分配的APPID
-     */
-    public function setAppid(string $value): void
-    {
-        $this->values['app_id'] = $value;
-    }
-
-    /**
-     * 获取APPID
-     */
-    public function getAppid(): 值
-    {
-        return $this->values['app_id'];
-    }
-
-    /**
-     * 判断应用ID是否存在
-     *
-     * @return true 或 false
-     */
-    public function isAppidSet(): bool
-    {
-        return array_key_exists('app_id', $this->values);
-    }
-
-    /**
-     * 设置签名,详见签名生成算法
-     *
-     * @param $secret
-     */
-    public function setSign($secret): void
-    {
-        ksort($this->values);
-        reset($this->values);
-        $sign_param = implode('&', $this->values);
-        $signature = hash_hmac('sha256', $sign_param, $secret, true);
-        $this->values['sign'] = base64_encode($signature);
-    }
-
-    /**
-     * 获取签名,详见签名生成算法的值
-     */
-    public function getSign(): 值
-    {
-        return $this->values['sign'];
-    }
-
-    /**
-     * 判断签名,详见签名生成算法是否存在
-     *
-     * @return true 或 false
-     */
-    public function isSignSet(): bool
-    {
-        return array_key_exists('sign', $this->values);
-    }
-
-    /**
-     * @return array
-     */
-    public function returnArray(): array
-    {
-        return $this->values;
-    }
-}

+ 0 - 13
src/Services/Gateway/CoinPay/CoinPayException.php

@@ -1,13 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-final class CoinPayException extends \Exception
-{
-    public function errorMessage()
-    {
-        return $this->getMessage();
-    }
-}

+ 0 - 80
src/Services/Gateway/CoinPay/CoinPayOrderQuery.php

@@ -1,80 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-final class CoinPayOrderQuery extends CoinPayDataBase
-{
-    /**
-     * 设置票据ID
-     */
-    public function setInvoiceId(string $value): void
-    {
-        $this->values['invoice_id'] = $value;
-    }
-    /**
-     * 获取票据ID
-     */
-    public function getInvoiceId(): 值
-    {
-        return $this->values['invoice_id'];
-    }
-    /**
-     * 判断票据ID是否存在
-     *
-     * @return true 或 false
-     */
-    public function isInvoiceIdSet(): bool
-    {
-        return array_key_exists('invoice_id', $this->values);
-    }
-
-    /**
-     * 设置商户系统内部的订单号,当没提供transaction_id时需要传这个。
-     */
-    public function setOutTradeNo(string $value): void
-    {
-        $this->values['out_trade_no'] = $value;
-    }
-    /**
-     * 获取商户系统内部的订单号,当没提供transaction_id时需要传这个。的值
-     */
-    public function getOutTradeNo(): 值
-    {
-        return $this->values['out_trade_no'];
-    }
-    /**
-     * 判断商户系统内部的订单号,当没提供transaction_id时需要传这个。是否存在
-     *
-     * @return true 或 false
-     */
-    public function isOutTradeNoSet(): bool
-    {
-        return array_key_exists('out_trade_no', $this->values);
-    }
-
-    /**
-     * 设置随机字符串,不长于32位。推荐随机数生成算法
-     */
-    public function setNonceStr(string $value): void
-    {
-        $this->values['nonce_str'] = $value;
-    }
-    /**
-     * 获取随机字符串,不长于32位。推荐随机数生成算法的值
-     */
-    public function getNonceStr(): 值
-    {
-        return $this->values['nonce_str'];
-    }
-    /**
-     * 判断随机字符串,不长于32位。推荐随机数生成算法是否存在
-     *
-     * @return true 或 false
-     */
-    public function isNonceStrSet(): bool
-    {
-        return array_key_exists('nonce_str', $this->values);
-    }
-}

+ 0 - 294
src/Services/Gateway/CoinPay/CoinPayUnifiedOrder.php

@@ -1,294 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Services\Gateway\CoinPay;
-
-/**
- * 统一下单输入对象
- * Class CoinPayUnifiedOrder
- *
- * @package sdk
- */
-final class CoinPayUnifiedOrder extends CoinPayDataBase
-{
-    /**
-     * 设置
-     */
-    public function setSubject(string $value): void
-    {
-        $this->values['subject'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getSubject(): string
-    {
-        return $this->values['subject'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isSubjectSet(): bool
-    {
-        return array_key_exists('subject', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setBody(string $value): void
-    {
-        $this->values['body'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getBody(): string
-    {
-        return $this->values['body'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isBodySet(): bool
-    {
-        return array_key_exists('body', $this->values);
-    }
-
-    /**
-     * 设置商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号
-     */
-    public function setOutTradeNo(string $value): void
-    {
-        $this->values['out_trade_no'] = $value;
-    }
-
-    /**
-     * 获取商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号的值
-     *
-     * @return string 值
-     */
-    public function getOutTradeNo(): string
-    {
-        return $this->values['out_trade_no'];
-    }
-
-    /**
-     * 判断商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号是否存在
-     *
-     * @return true 或 false
-     */
-    public function isOutTradeNoSet(): bool
-    {
-        return array_key_exists('out_trade_no', $this->values);
-    }
-
-    /**
-     * 设置订单总金额,只能为整数,详见支付金额
-     */
-    public function setTotalAmount(float $value): void
-    {
-        $this->values['total_amount'] = $value;
-    }
-
-    /**
-     * 获取订单总金额,只能为整数,详见支付金额的值
-     *
-     * @return string 值
-     */
-    public function getTotalAmount(): string
-    {
-        return $this->values['total_amount'];
-    }
-
-    /**
-     * 判断订单总金额,只能为整数,详见支付金额是否存在
-     *
-     * @return true 或 false
-     */
-    public function isTotalAmountSet(): bool
-    {
-        return array_key_exists('total_amount', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setTimestamp(string $value): void
-    {
-        $this->values['timestamp'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getTimestamp(): string
-    {
-        return $this->values['timestamp'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isTimestampSet(): bool
-    {
-        return array_key_exists('timestamp', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setNonceStr(string $value): void
-    {
-        $this->values['nonce_str'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getNonceStr(): string
-    {
-        return $this->values['nonce_str'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isNonceStrSet(): bool
-    {
-        return array_key_exists('nonce_str', $this->values);
-    }
-
-    /**
-     * 设置接收coinpay支付异步通知回调地址
-     */
-    public function setNotifyUrl(string $value): void
-    {
-        $this->values['notify_url'] = $value;
-    }
-
-    /**
-     * 获取接收coinpay支付异步通知回调地址的值
-     *
-     * @return string 值
-     */
-    public function getNotifyUrl(): string
-    {
-        return $this->values['notify_url'];
-    }
-
-    /**
-     * 判断接收coinpay支付异步通知回调地址是否存在
-     *
-     * @return true 或 false
-     */
-    public function isNotifyUrlSet(): bool
-    {
-        return array_key_exists('notify_url', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setReturnUrl(string $value): void
-    {
-        $this->values['return_url'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getReturnUrl(): string
-    {
-        return $this->values['return_url'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isReturnUrlSet(): bool
-    {
-        return array_key_exists('return_url', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setAttach(string $value): void
-    {
-        $this->values['attach'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getAttach(): string
-    {
-        return $this->values['attach'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isAttachSet(): bool
-    {
-        return array_key_exists('attach', $this->values);
-    }
-
-    /**
-     * 设置
-     */
-    public function setTransCurrency(string $value): void
-    {
-        $this->values['trans_currency'] = $value;
-    }
-
-    /**
-     * 获取
-     *
-     * @return string 值
-     */
-    public function getTransCurrency(): string
-    {
-        return $this->values['trans_currency'];
-    }
-
-    /**
-     * 判断
-     *
-     * @return true 或 false
-     */
-    public function isTransCurrencySet(): bool
-    {
-        return array_key_exists('trans_currency', $this->values);
-    }
-}

+ 0 - 273
src/Utils/ClientProfiles.php

@@ -1,273 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace App\Utils;
-
-use App\Controllers\LinkController;
-use App\Services\Config;
-use Ramsey\Uuid\Uuid;
-
-final class ClientProfiles
-{
-    public static function getSSPcConf($user)
-    {
-        $proxy = [];
-        $items = URL::getNewAllItems(
-            $user,
-            [
-                'type' => 'ss',
-            ]
-        );
-        foreach ($items as $item) {
-            $proxy_plugin = '';
-            $proxy_plugin_opts = '';
-            if ($item['obfs'] === 'v2ray' || in_array($item['obfs'], Config::getSupportParam('ss_obfs'))) {
-                if ($item['obfs'] === 'v2ray') {
-                    $proxy_plugin .= 'v2ray';
-                } else {
-                    $proxy_plugin .= 'obfs-local';
-                }
-                if (strpos($item['obfs'], 'http') !== false) {
-                    $proxy_plugin_opts .= 'obfs=http';
-                } elseif (strpos($item['obfs'], 'tls') !== false) {
-                    $proxy_plugin_opts .= 'obfs=tls';
-                } else {
-                    $proxy_plugin_opts .= 'v2ray;' . $item['obfs_param'];
-                }
-                if ($item['obfs_param'] !== '' && $item['obfs'] !== 'v2ray') {
-                    $proxy_plugin_opts .= ';obfs-host=' . $item['obfs_param'];
-                }
-            }
-            $proxy[] = [
-                'remarks' => $item['remark'],
-                'server' => $item['address'],
-                'server_port' => $item['port'],
-                'method' => $item['method'],
-                'password' => $item['passwd'],
-                'timeout' => 5,
-                'plugin' => $proxy_plugin,
-                'plugin_opts' => $proxy_plugin_opts,
-            ];
-        }
-        $config = [
-            'configs' => $proxy,
-            'strategy' => null,
-            'index' => 0,
-            'global' => false,
-            'enabled' => true,
-            'shareOverLan' => false,
-            'isDefault' => false,
-            'localPort' => 1080,
-            'portableMode' => true,
-            'pacUrl' => null,
-            'useOnlinePac' => false,
-            'secureLocalPac' => true,
-            'availabilityStatistics' => false,
-            'autoCheckUpdate' => true,
-            'checkPreRelease' => false,
-            'isVerboseLogging' => false,
-            'logViewer' => [
-                'topMost' => false,
-                'wrapText' => false,
-                'toolbarShown' => false,
-                'Font' => 'Consolas, 8pt',
-                'BackgroundColor' => 'Black',
-                'TextColor' => 'White',
-            ],
-            'proxy' => [
-                'useProxy' => false,
-                'proxyType' => 0,
-                'proxyServer' => '',
-                'proxyPort' => 0,
-                'proxyTimeout' => 3,
-            ],
-            'hotkey' => [
-                'SwitchSystemProxy' => '',
-                'SwitchSystemProxyMode' => '',
-                'SwitchAllowLan' => '',
-                'ShowLogs' => '',
-                'ServerMoveUp' => '',
-                'ServerMoveDown' => '',
-                'RegHotkeysAtStartup' => false,
-            ],
-        ];
-
-        return json_encode($config, JSON_PRETTY_PRINT);
-    }
-
-    public static function getSSRPcConf($user)
-    {
-        $proxy = [];
-        $items = URL::getNewAllItems(
-            $user,
-            [
-                'type' => 'ssr',
-            ]
-        );
-        foreach ($items as $item) {
-            $proxy[] = [
-                'remarks' => $item['remark'],
-                'server' => $item['address'],
-                'server_port' => $item['port'],
-                'method' => $item['method'],
-                'obfs' => $item['obfs'],
-                'obfsparam' => $item['obfs_param'],
-                'remarks_base64' => base64_encode($item['remark']),
-                'password' => $item['passwd'],
-                'tcp_over_udp' => false,
-                'udp_over_tcp' => false,
-                'group' => $_ENV['appName'],
-                'protocol' => $item['protocol'],
-                'protocolparam' => $item['protocol_param'],
-                'obfs_udp' => false,
-                'enable' => true,
-            ];
-        }
-        $config = [
-            'configs' => $proxy,
-            'index' => 0,
-            'random' => true,
-            'sysProxyMode' => 1,
-            'shareOverLan' => false,
-            'localPort' => 1080,
-            'localAuthPassword' => Tools::genRandomChar(26),
-            'dnsServer' => '',
-            'reconnectTimes' => 2,
-            'balanceAlgorithm' => 'LowException',
-            'randomInGroup' => false,
-            'TTL' => 0,
-            'connectTimeout' => 5,
-            'proxyRuleMode' => 2,
-            'proxyEnable' => false,
-            'pacDirectGoProxy' => false,
-            'proxyType' => 0,
-            'proxyHost' => '',
-            'proxyPort' => 0,
-            'proxyAuthUser' => '',
-            'proxyAuthPass' => '',
-            'proxyUserAgent' => '',
-            'authUser' => '',
-            'authPass' => '',
-            'autoBan' => false,
-            'sameHostForSameTarget' => false,
-            'keepVisitTime' => 180,
-            'isHideTips' => false,
-            'nodeFeedAutoUpdate' => true,
-            'serverSubscribes' => [
-                [
-                    'URL' => LinkController::getSubinfo($user, 0)['ssr'],
-                    'Group' => $_ENV['appName'],
-                    'LastUpdateTime' => 0,
-                ],
-            ],
-            'token' => [],
-            'portMap' => [],
-        ];
-
-        return json_encode($config, JSON_PRETTY_PRINT);
-    }
-
-    public static function getV2RayNPcConf($user)
-    {
-        $subUrl = LinkController::getSubinfo($user, 0)['v2ray'];
-        $subId = Uuid::uuid3(Uuid::NAMESPACE_DNS, $subUrl)->toString();
-        $config = [
-            'inbound' => [
-                [
-                    'localPort' => 10808,
-                    'protocol' => 'socks',
-                    'udpEnabled' => true,
-                    'sniffingEnabled' => true,
-                ],
-            ],
-            'logEnabled' => false,
-            'loglevel' => 'warning',
-            'index' => 0,
-            'vmess' => [],
-            'muxEnabled' => false,
-            'domainStrategy' => 'IPIfNonMatch',
-            'routingMode' => '3',
-            'useragent' => [],
-            'userdirect' => [],
-            'userblock' => [],
-            'kcpItem' => [
-                'mtu' => 1350,
-                'tti' => 50,
-                'uplinkCapacity' => 12,
-                'downlinkCapacity' => 100,
-                'congestion' => false,
-                'readBufferSize' => 2,
-                'writeBufferSize' => 2,
-            ],
-            'listenerType' => 0,
-            'urlGFWList' => 'https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt',
-            'allowLANConn' => false,
-            'enableStatistics' => true,
-            'statisticsFreshRate' => 2000,
-            'remoteDNS' => '114.114.114.114,1.2.4.8,223.5.5.5,8,8,8,8',
-            'subItem' => [
-                [
-                    'id' => $subId,
-                    'remarks' => $_ENV['appName'],
-                    'url' => $subUrl,
-                    'enabled' => true,
-                ],
-            ],
-            'uiItem' => [
-                'mainQRCodeWidth' => 600,
-            ],
-            'userPacRule' => [],
-        ];
-        $Rule = [
-            'type' => 'vmess',
-        ];
-        $proxys = [];
-        $items = URL::getNewAllItems($user, $Rule);
-        foreach ($items as $item) {
-            if (! in_array($item['net'], ['tcp', 'ws', 'kcp', 'h2'])) {
-                continue;
-            }
-            $proxy = [
-                'configVersion' => 2,
-                'address' => $item['add'],
-                'port' => $item['port'],
-                'id' => $item['id'],
-                'alterId' => $item['aid'],
-                'security' => 'auto',
-                'network' => $item['net'],
-                'remarks' => $item['remark'],
-                'headerType' => 'none',
-                'requestHost' => '',
-                'path' => '',
-                'streamSecurity' => '',
-                'allowInsecure' => '',
-                'configType' => 1,
-                'testResult' => '',
-                'subid' => $subId,
-            ];
-            switch ($item['net']) {
-                case 'h2':
-                    $proxy['requestHost'] = ($item['host'] !== '' ? $item['host'] : $item['add']);
-                    $proxy['path'] = $item['path'];
-                    break;
-                case 'ws':
-                    $proxy['requestHost'] = ($item['host'] !== '' ? $item['host'] : $item['add']);
-                    $proxy['path'] = $item['path'];
-                    break;
-                case 'kcp':
-                    $proxy['headerType'] = $item['type'];
-                    break;
-            }
-            if ($item['tls'] === 'tls') {
-                $proxy['streamSecurity'] = $item['tls'];
-                if ($item['verify_cert'] === false) {
-                    $proxy['allowInsecure'] = 'true';
-                }
-            }
-            $proxys[] = $proxy;
-        }
-        $config['vmess'] = $proxys;
-        return json_encode($config, JSON_PRETTY_PRINT);
-    }
-}