清理残留代码

master
CGDF 8 years ago
parent 17bd5111ec
commit 5ae7238f77

@ -29,8 +29,6 @@ class XCat
public function boot() public function boot()
{ {
switch ($this->argv[1]) { switch ($this->argv[1]) {
case("install"):
return $this->install();
case("alipay"): case("alipay"):
return (new ChenPay())->AliPayListen(); return (new ChenPay())->AliPayListen();
case("wxpay"): case("wxpay"):
@ -161,11 +159,6 @@ class XCat
} }
} }
public function install()
{
echo "x cat will install ss-panel v3...../n";
}
public function initdownload() public function initdownload()
{ {
system('git clone https://github.com/xcxnig/ssr-download.git '.BASE_PATH."/public/ssr-download/", $ret); system('git clone https://github.com/xcxnig/ssr-download.git '.BASE_PATH."/public/ssr-download/", $ret);

@ -79,26 +79,6 @@ class HomeController extends BaseController
return $this->view()->display('500.tpl'); return $this->view()->display('500.tpl');
} }
//@todo: Will be abandoned in future.
public function codepay_callback($request, $response, $args)
{
echo '
<script>
window.location.href="/user/code";
</script>
';
return;
}
//@todo: Will be abandoned in future.
public function pay_callback($request, $response, $args)
{
Pay::callback($request);
}
public function getOrderList($request, $response, $args) public function getOrderList($request, $response, $args)
{ {
$key = $request->getParam('key'); $key = $request->getParam('key');

@ -153,15 +153,6 @@ class LinkController extends BaseController
return $newResponse; 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) public static function GetPcConf($user, $is_mu = 0, $is_ss = 0)
{ {
if ($is_ss==0) { if ($is_ss==0) {
@ -290,13 +281,6 @@ class LinkController extends BaseController
return LinkController::get_pac($type, $address, $port, true, $defined); 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) private static function GetAcl($user)
{ {
$rulelist = base64_decode(file_get_contents("https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt"))."\n".$user->pac; $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; $acl_content .= $find_function_content."\n".$proxy_list."\n".$bypass_list."\n".$outbound_block_list;
return $acl_content; return $acl_content;
} }
/** /**
* This is a php implementation of autoproxy2pac * This is a php implementation of autoproxy2pac
*/ */
@ -570,53 +552,6 @@ class LinkController extends BaseController
return $pac_content; 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) public static function GetRouter($user, $is_mu = 0, $is_ss = 0)
{ {
$bash = '#!/bin/sh'."\n"; $bash = '#!/bin/sh'."\n";

@ -14,10 +14,9 @@ use App\Models\YftOrder;
use App\Services\Auth; use App\Services\Auth;
use App\Services\View; use App\Services\View;
use App\Utils\Telegram; use App\Utils\Telegram;
use App\Utils\YftOrderNumUtil;
use App\Services\Config; use App\Services\Config;
use App\Controllers\QuickPayFunction; use App\Controllers\QuickPayFunction;
use App\Controllers\PayConfig; use App\Controllers\YftPayConfig;
class YftPay extends AbstractPayment class YftPay extends AbstractPayment
{ {
@ -83,7 +82,7 @@ class YftPay extends AbstractPayment
{ {
$newResponse = $response->withStatus(302)->withHeader('Location', '/user/code'); $newResponse = $response->withStatus(302)->withHeader('Location', '/user/code');
$yftLib = new QuickPayFunction(); $yftLib = new QuickPayFunction();
$pay_config = new PayConfig(); $pay_config = new YftPayConfig();
$pay_config->init(); $pay_config->init();
//价格 //价格
@ -208,7 +207,7 @@ class YftPay extends AbstractPayment
private function constructPayPara($request) private function constructPayPara($request)
{ {
$yftLib = new QuickPayFunction(); $yftLib = new QuickPayFunction();
$pay_config = new PayConfig(); $pay_config = new YftPayConfig();
$pay_config->init(); $pay_config->init();
/**************************请求参数**************************/ /**************************请求参数**************************/
@ -233,7 +232,18 @@ class YftPay extends AbstractPayment
$accesskey = Config::get('yft_accesskey'); $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;
/************************************************************/ /************************************************************/
//构造要请求的参数数组,无需改动 //构造要请求的参数数组,无需改动

@ -1,15 +1,15 @@
<?php <?php
namespace App\Controllers; namespace App\Services\Gateway;
class PayConfig{ class YftPayConfig{
public $pay_config; public $pay_config;
public function init() public function init()
{ {
$this->pay_config = [ $this->pay_config = [
"notify_url" => "/yft/notify", "notify_url" => "/notify",
"return_url" => "/user/code", "return_url" => "/user/code",
"type" => "aliPay" "type" => "aliPay"
]; ];

@ -1,28 +0,0 @@
<?php
/**
* Created by 傲慢与偏见.
* OSUser: D-L
* Date: 2017/10/12
* Time: 21:08
*/
namespace App\Utils;
class YftOrderNumUtil
{
public static function generate_yftOrder($length = 8)
{
// 密码字符集,可任意添加你需要的字符
$date = time();
$date = "yft".date("YmdHis",$date);
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = "";
for ($i = 0; $i < $length; $i++) {
// 这里提供两种字符获取方式
// 第一种是使用 substr 截取$chars中的任意一位字符;
// 第二种是取字符数组 $chars 的任意元素
$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
}
return $date.$password;
}
}

@ -71,18 +71,10 @@ $app->get('/', 'App\Controllers\HomeController:index');
$app->get('/404', 'App\Controllers\HomeController:page404'); $app->get('/404', 'App\Controllers\HomeController:page404');
$app->get('/405', 'App\Controllers\HomeController:page405'); $app->get('/405', 'App\Controllers\HomeController:page405');
$app->get('/500', 'App\Controllers\HomeController:page500'); $app->get('/500', 'App\Controllers\HomeController:page500');
$app->get('/pwm_pingback', 'App\Services\Payment:notify');
$app->post('/notify', 'App\Controllers\HomeController: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('/tos', 'App\Controllers\HomeController:tos');
$app->get('/staff', 'App\Controllers\HomeController:staff'); $app->get('/staff', 'App\Controllers\HomeController:staff');
$app->get('/gfwlistjs', 'App\Controllers\LinkController:GetGfwlistJs');
$app->post('/telegram_callback', 'App\Controllers\HomeController:telegram'); $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 // User Center
$app->group('/user', function () { $app->group('/user', function () {

@ -1 +0,0 @@
*.log

@ -1,2 +0,0 @@
*
!.gitignore
Loading…
Cancel
Save