diff --git a/app/Command/XCat.php b/app/Command/XCat.php index 6001760..ddd3d25 100644 --- a/app/Command/XCat.php +++ b/app/Command/XCat.php @@ -29,8 +29,6 @@ class XCat public function boot() { switch ($this->argv[1]) { - case("install"): - return $this->install(); case("alipay"): return (new ChenPay())->AliPayListen(); case("wxpay"): @@ -161,11 +159,6 @@ class XCat } } - public function install() - { - echo "x cat will install ss-panel v3...../n"; - } - public function initdownload() { system('git clone https://github.com/xcxnig/ssr-download.git '.BASE_PATH."/public/ssr-download/", $ret); diff --git a/app/Controllers/HomeController.php b/app/Controllers/HomeController.php index c3aa307..f02793d 100644 --- a/app/Controllers/HomeController.php +++ b/app/Controllers/HomeController.php @@ -79,26 +79,6 @@ class HomeController extends BaseController return $this->view()->display('500.tpl'); } - //@todo: Will be abandoned in future. - public function codepay_callback($request, $response, $args) - { - echo ' - - '; - return; - } - - - //@todo: Will be abandoned in future. - public function pay_callback($request, $response, $args) - { - Pay::callback($request); - } - - - public function getOrderList($request, $response, $args) { $key = $request->getParam('key'); diff --git a/app/Controllers/LinkController.php b/app/Controllers/LinkController.php index e6c2daf..c3b5057 100644 --- a/app/Controllers/LinkController.php +++ b/app/Controllers/LinkController.php @@ -153,15 +153,6 @@ class LinkController extends BaseController return $newResponse; } - - public static function GetGfwlistJs($request, $response, $args) - { - $newResponse = $response->withHeader('Content-type', ' application/x-ns-proxy-autoconfig; charset=utf-8')->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')->withHeader('Content-Disposition', ' attachment; filename=gfwlist.js'); - ;//->getBody()->write($builder->output()); - $newResponse->getBody()->write(LinkController::GetMacPac()); - return $newResponse; - } - public static function GetPcConf($user, $is_mu = 0, $is_ss = 0) { if ($is_ss==0) { @@ -290,13 +281,6 @@ class LinkController extends BaseController return LinkController::get_pac($type, $address, $port, true, $defined); } - private static function GetMacPac() - { - header('Content-type: application/x-ns-proxy-autoconfig; charset=utf-8'); - return LinkController::get_mac_pac(); - } - - private static function GetAcl($user) { $rulelist = base64_decode(file_get_contents("https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"))."\n".$user->pac; @@ -500,9 +484,7 @@ class LinkController extends BaseController $acl_content .= $find_function_content."\n".$proxy_list."\n".$bypass_list."\n".$outbound_block_list; return $acl_content; } - - - + /** * This is a php implementation of autoproxy2pac */ @@ -570,53 +552,6 @@ class LinkController extends BaseController return $pac_content; } - - private static function get_mac_pac() - { - $rulelist = base64_decode(file_get_contents("https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt")); - $gfwlist = explode("\n", $rulelist); - $gfwlist[] = ".google.com"; - - $count = 0; - $pac_content = ''; - $find_function_content = 'function FindProxyForURL(url, host) { var PROXY = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT;"; var DEFAULT = "DIRECT";'."\n"; - foreach ($gfwlist as $index=>$rule) { - if (empty($rule)) { - continue; - } elseif (substr($rule, 0, 1) == '!' || substr($rule, 0, 1) == '[') { - continue; - } - $return_proxy = 'PROXY'; - // @@开头表示默认是直接访问 - if (substr($rule, 0, 2) == '@@') { - $rule = substr($rule, 2); - $return_proxy = "DEFAULT"; - } - - // ||开头表示前面还有路径 - if (substr($rule, 0, 2) =='||') { - $rule_reg = "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?".LinkController::reg_encode(substr($rule, 2)); - // !开头相当于正则表达式^ - } elseif (substr($rule, 0, 1) == '|') { - $rule_reg = "^" . LinkController::reg_encode(substr($rule, 1)); - // 前后匹配的/表示精确匹配 - } elseif (substr($rule, 0, 1) == '/' && substr($rule, -1) == '/') { - $rule_reg = substr($rule, 1, strlen($rule) - 2); - } else { - $rule_reg = LinkController::reg_encode($rule); - } - // 以|结尾,替换为$结尾 - if (preg_match("/\|$/i", $rule_reg)) { - $rule_reg = substr($rule_reg, 0, strlen($rule_reg) - 1)."$"; - } - $find_function_content.='if (/' . $rule_reg . '/i.test(url)) return '.$return_proxy.';'."\n"; - $count = $count + 1; - } - $find_function_content.='return DEFAULT;'."}"; - $pac_content.=$find_function_content; - return $pac_content; - } - public static function GetRouter($user, $is_mu = 0, $is_ss = 0) { $bash = '#!/bin/sh'."\n"; diff --git a/app/Services/Gateway/YftPay.php b/app/Services/Gateway/YftPay.php index c4cc60f..0ab48fb 100755 --- a/app/Services/Gateway/YftPay.php +++ b/app/Services/Gateway/YftPay.php @@ -14,10 +14,9 @@ use App\Models\YftOrder; use App\Services\Auth; use App\Services\View; use App\Utils\Telegram; -use App\Utils\YftOrderNumUtil; use App\Services\Config; use App\Controllers\QuickPayFunction; -use App\Controllers\PayConfig; +use App\Controllers\YftPayConfig; class YftPay extends AbstractPayment { @@ -83,7 +82,7 @@ class YftPay extends AbstractPayment { $newResponse = $response->withStatus(302)->withHeader('Location', '/user/code'); $yftLib = new QuickPayFunction(); - $pay_config = new PayConfig(); + $pay_config = new YftPayConfig(); $pay_config->init(); //价格 @@ -208,7 +207,7 @@ class YftPay extends AbstractPayment private function constructPayPara($request) { $yftLib = new QuickPayFunction(); - $pay_config = new PayConfig(); + $pay_config = new YftPayConfig(); $pay_config->init(); /**************************请求参数**************************/ @@ -233,7 +232,18 @@ class YftPay extends AbstractPayment $accesskey = Config::get('yft_accesskey'); //生成订单号 - $ss_order_no = YftOrderNumUtil::generate_yftOrder(8); + // 密码字符集,可任意添加你需要的字符 + $date = time(); + $date = "yft".date("YmdHis",$date); + $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + $password = ""; + for ($i = 0; $i < 8; $i++) { + // 这里提供两种字符获取方式 + // 第一种是使用 substr 截取$chars中的任意一位字符; + // 第二种是取字符数组 $chars 的任意元素 + $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); + } + $ss_order_no = $date.$password; /************************************************************/ //构造要请求的参数数组,无需改动 diff --git a/app/Controllers/PayConfig.php b/app/Services/Gateway/YftPayConfig.php similarity index 67% rename from app/Controllers/PayConfig.php rename to app/Services/Gateway/YftPayConfig.php index debeb55..a279088 100644 --- a/app/Controllers/PayConfig.php +++ b/app/Services/Gateway/YftPayConfig.php @@ -1,15 +1,15 @@ pay_config = [ - "notify_url" => "/yft/notify", + "notify_url" => "/notify", "return_url" => "/user/code", "type" => "aliPay" ]; diff --git a/app/Utils/YftOrderNumUtil.php b/app/Utils/YftOrderNumUtil.php deleted file mode 100644 index a50b0cd..0000000 --- a/app/Utils/YftOrderNumUtil.php +++ /dev/null @@ -1,28 +0,0 @@ -get('/', 'App\Controllers\HomeController:index'); $app->get('/404', 'App\Controllers\HomeController:page404'); $app->get('/405', 'App\Controllers\HomeController:page405'); $app->get('/500', 'App\Controllers\HomeController:page500'); -$app->get('/pwm_pingback', 'App\Services\Payment:notify'); $app->post('/notify', 'App\Controllers\HomeController:notify'); -$app->post('/alipay_callback', 'App\Services\Payment:notify'); // @todo: Will be replaced by Payment::notify -$app->post('/pay_callback', 'App\Services\Payment:notify'); -$app->get('/pay_callback', 'App\Services\Payment:notify'); // @todo: Will be replaced by Payment::notify $app->get('/tos', 'App\Controllers\HomeController:tos'); $app->get('/staff', 'App\Controllers\HomeController:staff'); -$app->get('/gfwlistjs', 'App\Controllers\LinkController:GetGfwlistJs'); $app->post('/telegram_callback', 'App\Controllers\HomeController:telegram'); -$app->get('/yft/notify', 'App\Services\Gateway\YftPay:notify'); // @todo: Will be replaced by Payment::notify -$app->get('/codepay_callback', 'App\Services\Payment:notify'); -$app->post('/codepay_callback', 'App\Services\Payment:notify'); // User Center $app->group('/user', function () { diff --git a/storage/logs/.gitignore b/storage/logs/.gitignore deleted file mode 100644 index bf0824e..0000000 --- a/storage/logs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.log \ No newline at end of file diff --git a/storage/logs/.gitkeep b/storage/logs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/storage/ss-panel/.gitignore b/storage/ss-panel/.gitignore deleted file mode 100644 index c96a04f..0000000 --- a/storage/ss-panel/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore \ No newline at end of file