From a2a07d280632c14294e5ec6f2a5754e3b16668d4 Mon Sep 17 00:00:00 2001 From: "DESKTOP-D3LDFUH\\Administrator" Date: Thu, 3 Aug 2017 13:44:43 +0800 Subject: [PATCH] no message --- .github/ISSUE_TEMPLATE.md | 20 - .idea/deployment.xml | 14 - .idea/m.feiyang.li.iml | 20 - .idea/modules.xml | 8 - .idea/workspace.xml | 125 --- app/Command/Job.php | 56 ++ app/Controllers/Admin/ShopController.php | 24 + app/Controllers/AuthController.php | 12 - app/Controllers/LinkController.php | 365 ++----- app/Controllers/UserController.php | 469 ++------- app/Models/Shop.php | 57 +- app/Services/Config.php | 19 +- app/Utils/TelegramProcess.php | 4 +- app/Utils/URL.php | 383 ++++++++ bootstrap.php | 2 +- config/.config.php | 326 ------- config/.config.php.example | 28 +- .../views/material/admin/shop/create.tpl | 101 +- resources/views/material/admin/shop/edit.tpl | 101 +- resources/views/material/staff.tpl | 2 +- resources/views/material/user/edit.tpl | 15 +- resources/views/material/user/index.tpl | 253 +++-- resources/views/material/user/nodeinfo.tpl | 293 ++++-- sql/sspanel.sql | 903 ++++++++++++++++++ 24 files changed, 2183 insertions(+), 1417 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .idea/deployment.xml delete mode 100644 .idea/m.feiyang.li.iml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/workspace.xml create mode 100644 app/Utils/URL.php delete mode 100644 config/.config.php create mode 100644 sql/sspanel.sql diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 4faff10..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,20 +0,0 @@ -# 提 issue 之前请注意: -1.这个问题你自己是否已经尝试解决过,但是并没有头绪。 -2.这个问题所涉及的相关内容是否能在之前的 issue 以及互联网上搜索到。不能,再往下。 -3.这里不提供客服服务,请确认你自己有能力进行调试,方法看[这里](https://github.com/esdeathlove/ss-panel-v3-mod/wiki/%E5%A6%82%E4%BD%95%E6%AD%A3%E7%A1%AE%E5%9C%B0%E6%8E%92%E6%9F%A5%E4%B8%8E%E5%8F%8D%E9%A6%88%E9%97%AE%E9%A2%98)。 -4.理解并认同不恰当的 issue 会被关闭,乃至于无法获取到更多的帮助。 -5.在描述问题的时候少说无关的废话,再强调你自己是小白也无法获得更多地关注的,省点力气把问题描述得详细些吧。 - -# 看完了的话,就把上面的删掉。来下面的模板来发 issue 吧。 - -程序类型(前端/后端): - -程序版本(前端发版本号,后端发 git log 所看到的 commit id): - -问题发生时所进行的操作: - -问题所造成的影响: - -调试日志(按照上面的调试方法得到): - -谢谢配合! \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml deleted file mode 100644 index 6f53ed2..0000000 --- a/.idea/deployment.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/m.feiyang.li.iml b/.idea/m.feiyang.li.iml deleted file mode 100644 index 739c6bf..0000000 --- a/.idea/m.feiyang.li.iml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 23b17a7..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 7e27b46..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1497075041330 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/Command/Job.php b/app/Command/Job.php index 1ce1828..2496443 100644 --- a/app/Command/Job.php +++ b/app/Command/Job.php @@ -141,6 +141,50 @@ class Job DetectLog::where("datetime", "<", time()-86400*3)->delete(); Telegram::Send("姐姐姐姐,数据库被清理了,感觉身体被掏空了呢~"); + //auto reset + $boughts=Bought::all(); + foreach ($boughts as $bought) { + $user=User::where("id", $bought->userid)->first(); + + if ($user == null) { + $bought->delete(); + continue; + } + + $shop=Shop::where("id", $bought->shopid)->first(); + + if ($shop == null) { + $bought->delete(); + continue; + } + + if($shop->reset() != 0 && $shop->reset_value() != 0 && $shop->reset_exp() != 0) { + if(time() - $shop->reset_exp() * 86400 < $bought->datetime) { + if(intval((time() - $bought->datetime) / 86400) % $shop->reset() == 0 && intval((time() - $bought->datetime) / 86400) != 0) { + echo("流量重置-".$user->id."\n"); + $user->transfer_enable = Tools::toGB($shop->reset_value()); + $user->u = 0; + $user->d = 0; + $user->last_day_t = 0; + $user->save(); + + $subject = Config::get('appName')."-您的流量被重置了"; + $to = $user->email; + $text = "您好,根据您所订购的订单 ID:".$bought->id.",流量已经被重置为".$shop->reset_value().'GB' ; + try { + Mail::send($to, $subject, 'news/warn.tpl', [ + "user" => $user,"text" => $text + ], [ + ]); + } catch (Exception $e) { + echo $e->getMessage(); + } + } + } + } + + } + $users = User::all(); foreach ($users as $user) { @@ -154,6 +198,18 @@ class Job $user->last_day_t = 0; $user->transfer_enable = $user->auto_reset_bandwidth*1024*1024*1024; $user->save(); + + $subject = Config::get('appName')."-您的流量被重置了"; + $to = $user->email; + $text = "您好,根据管理员的设置,流量已经被重置为".$user->auto_reset_bandwidth.'GB' ; + try { + Mail::send($to, $subject, 'news/warn.tpl', [ + "user" => $user,"text" => $text + ], [ + ]); + } catch (Exception $e) { + echo $e->getMessage(); + } } } diff --git a/app/Controllers/Admin/ShopController.php b/app/Controllers/Admin/ShopController.php index c0a342d..2ed1c8c 100644 --- a/app/Controllers/Admin/ShopController.php +++ b/app/Controllers/Admin/ShopController.php @@ -55,6 +55,18 @@ class ShopController extends AdminController $content["class_expire"]=$request->getParam('class_expire'); } + if ($request->getParam('reset')!=0) { + $content["reset"]=$request->getParam('reset'); + } + + if ($request->getParam('reset_value')!=0) { + $content["reset_value"]=$request->getParam('reset_value'); + } + + if ($request->getParam('reset_exp')!=0) { + $content["reset_exp"]=$request->getParam('reset_exp'); + } + $shop->content=json_encode($content); @@ -115,6 +127,18 @@ class ShopController extends AdminController $content["class_expire"]=$request->getParam('class_expire'); } + if ($request->getParam('reset')!=0) { + $content["reset"]=$request->getParam('reset'); + } + + if ($request->getParam('reset_value')!=0) { + $content["reset_value"]=$request->getParam('reset_value'); + } + + if ($request->getParam('reset_exp')!=0) { + $content["reset_exp"]=$request->getParam('reset_exp'); + } + $shop->content=json_encode($content); if (!$shop->save()) { diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index 5203b12..0f7ab45 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -321,18 +321,6 @@ class AuthController extends BaseController return $response->getBody()->write(json_encode($res)); } - if ($imtype==""||$wechat=="") { - $res['ret'] = 0; - $res['msg'] = "要填上你的联络方式哦"; - return $response->getBody()->write(json_encode($res)); - } - - $user = User::where('im_value', $wechat)->where('im_type', $imtype)->first(); - if ($user != null) { - $res['ret'] = 0; - $res['msg'] = "此联络方式已经被注册了"; - return $response->getBody()->write(json_encode($res)); - } // do reg user $user = new User(); diff --git a/app/Controllers/LinkController.php b/app/Controllers/LinkController.php index 65103f2..966c51b 100644 --- a/app/Controllers/LinkController.php +++ b/app/Controllers/LinkController.php @@ -10,6 +10,7 @@ use App\Models\Node; use App\Models\Relay; use App\Models\Smartline; use App\Utils\Tools; +use App\Utils\URL; use App\Services\Config; /** @@ -157,6 +158,26 @@ class LinkController extends BaseController return $NLink->token; } + public static function GenerateSSRSubCode($userid, $without_mu) + { + $Elink = Link::where("type", "=", 11)->where("userid", "=", $userid)->where("geo", $without_mu)->first(); + if ($Elink != null) { + return $Elink->token; + } + $NLink = new Link(); + $NLink->type = 11; + $NLink->address = ""; + $NLink->port = 0; + $NLink->ios = 0; + $NLink->geo = $without_mu; + $NLink->method = ""; + $NLink->userid = $userid; + $NLink->token = LinkController::GenerateRandomLink(); + $NLink->save(); + + return $NLink->token; + } + public static function GetContent($request, $response, $args) { $token = $args['token']; @@ -173,27 +194,19 @@ class LinkController extends BaseController if ($user == null) { return null; } - $newResponse = $response->withHeader('Content-type', ' application/octet-stream; charset=utf-8')->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')->withHeader('Content-Disposition', ' attachment; filename=allinone.conf');//->getBody()->write($builder->output()); - if ($user->is_admin) { - $newResponse->getBody()->write(LinkController::GetIosConf(Node::where( - function ($query) { - $query->Where("sort", "=", 0) - ->orWhere("sort", "=", 10); - } - )->where("type", "1")->get(), $user)); - } else { - $newResponse->getBody()->write(LinkController::GetIosConf(Node::where( - function ($query) { - $query->Where("sort", "=", 0) - ->orWhere("sort", "=", 10); - } - )->where("type", "1")->where( - function ($query) use ($user) { - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->where("node_class", "<=", $user->class)->get(), $user)); + + $is_ss = 1; + if (isset($request->getQueryParams()["is_ss"])) { + $is_ss = $request->getQueryParams()["is_ss"]; + } + + $is_mu = 0; + if (isset($request->getQueryParams()["is_mu"])) { + $is_mu = $request->getQueryParams()["is_mu"]; } + + $newResponse = $response->withHeader('Content-type', ' application/octet-stream; charset=utf-8')->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')->withHeader('Content-Disposition', ' attachment; filename=allinone.conf');//->getBody()->write($builder->output()); + $newResponse->getBody()->write(LinkController::GetIosConf($user, $is_mu, $is_ss)); return $newResponse; case 3: $type = "PROXY"; @@ -232,27 +245,32 @@ class LinkController extends BaseController return null; } + $is_ss = 0; + if (isset($request->getQueryParams()["is_ss"])) { + $is_ss = $request->getQueryParams()["is_ss"]; + } + $newResponse = $response->withHeader('Content-type', ' application/octet-stream; charset=utf-8')->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')->withHeader('Content-Disposition', ' attachment; filename='.$token.'.sh');//->getBody()->write($builder->output()); - if ($user->is_admin) { - $newResponse->getBody()->write(LinkController::GetRouter(Node::where( - function ($query) { - $query->where('sort', 0) - ->orWhere('sort', 10); - } - )->where("type", "1")->get(), User::where("id", "=", $Elink->userid)->first(), $Elink->geo)); - } else { - $newResponse->getBody()->write(LinkController::GetRouter(Node::where( - function ($query) { - $query->where('sort', 0) - ->orWhere('sort', 10); - } - )->where("type", "1")->where( - function ($query) use ($user) { - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->where("node_class", "<=", $user->class)->get(), User::where("id", "=", $Elink->userid)->first(), $Elink->geo)); + $newResponse->getBody()->write(LinkController::GetRouter(User::where("id", "=", $Elink->userid)->first(), $Elink->geo, $is_ss)); + return $newResponse; + case 11: + $user=User::where("id", $Elink->userid)->first(); + if ($user == null) { + return null; + } + + $max = 0; + if (isset($request->getQueryParams()["max"])) { + $max = (int)$request->getQueryParams()["max"]; + } + + $mu = 0; + if (isset($request->getQueryParams()["mu"])) { + $mu = (int)$request->getQueryParams()["mu"]; } + + $newResponse = $response->withHeader('Content-type', ' application/octet-stream; charset=utf-8')->withHeader('Cache-Control', 'no-store, no-cache, must-revalidate')->withHeader('Content-Disposition', ' attachment; filename='.$token.'.txt'); + $newResponse->getBody()->write(LinkController::GetSSRSub(User::where("id", "=", $Elink->userid)->first(), $mu, $max)); return $newResponse; default: break; @@ -271,7 +289,7 @@ class LinkController extends BaseController return $newResponse; } - public static function GetPcConf($nodes, $user, $without_mu = 0) + public static function GetPcConf($user, $is_mu = 0, $is_ss = 0) { $string=' { @@ -315,159 +333,41 @@ class LinkController extends BaseController $json=json_decode($string, true); $temparray=array(); - if ($user->is_admin) { - $mu_nodes = Node::where('sort', 9)->where("type", "1")->get(); - } else { - $mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where("type", "1")->where( - function ($query) use ($user) { - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->get(); - } - - $relay_rules = Relay::where('user_id', $user->id)->orWhere('user_id', 0)->orderBy('id', 'asc')->get(); - - if (!Tools::is_protocol_relay($user)) { - $relay_rules = array(); - } - - if ($user->obfs_param == null) { - $user->obfs_param = ""; + $items = URL::getAllItems($user, $is_mu, $is_ss); + foreach($items as $item) { + array_push($temparray, array("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"=>Config::get('appName'), + "protocol"=>$item['protocol'], + "protoparam"=>$item['protocol_param'], + "obfs_udp"=>false, + "enable"=>true)); } - if ($user->protocol_param == null) { - $user->protocol_param = ""; - } - - foreach ($nodes as $node) { - if ($node->mu_only != 1) { - $node_name = $node->name; - - if ($node->sort == 10) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $user->port, $relay_rules); - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - array_push($temparray, array("remarks"=>$node_name, - "server"=>$node->server, - "server_port"=>$user->port, - "method"=>($node->custom_method==1?$user->method:$node->method), - "obfs"=>str_replace("_compatible", "", (($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?$user->obfs:"plain")), - "obfsparam"=>(($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?$user->obfs_param:""), - "remarks_base64"=>base64_encode($node_name), - "password"=>$user->passwd, - "tcp_over_udp"=>false, - "udp_over_tcp"=>false, - "group"=>Config::get('appName'), - "protocol"=>str_replace("_compatible", "", (($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?$user->protocol:"origin")), - "obfs_udp"=>false, - "enable"=>true)); - } - - if ($node->custom_rss == 1 && $without_mu == 0 && $node->mu_only != -1) { - foreach ($mu_nodes as $mu_node) { - $mu_user = User::where('port', '=', $mu_node->server)->first(); - - if ($mu_user == null) { - continue; - } - - if (!($mu_user->class >= $node->node_class && ($node->node_group == 0 || $node->node_group == $mu_user->node_group))) { - continue; - } - - if ($mu_user->is_multi_user == 1) { - $mu_user->obfs_param = $user->getMuMd5(); - $mu_user->protocol_param = $user->id.":".$user->passwd; - } else { - $mu_user->obfs_param = ""; - $mu_user->protocol_param = $user->id.":".$user->passwd; - } - - $node_name = $node->name; - - if ($node->sort == 10 && $mu_user->is_multi_user != 2) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $mu_user->port, $relay_rules); - - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - array_push($temparray, array("remarks"=>$node_name."- ".$mu_node->server." 端口单端口多用户", - "server"=>$node->server, - "server_port"=>$mu_user->port, - "method"=>$mu_user->method, - "group"=>Config::get('appName'), - "obfs"=>str_replace("_compatible", "", (($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->obfs:"plain")), - "obfsparam"=>(($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->obfs_param:""), - "remarks_base64"=>base64_encode($node_name."- ".$mu_node->server." 端口单端口多用户"), - "password"=>$mu_user->passwd, - "tcp_over_udp"=>false, - "udp_over_tcp"=>false, - "protocol"=>str_replace("_compatible", "", (($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->protocol:"origin")), - "protocolparam"=>(($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->protocol_param:""), - "obfs_udp"=>false, - "enable"=>true)); - } - } - } - - $json["configs"]=$temparray; return json_encode($json, JSON_PRETTY_PRINT); } - public static function GetIosConf($nodes, $user) + public static function GetIosConf($user, $is_mu = 0, $is_ss = 0) { $proxy_name=""; $proxy_group=""; - foreach ($nodes as $node) { - if ($node->sort == 0) { - $proxy_group.=$node->name.' = custom,'.$node->server.','.$user->port.','.($node->custom_method==1?$user->method:$node->method).','.$user->passwd.','.Config::get('baseUrl').'/downloads/SSEncrypt.module'."\n"; - $proxy_name.=",".$node->name; - } else { - $relay_rules = Relay::where('user_id', $user->id)->where('port', $user->port)->where( - function ($query) use ($node) { - $query->Where("source_node_id", "=", $node->id) - ->orWhere("source_node_id", "=", 0); - } - )->get(); - if (!Tools::is_protocol_relay($user)) { - $relay_rules = array(); - } - - if (count($relay_rules) != 0) { - foreach ($relay_rules as $relay_rule) { - if (!Tools::is_relay_rule_avaliable($relay_rule, $relay_rules, $node->id)) { - continue; - } - - if ($relay_rule->dist_node() != null) { - $proxy_group.=$node->name." 中转至 ".$relay_rule->Dist_Node()->name.' = custom,'.$node->server.','.$user->port.','.($node->custom_method==1?$user->method:$node->method).','.$user->passwd.','.Config::get('baseUrl').'/downloads/SSEncrypt.module'."\n"; - $proxy_name.=",".$node->name." 中转至 ".$relay_rule->Dist_Node()->name; - } else { - $proxy_group.=$node->name.' = custom,'.$node->server.','.$user->port.','.($node->custom_method==1?$user->method:$node->method).','.$user->passwd.','.Config::get('baseUrl').'/downloads/SSEncrypt.module'."\n"; - $proxy_name.=",".$node->name; - } - } - } else { - $proxy_group.=$node->name.' = custom,'.$node->server.','.$user->port.','.($node->custom_method==1?$user->method:$node->method).','.$user->passwd.','.Config::get('baseUrl').'/downloads/SSEncrypt.module'."\n"; - $proxy_name.=",".$node->name; - } - } + $items = URL::getAllItems($user, $is_mu, $is_ss); + foreach($items as $item) { + $proxy_group .= $item['remark'].' = custom,'.$item['address'].','.$item['port'].','.$item['method'].','.$item['passwd'].','.Config::get('baseUrl').'/downloads/SSEncrypt.module'.URL::getSurgeObfs($item)."\n"; + $proxy_name .= ",".$item['remark']; } - return ' [General] @@ -1816,101 +1716,42 @@ FINAL,Proxy'; return $pac_content; } - public static function GetRouter($nodes, $user, $without_mu = 0) + public static function GetRouter($user, $is_mu = 0, $is_ss = 0) { $bash = '#!/bin/sh'."\n"; $bash .= 'export PATH=\'/opt/usr/sbin:/opt/usr/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin\''."\n"; $bash .= 'export LD_LIBRARY_PATH=/lib:/opt/lib'."\n"; - $bash .= 'nvram set ss_type=1'."\n"; + $bash .= 'nvram set ss_type='.($is_ss == 1 ? '0' : '1')."\n"; $count = 0; - if($user->is_admin) { - $mu_nodes = Node::where('sort', 9)->where("type", "1")->get(); - } else { - $mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where("type", "1")->where( - function ($query) use ($user) { - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->get(); - } - - $relay_rules = Relay::where('user_id', $user->id)->where('user_id', 0)->orderBy('id', 'asc')->get(); - - if (!Tools::is_protocol_relay($user)) { - $relay_rules = array(); - } - - foreach ($nodes as $node) { - if ($node->mu_only != 1) { - $node_name = $node->name; - - if ($node->sort == 10) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $user->port, $relay_rules); - - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - $bash .= 'nvram set rt_ss_name_x'.$count.'="'.$node_name."\"\n"; - $bash .= 'nvram set rt_ss_port_x'.$count.'='.$user->port."\n"; - $bash .= 'nvram set rt_ss_password_x'.$count.'="'.$user->passwd."\"\n"; - $bash .= 'nvram set rt_ss_server_x'.$count.'='.$node->server."\n"; - $bash .= 'nvram set rt_ss_usage_x'.$count.'="'."-o ".str_replace("_compatible", "", (($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?$user->obfs:"plain"))." ".(($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?($user->obfs_param == null || $user->obfs_param == "" ? "" : "-g ".$user->obfs_param):"")." -O ".str_replace("_compatible", "", (($node->custom_rss==1&&!($user->obfs=='plain'&&$user->protocol=='origin'))?$user->protocol:"origin"))."\"\n"; - $bash .= 'nvram set rt_ss_method_x'.$count.'='.($node->custom_method==1?$user->method:$node->method)."\n"; + $items = URL::getAllItems($user, $is_mu, $is_ss); + foreach($items as $item) { + if($is_ss == 0) { + $bash .= 'nvram set rt_ss_name_x'.$count.'="'.$item['remark']."\"\n"; + $bash .= 'nvram set rt_ss_port_x'.$count.'='.$item['port']."\n"; + $bash .= 'nvram set rt_ss_password_x'.$count.'="'.$item['passwd']."\"\n"; + $bash .= 'nvram set rt_ss_server_x'.$count.'='.$item['address']."\n"; + $bash .= 'nvram set rt_ss_usage_x'.$count.'="'."-o ".$item['obfs']." -g ".$item['obfs_param']." -O ".$item['protocol']." -G ".$item['protocol_param']."\"\n"; + $bash .= 'nvram set rt_ss_method_x'.$count.'='.$item['method']."\n"; + $count += 1; + }else{ + $bash .= 'nvram set rt_ss_name_x'.$count.'="'.$item['remark']."\"\n"; + $bash .= 'nvram set rt_ss_port_x'.$count.'='.$item['port']."\n"; + $bash .= 'nvram set rt_ss_password_x'.$count.'="'.$item['passwd']."\"\n"; + $bash .= 'nvram set rt_ss_server_x'.$count.'='.$item['address']."\n"; + $bash .= 'nvram set rt_ss_method_x'.$count.'='.$item['method']."\n"; $count += 1; - } - - if ($node->custom_rss == 1 && $without_mu == 0 && $node->mu_only != -1) { - foreach ($mu_nodes as $mu_node) { - $mu_user = User::where('port', '=', $mu_node->server)->first(); - - if ($mu_user == null) { - continue; - } - - if (!($mu_user->class >= $node->node_class && ($node->node_group == 0 || $node->node_group == $mu_user->node_group))) { - continue; - } - - if ($mu_user->is_multi_user == 1) { - $mu_user->obfs_param = $user->getMuMd5(); - $mu_user->protocol_param = $user->id.":".$user->passwd; - } else { - $mu_user->obfs_param = ""; - $mu_user->protocol_param = $user->id.":".$user->passwd; - } - - $node_name = $node->name; - - if ($node->sort == 10 && $mu_user->is_multi_user != 2) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $mu_user->port, $relay_rules); - - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - $bash .= 'nvram set rt_ss_name_x'.$count.'="'.$node_name." - ".$mu_node->server." 端口单端口多用户"."\"\n"; - $bash .= 'nvram set rt_ss_port_x'.$count.'='.$mu_user->port."\n"; - $bash .= 'nvram set rt_ss_password_x'.$count.'="'.$mu_user->passwd."\"\n"; - $bash .= 'nvram set rt_ss_server_x'.$count.'='.$node->server."\n"; - $bash .= 'nvram set rt_ss_usage_x'.$count.'="'."-o ".str_replace("_compatible", "", (($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->obfs:"plain"))." ".(($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?($mu_user->obfs_param == null || $mu_user->obfs_param == "" ? "" : "-g ".$mu_user->obfs_param):"")." -O ".str_replace("_compatible", "", (($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?$mu_user->protocol:"origin"))." ".(($node->custom_rss==1&&!($mu_user->obfs=='plain'&&$mu_user->protocol=='origin'))?($mu_user->protocol_param == null || $mu_user->protocol_param == "" ? "" : "-G ".$mu_user->protocol_param):"")."\"\n"; - $bash .= 'nvram set rt_ss_method_x'.$count.'='.($node->custom_method==1?$mu_user->method:$node->method)."\n"; - $count += 1; - } } } - $bash .= "nvram set rt_ssnum_x=".$count."\n"; return $bash; } + + public static function GetSSRSub($user, $mu = 0, $max = 0) + { + return Tools::base64_url_encode(URL::getAllUrl($user, $mu, 0, 1)); + } } diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php index 811e424..24130aa 100644 --- a/app/Controllers/UserController.php +++ b/app/Controllers/UserController.php @@ -39,6 +39,7 @@ use App\Utils\Geetest; use App\Utils\Telegram; use App\Utils\TelegramSessionManager; use App\Utils\Pay; +use App\Utils\URL; use App\Services\Mail; /** @@ -55,137 +56,9 @@ class UserController extends BaseController public function index($request, $response, $args) { - /*$Speedtest['Tping']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("telecomping","desc")->get(); - $Speedtest['Uping']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("unicomping","desc")->take(3); - $Speedtest['Cping']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("cmccping","desc")->take(3); - $Speedtest['Tspeed']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("telecomeupload","desc")->take(3); - $Speedtest['Uspeed']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("unicomupload","desc")->take(3); - $Speedtest['Cspeed']=Speedtest::where("datetime",">",time()-6*3600)->orderBy("cmccupload","desc")->take(3);*/ - - if ($this->user->is_admin) { - $nodes=Node::where( - function ($query) { - $query->where('sort', 0) - ->orwhere('sort', 10); - } - )->where("type", "1")->get(); - } else { - $nodes=Node::where( - function ($query) { - $query->where('sort', 0) - ->orwhere('sort', 10); - } - )->where( - function ($query) { - $query->where("node_group", "=", $this->user->node_group) - ->orWhere("node_group", "=", 0); - } - )->where("type", "1")->where("node_class", "<=", $this->user->class)->get(); - } - - $android_add=""; - $android_add_without_mu = ""; $user = $this->user; - if ($this->user->is_admin) { - $mu_nodes = Node::where('sort', 9)->where("type", "1")->get(); - } else { - $mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where("type", "1")->where( - function ($query) use ($user) { - $query->where("node_group", "=", $user->node_group) - ->orWhere("node_group", "=", 0); - } - )->get(); - } - - $relay_rules = Relay::where('user_id', $this->user->id)->orwhere('user_id', 0)->orderBy('id', 'asc')->get(); - - if (!Tools::is_protocol_relay($user)) { - $relay_rules = array(); - } - - foreach ($nodes as $node) { - $ary['server'] = $node->server; - $ary['server_port'] = $user->port; - $ary['password'] = $user->passwd; - $ary['method'] = $node->method; - if ($node->custom_method) { - $ary['method'] = $this->user->method; - } - - if ($node->mu_only != 1) { - if ($node->custom_rss == 1) { - $node_name = $node->name; - - if ($node->sort == 10) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $user->port, $relay_rules); - - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - $ssurl = $ary['server']. ":" . $ary['server_port'].":".str_replace("_compatible", "", $user->protocol).":".$ary['method'].":".str_replace("_compatible", "", $user->obfs).":".Tools::base64_url_encode($ary['password'])."/?obfsparam=".Tools::base64_url_encode($user->obfs_param)."&remarks=".Tools::base64_url_encode($node_name) . "&group=" . Tools::base64_url_encode(Config::get('appName')); - $ssqr_s_new = "ssr://" . Tools::base64_url_encode($ssurl); - $android_add .= $ssqr_s_new." "; - $android_add_without_mu .= $ssqr_s_new." "; - } else { - $ssurl = ($node->custom_method==1?$user->method:$node->method) . ":" . $user->passwd . "@" . $node->server . ":" . $user->port; - $ssqr = "ss://" . base64_encode($ssurl); - $android_add .= $ssqr." "; - $android_add_without_mu .= $ssqr." "; - } - } - - - if ($node->custom_rss == 1 && $node->mu_only != -1) { - foreach ($mu_nodes as $mu_node) { - $mu_user = User::where('port', '=', $mu_node->server)->first(); - - if ($mu_user == null) { - continue; - } - - if (!($mu_user->class >= $node->node_class && ($node->node_group == 0 || $node->node_group == $mu_user->node_group))) { - continue; - } - - if ($mu_user->is_multi_user == 1) { - $mu_user->obfs_param = $user->getMuMd5(); - } - - $mu_user->protocol_param = $user->id.":".$user->passwd; - - $node_name = $node->name; - - if ($node->sort == 10 && $mu_user->is_multi_user != 2) { - $relay_rule = Tools::pick_out_relay_rule($node->id, $mu_user->port, $relay_rules); - - if ($relay_rule != null) { - if ($relay_rule->dist_node() != null) { - $node_name .= " - ".$relay_rule->dist_node()->name; - } - } - } - - - $ary['server_port'] = $mu_user->port; - $ary['password'] = $mu_user->passwd; - $ary['method'] = $node->method; - if ($node->custom_method) { - $ary['method'] = $mu_user->method; - } - - $ssurl = $ary['server']. ":" . $ary['server_port'].":".str_replace("_compatible", "", $mu_user->protocol).":".$ary['method'].":".str_replace("_compatible", "", $mu_user->obfs).":".Tools::base64_url_encode($ary['password'])."/?obfsparam=".Tools::base64_url_encode($mu_user->obfs_param)."&protoparam=".Tools::base64_url_encode($mu_user->protocol_param)."&remarks=".Tools::base64_url_encode($node_name." - ".$mu_node->server." 端口单端口多用户") . "&group=" . Tools::base64_url_encode(Config::get('appName')); - $ssqr_s_new = "ssr://" . Tools::base64_url_encode($ssurl); - $android_add .= $ssqr_s_new." "; - } - } - } - $ios_token = LinkController::GenerateIosCode("smart", 0, $this->user->id, 0, "smart"); $acl_token = LinkController::GenerateAclCode("smart", 0, $this->user->id, 0, "smart"); @@ -193,6 +66,7 @@ class UserController extends BaseController $router_token = LinkController::GenerateRouterCode($this->user->id, 0); $router_token_without_mu = LinkController::GenerateRouterCode($this->user->id, 1); + $ssr_sub_token = LinkController::GenerateSSRSubCode($this->user->id, 0); $uid = time().rand(1, 10000) ; if (Config::get('enable_geetest_checkin') == 'true') { @@ -204,7 +78,11 @@ class UserController extends BaseController $Ann = Ann::orderBy('date', 'desc')->first(); - return $this->view()->assign("router_token", $router_token)->assign("router_token_without_mu", $router_token_without_mu)->assign("acl_token", $acl_token)->assign('ann', $Ann)->assign('geetest_html', $GtSdk)->assign("ios_token", $ios_token)->assign("android_add", $android_add)->assign("android_add_without_mu", $android_add_without_mu)->assign('enable_duoshuo', Config::get('enable_duoshuo'))->assign('duoshuo_shortname', Config::get('duoshuo_shortname'))->assign('baseUrl', Config::get('baseUrl'))->display('user/index.tpl'); + return $this->view()->assign("ssr_sub_token", $ssr_sub_token)->assign("router_token", $router_token) + ->assign("router_token_without_mu", $router_token_without_mu)->assign("acl_token", $acl_token) + ->assign('ann', $Ann)->assign('geetest_html', $GtSdk)->assign("ios_token", $ios_token) + ->assign('enable_duoshuo', Config::get('enable_duoshuo'))->assign('duoshuo_shortname', Config::get('duoshuo_shortname')) + ->assign("user", $this->user)->registerClass("URL", "App\Utils\URL")->assign('baseUrl', Config::get('baseUrl'))->display('user/index.tpl'); } @@ -266,8 +144,10 @@ class UserController extends BaseController return $response->getBody()->write(json_encode($res)); } } - - public function f2fpayget($request, $response, $args) + + + + public function f2fpayget($request, $response, $args) { $time = $request->getQueryParams()["time"]; $res['ret'] = 1; @@ -277,44 +157,46 @@ class UserController extends BaseController public function f2fpay($request, $response, $args) { $amount = $request->getParam('amount'); - if ($amount == "") { + if ($amount == "") { $res['ret'] = 0; $res['msg'] = "订单金额错误:".$amount; return $response->getBody()->write(json_encode($res)); } - $user = $this->user; - - //生成二维码 - $qrPayResult = Pay::alipay_get_qrcode($user, $amount, $qrPay); - // 根据状态值进行业务处理 - switch ($qrPayResult->getTradeStatus()){ - case "SUCCESS": - $aliresponse = $qrPayResult->getResponse(); - $res['ret'] = 1; - $res['msg'] = "二维码生成成功"; - $res['amount'] = $amount; - $res['qrcode'] = $qrPay->create_erweima_baidu($aliresponse->qr_code); - - break; - case "FAILED": - $res['ret'] = 0; - $res['msg'] = "支付宝创建订单二维码失败!!! 请使用其他方式付款。"; - - break; - case "UNKNOWN": - $res['ret'] = 0; - $res['msg'] = "系统异常,状态未知!!!!!! 请使用其他方式付款。"; - - break; - default: - $res['ret'] = 0; - $res['msg'] = "创建订单二维码返回异常!!!!!! 请使用其他方式付款。"; - - break; - } - + $user = $this->user; + + //生成二维码 + $qrPayResult = Pay::alipay_get_qrcode($user, $amount, $qrPay); + // 根据状态值进行业务处理 + switch ($qrPayResult->getTradeStatus()){ + case "SUCCESS": + $aliresponse = $qrPayResult->getResponse(); + $res['ret'] = 1; + $res['msg'] = "二维码生成成功"; + $res['amount'] = $amount; + $res['qrcode'] = $qrPay->create_erweima_baidu($aliresponse->qr_code); + + break; + case "FAILED": + $res['ret'] = 0; + $res['msg'] = "支付宝创建订单二维码失败!!! 请使用其他方式付款。"; + + break; + case "UNKNOWN": + $res['ret'] = 0; + $res['msg'] = "系统异常,状态未知!!!!!! 请使用其他方式付款。"; + + break; + default: + $res['ret'] = 0; + $res['msg'] = "创建订单二维码返回异常!!!!!! 请使用其他方式付款。"; + + break; + } + return $response->getBody()->write(json_encode($res)); } + + public function alipay($request, $response, $args) { $amount = $request->getQueryParams()["amount"]; @@ -636,89 +518,7 @@ class UserController extends BaseController case 0: if ((($user->class>=$node->node_class&&($user->node_group==$node->node_group||$node->node_group==0))||$user->is_admin)&&($node->node_bandwidth_limit==0||$node->node_bandwidth<$node->node_bandwidth_limit)) { - $ary['server'] = $node->server; - $ary['local_address'] = '127.0.0.1'; - $ary['local_port'] = 1080; - $ary['timeout'] = 300; - $ary['workers'] = 1; - - $is_mu = 0; - - if ($mu == 0) { - $ary['server_port'] = $this->user->port; - $ary['password'] = $this->user->passwd; - $ary['method'] = $node->method; - if ($node->custom_method) { - $ary['method'] = $this->user->method; - } - - if ($node->custom_rss) { - $ary['obfs'] = str_replace("_compatible", "", $this->user->obfs); - $ary['protocol'] = str_replace("_compatible", "", $this->user->protocol); - } - } else { - if ($node->mu_only == -1) { - return; - } - - $mu_user = User::where('port', '=', $mu)->where("is_multi_user", "<>", 0)->first(); - - if ($mu_user == null) { - return; - } - if (!($mu_user->class >= $node->node_class && ($node->node_group == 0 || $node->node_group == $mu_user->node_group))) { - return; - } - $mu_user->obfs_param = $this->user->getMuMd5(); - $mu_user->protocol_param = $user->id.":".$user->passwd; - $user = $mu_user; - $node->name .= " - ".$mu." 端口单端口多用户"; - $ary['server_port'] = $mu_user->port; - $ary['password'] = $mu_user->passwd; - $ary['method'] = $node->method; - - if ($node->custom_method) { - $ary['method'] = $mu_user->method; - } - - if ($node->custom_rss) { - $ary['obfs'] = str_replace("_compatible", "", $mu_user->obfs); - if ($user->is_multi_user == 1) { - $ary['obfs_param'] = $mu_user->obfs_param; - $ary['protocol_param'] = $mu_user->protocol_param; - } else { - $ary['obfs_param'] = ""; - $ary['protocol_param'] = $mu_user->protocol_param; - $mu_user->obfs_param = ""; - } - $ary['protocol'] = str_replace("_compatible", "", $mu_user->protocol); - } - - $is_mu = 1; - } - - if ($relay_rule_id != 0) { - $node->name .= " - ".$relay_server->name; - } - - $json = json_encode($ary); - $json_show = json_encode($ary, JSON_PRETTY_PRINT); - - $ssurl = str_replace("_compatible", "", $user->obfs).":".str_replace("_compatible", "", $user->protocol).":".$ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port']."/".base64_encode($user->obfs_param); - $ssqr_s = "ss://" . base64_encode($ssurl); - $ssurl = $ary['server']. ":" . $ary['server_port'].":".str_replace("_compatible", "", $user->protocol).":".$ary['method'].":".str_replace("_compatible", "", $user->obfs).":".Tools::base64_url_encode($ary['password'])."/?obfsparam=".Tools::base64_url_encode($user->obfs_param)."&protoparam=".Tools::base64_url_encode($user->protocol_param)."&remarks=".Tools::base64_url_encode($node->name) . "&group=" . Tools::base64_url_encode(Config::get('appName')); - $ssqr_s_new = "ssr://" . Tools::base64_url_encode($ssurl); - $ssurl = $ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port']; - $ssqr = "ss://" . base64_encode($ssurl); - - $token_1 = LinkController::GenerateSurgeCode($ary['server'], $ary['server_port'], $this->user->id, 0, $ary['method']); - $token_2 = LinkController::GenerateSurgeCode($ary['server'], $ary['server_port'], $this->user->id, 1, $ary['method']); - - $surge_base = Config::get('baseUrl') . "/downloads/ProxyBase.conf"; - $surge_proxy = "#!PROXY-OVERRIDE:ProxyBase.conf\n"; - $surge_proxy .= "[Proxy]\n"; - $surge_proxy .= "Proxy = custom," . $ary['server'] . "," . $ary['server_port'] . "," . $ary['method'] . "," . $ary['password'] . "," . Config::get('baseUrl') . "/downloads/SSEncrypt.module"; - return $this->view()->assign('ary', $ary)->assign('mu', $is_mu)->assign('node', $node)->assign('user', $user)->assign('json', $json)->assign('link1', Config::get('baseUrl')."/link/".$token_1)->assign('link2', Config::get('baseUrl')."/link/".$token_2)->assign('json_show', $json_show)->assign('ssqr', $ssqr)->assign('ssqr_s_new', $ssqr_s_new)->assign('ssqr_s', $ssqr_s)->assign('surge_base', $surge_base)->assign('surge_proxy', $surge_proxy)->assign('info_server', $ary['server'])->assign('info_port', $this->user->port)->assign('info_method', $ary['method'])->assign('info_pass', $this->user->passwd)->display('user/nodeinfo.tpl'); + return $this->view()->assign('node', $node)->assign('user', $user)->assign('mu', $mu)->assign('relay_rule_id', $relay_rule_id)->registerClass("URL", "App\Utils\URL")->display('user/nodeinfo.tpl'); } break; @@ -830,102 +630,9 @@ class UserController extends BaseController case 10: if ((($user->class>=$node->node_class&&($user->node_group==$node->node_group||$node->node_group==0))||$user->is_admin)&&($node->node_bandwidth_limit==0||$node->node_bandwidth<$node->node_bandwidth_limit)) { - $relay_rule = Relay::where('id', $relay_rule_id)->where( - function ($query) use ($user) { - $query->Where("user_id", "=", $user->id) - ->orWhere("user_id", "=", 0); - } - )->first(); - - if ($relay_rule != null) { - $node->name .= " - ".$relay_rule->dist_node()->name; - } - - $ary['server'] = $node->server; - $ary['local_address'] = '127.0.0.1'; - $ary['local_port'] = 1080; - $ary['timeout'] = 300; - $ary['workers'] = 1; - - $is_mu = 0; - - if ($mu == 0) { - $ary['server_port'] = $this->user->port; - $ary['password'] = $this->user->passwd; - $ary['method'] = $node->method; - if ($node->custom_method) { - $ary['method'] = $this->user->method; - } - - if ($node->custom_rss) { - $ary['obfs'] = str_replace("_compatible", "", $this->user->obfs); - $ary['protocol'] = str_replace("_compatible", "", $this->user->protocol); - } - } else { - if ($node->mu_only == -1) { - return; - } - - $mu_user = User::where('port', '=', $mu)->where("is_multi_user", "<>", 0)->first(); - - if ($mu_user == null) { - return; - } - - if (!($mu_user->class >= $node->node_class && ($node->node_group == 0 || $node->node_group == $mu_user->node_group))) { - return; - } - $mu_user->obfs_param = $this->user->getMuMd5(); - $mu_user->protocol_param = $user->id.":".$user->passwd; - $user = $mu_user; - $node->name .= " - ".$mu." 端口单端口多用户"; - $ary['server_port'] = $mu_user->port; - $ary['password'] = $mu_user->passwd; - $ary['method'] = $node->method; - - if ($node->custom_method) { - $ary['method'] = $mu_user->method; - } - - if ($node->custom_rss) { - $ary['obfs'] = str_replace("_compatible", "", $mu_user->obfs); - if ($user->is_multi_user == 1) { - $ary['obfs_param'] = $mu_user->obfs_param; - $ary['protocol_param'] = $mu_user->protocol_param; - } else { - $ary['obfs_param'] = ""; - $ary['protocol_param'] = $mu_user->protocol_param; - $mu_user->obfs_param = ""; - } - $ary['protocol'] = str_replace("_compatible", "", $mu_user->protocol); - } - - $is_mu = 1; - } - - $json = json_encode($ary); - $json_show = json_encode($ary, JSON_PRETTY_PRINT); - - $ssurl = str_replace("_compatible", "", $user->obfs).":".str_replace("_compatible", "", $user->protocol).":".$ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port']."/".base64_encode($user->obfs_param); - $ssqr_s = "ss://" . base64_encode($ssurl); - $ssurl = $ary['server']. ":" . $ary['server_port'].":".str_replace("_compatible", "", $user->protocol).":".$ary['method'].":".str_replace("_compatible", "", $user->obfs).":".Tools::base64_url_encode($ary['password'])."/?obfsparam=".Tools::base64_url_encode($user->obfs_param)."&protoparam=".Tools::base64_url_encode($user->protocol_param)."&remarks=".Tools::base64_url_encode($node->name) . "&group=" . Tools::base64_url_encode(Config::get('appName')); - $ssqr_s_new = "ssr://" . Tools::base64_url_encode($ssurl); - $ssurl = $ary['method'] . ":" . $ary['password'] . "@" . $ary['server'] . ":" . $ary['server_port']; - $ssqr = "ss://" . base64_encode($ssurl); - - $token_1 = LinkController::GenerateSurgeCode($ary['server'], $ary['server_port'], $this->user->id, 0, $ary['method']); - $token_2 = LinkController::GenerateSurgeCode($ary['server'], $ary['server_port'], $this->user->id, 1, $ary['method']); - - $surge_base = Config::get('baseUrl') . "/downloads/ProxyBase.conf"; - $surge_proxy = "#!PROXY-OVERRIDE:ProxyBase.conf\n"; - $surge_proxy .= "[Proxy]\n"; - $surge_proxy .= "Proxy = custom," . $ary['server'] . "," . $ary['server_port'] . "," . $ary['method'] . "," . $ary['password'] . "," . Config::get('baseUrl') . "/downloads/SSEncrypt.module"; - return $this->view()->assign('ary', $ary)->assign('mu', $is_mu)->assign('node', $node)->assign('user', $user)->assign('json', $json)->assign('link1', Config::get('baseUrl')."/link/".$token_1)->assign('link2', Config::get('baseUrl')."/link/".$token_2)->assign('json_show', $json_show)->assign('ssqr', $ssqr)->assign('ssqr_s_new', $ssqr_s_new)->assign('ssqr_s', $ssqr_s)->assign('surge_base', $surge_base)->assign('surge_proxy', $surge_proxy)->assign('info_server', $ary['server'])->assign('info_port', $this->user->port)->assign('info_method', $ary['method'])->assign('info_pass', $this->user->passwd)->display('user/nodeinfo.tpl'); + return $this->view()->assign('node', $node)->assign('user', $user)->assign('mu', $mu)->assign('relay_rule_id', $relay_rule_id)->registerClass("URL", "App\Utils\URL")->display('user/nodeinfo.tpl'); } - break; - - - + break; default: echo "微笑"; @@ -934,29 +641,12 @@ class UserController extends BaseController public function GetPcConf($request, $response, $args) { - $without_mu = $request->getQueryParams()["without_mu"]; + $is_mu = $request->getQueryParams()["is_mu"]; + $is_ss = $request->getQueryParams()["is_ss"]; $newResponse = $response->withHeader('Content-type', ' application/octet-stream')->withHeader('Content-Disposition', ' attachment; filename=gui-config.json');//->getBody()->write($builder->output()); - if ($this->user->is_admin) { - $newResponse->getBody()->write(LinkController::GetPcConf(Node::where( - function ($query) { - $query->where('sort', 0) - ->orWhere('sort', 10); - } - )->where("type", "1")->get(), $this->user, $without_mu)); - } else { - $newResponse->getBody()->write(LinkController::GetPcConf(Node::where( - function ($query) { - $query->where('sort', 0) - ->orWhere('sort', 10); - } - )->where("type", "1")->where( - function ($query) { - $query->where("node_group", "=", $this->user->node_group) - ->orWhere("node_group", "=", 0); - } - )->where("node_class", "<=", $this->user->class)->get(), $this->user, $without_mu)); - } + $newResponse->getBody()->write(LinkController::GetPcConf($this->user, $is_mu, $is_ss)); + return $newResponse; } @@ -1048,7 +738,8 @@ class UserController extends BaseController $config_service = new Config(); - return $this->view()->assign('user', $this->user)->assign('themes', $themes)->assign('isBlock', $isBlock)->assign('Block', $Block)->assign('bind_token', $bind_token)->assign('telegram_bot', Config::get('telegram_bot'))->assign('config_service', $config_service)->display('user/edit.tpl'); + return $this->view()->assign('user', $this->user)->assign('themes', $themes)->assign('isBlock', $isBlock)->assign('Block', $Block)->assign('bind_token', $bind_token)->assign('telegram_bot', Config::get('telegram_bot'))->assign('config_service', $config_service) + ->registerClass("URL", "App\Utils\URL")->display('user/edit.tpl'); } @@ -1575,10 +1266,28 @@ class UserController extends BaseController return $this->echoJson($response, $res); } + if(!URL::SSCanConnect($user) && !URL::SSRCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "您这样设置之后,就没有客户端能连接上了,所以系统拒绝了您的设置,请您检查您的设置之后再进行操作。"; + return $this->echoJson($response, $res); + } + $user->save(); - $res['ret'] = 1; - $res['msg'] = "修改成功"; + if(!URL::SSCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "设置成功,但您目前的协议,混淆,加密方式设置会导致 Shadowsocks原版客户端无法连接,请您自行更换到 ShadowsocksR 客户端。"; + return $this->echoJson($response, $res); + } + + if(!URL::SSRCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "设置成功,但您目前的协议,混淆,加密方式设置会导致 ShadowsocksR 客户端无法连接,请您自行更换到 Shadowsocks 客户端。"; + return $this->echoJson($response, $res); + } + + $res['ret'] = 0; + $res['msg'] = "设置成功,您可自由选用客户端来连接。"; return $this->echoJson($response, $res); } @@ -1702,8 +1411,28 @@ class UserController extends BaseController return $this->echoJson($response, $res); } + if(!URL::SSCanConnect($user) && !URL::SSRCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "您这样设置之后,就没有客户端能连接上了,所以系统拒绝了您的设置,请您检查您的设置之后再进行操作。"; + return $this->echoJson($response, $res); + } + $user->updateMethod($method); - $res['ret'] = 1; + + if(!URL::SSCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "设置成功,但您目前的协议,混淆,加密方式设置会导致 Shadowsocks原版客户端无法连接,请您自行更换到 ShadowsocksR 客户端。"; + return $this->echoJson($response, $res); + } + + if(!URL::SSRCanConnect($user)) { + $res['ret'] = 0; + $res['msg'] = "设置成功,但您目前的协议,混淆,加密方式设置会导致 ShadowsocksR 客户端无法连接,请您自行更换到 Shadowsocks 客户端。"; + return $this->echoJson($response, $res); + } + + $res['ret'] = 0; + $res['msg'] = "设置成功,您可自由选用两种客户端来进行连接。"; return $this->echoJson($response, $res); } @@ -1810,4 +1539,12 @@ class UserController extends BaseController $newResponse = $response->withStatus(302)->withHeader('Location', '/user/edit'); return $newResponse; } + + public function resetURL($request, $response, $args) + { + $user = $this->user; + $user->clean_link(); + $newResponse = $response->withStatus(302)->withHeader('Location', '/user'); + return $newResponse; + } } diff --git a/app/Models/Shop.php b/app/Models/Shop.php index 180da3a..42a96a9 100644 --- a/app/Models/Shop.php +++ b/app/Models/Shop.php @@ -25,23 +25,26 @@ class Shop extends Model case "class": $content_text .= "为账号升级为等级 ".$value." ,有效期 ".$content["class_expire"]." 天"; break; + case "reset": + $content_text .= " 在 ".$content["reset_exp"]." 天内,每 ".$value." 天重置流量为 ".$content["reset_value"]." G "; + break; default: } - - if ($iattributes['content']); @@ -51,7 +54,7 @@ class Shop extends Model return 0; } } - + public function expire() { $content = json_decode($this->attributes['content']); @@ -61,7 +64,37 @@ class Shop extends Model return 0; } } - + + public function reset() + { + $content = json_decode($this->attributes['content']); + if (isset($content->reset)) { + return $content->reset; + } else { + return 0; + } + } + + public function reset_value() + { + $content = json_decode($this->attributes['content']); + if (isset($content->reset_value)) { + return $content->reset_value; + } else { + return 0; + } + } + + public function reset_exp() + { + $content = json_decode($this->attributes['content']); + if (isset($content->reset_exp)) { + return $content->reset_exp; + } else { + return 0; + } + } + public function user_class() { $content = json_decode($this->attributes['content']); @@ -71,7 +104,7 @@ class Shop extends Model return 0; } } - + public function class_expire() { $content = json_decode($this->attributes['content']); @@ -81,12 +114,12 @@ class Shop extends Model return 0; } } - + public function buy($user, $is_renew = 0) { $content = json_decode($this->attributes['content'], true); $content_text=""; - + foreach ($content as $key=>$value) { switch ($key) { case "bandwidth": @@ -127,7 +160,7 @@ class Shop extends Model default: } } - + $user->save(); } } diff --git a/app/Services/Config.php b/app/Services/Config.php index f4786fb..e1b2698 100644 --- a/app/Services/Config.php +++ b/app/Services/Config.php @@ -79,23 +79,32 @@ class Config switch ($type) { case 'obfs': $list = array('plain', 'http_simple', 'http_simple_compatible', 'http_post', 'http_post_compatible', - 'tls1.2_ticket_auth', 'tls1.2_ticket_auth_compatible'); + 'tls1.2_ticket_auth', 'tls1.2_ticket_auth_compatible', 'tls1.2_ticket_fastauth', 'tls1.2_ticket_fastauth_compatible', + 'simple_obfs_http', 'simple_obfs_http_compatible', 'simple_obfs_tls', 'simple_obfs_tls_compatible'); return $list; case 'protocol': $list = array('origin', 'verify_deflate', - 'auth_sha1_v4', 'auth_sha1_v4_compatible', 'auth_aes128_sha1', 'auth_aes128_md5', 'auth_chain_a'); + 'auth_sha1_v4', 'auth_sha1_v4_compatible', 'auth_aes128_sha1', 'auth_aes128_md5', 'auth_chain_a', 'auth_chain_b'); return $list; case 'allow_none_protocol': - $list = array('auth_chain_a'); + $list = array('auth_chain_a', 'auth_chain_b'); return $list; case 'relay_able_protocol': - $list = array('auth_aes128_md5', 'auth_aes128_sha1', 'auth_chain_a'); + $list = array('auth_aes128_md5', 'auth_aes128_sha1', 'auth_chain_a', 'auth_chain_b'); + return $list; + case 'ss_aead_method': + $list = array('aes-128-gcm', 'aes-192-gcm', + 'aes-256-gcm', 'chacha20-ietf-poly1305', 'xchacha20-ietf-poly1305'); + return $list; + case 'ss_obfs': + $list = array('simple_obfs_http', 'simple_obfs_http_compatible', 'simple_obfs_tls', 'simple_obfs_tls_compatible'); return $list; default: $list = array('rc4-md5', 'rc4-md5-6', 'aes-128-cfb', 'aes-192-cfb', 'aes-256-cfb', 'aes-128-ctr', 'aes-192-ctr', 'aes-256-ctr', 'camellia-128-cfb', 'camellia-192-cfb', 'camellia-256-cfb', 'bf-cfb', 'cast5-cfb', 'des-cfb', 'des-ede3-cfb', 'idea-cfb', - 'rc2-cfb', 'seed-cfb', 'salsa20', 'chacha20', 'chacha20-ietf', 'none'); + 'rc2-cfb', 'seed-cfb', 'salsa20', 'chacha20', 'chacha20-ietf', 'none', 'aes-128-gcm', 'aes-192-gcm', + 'aes-256-gcm', 'chacha20-ietf-poly1305', 'xchacha20-ietf-poly1305'); return $list; } } diff --git a/app/Utils/TelegramProcess.php b/app/Utils/TelegramProcess.php index 31887cb..7daa1fa 100644 --- a/app/Utils/TelegramProcess.php +++ b/app/Utils/TelegramProcess.php @@ -24,10 +24,10 @@ class TelegramProcess break; } $traffic = rand(Config::get('checkinMin'), Config::get('checkinMax')); - $user->transfer_enable = $user->transfer_enable + Tools::toMB($traffic); + $user->transfer_enable = $user->transfer_enable + Tools::toMB($traffic)*2; $user->last_check_in_time = time(); $user->save(); - $bot->sendMessage($message->getChat()->getId(), "天若有情天亦老,我为长者续一秒!获得了 ".$traffic." MB 流量!", $parseMode = null, $disablePreview = false, $replyToMessageId = $reply_to); + $bot->sendMessage($message->getChat()->getId(), "天若有情天亦老,我为长者续一秒!获得了 ".$traffic." MB 流量!因为我很喜欢你,所以多送你".$traffic." MB 流量!", $parseMode = null, $disablePreview = false, $replyToMessageId = $reply_to); break; default: $bot->sendMessage($message->getChat()->getId(), "???", $parseMode = null, $disablePreview = false, $replyToMessageId = $reply_to); diff --git a/app/Utils/URL.php b/app/Utils/URL.php new file mode 100644 index 0000000..c42c313 --- /dev/null +++ b/app/Utils/URL.php @@ -0,0 +1,383 @@ +where("is_multi_user", "<>", 0)->first(); + + if ($mu_user == null) { + return; + } + + return URL::SSCanConnect($mu_user); + } + + if(URL::CanMethodConnect($user->method) >= 2 && URL::CanProtocolConnect($user->protocol) >= 2 && URL::CanObfsConnect($user->obfs) >= 2) { + return true; + }else{ + return false; + } + } + + public static function SSRCanConnect($user, $mu_port = 0) { + if($mu_port != 0) { + $mu_user = User::where('port', '=', $mu_port)->where("is_multi_user", "<>", 0)->first(); + + if ($mu_user == null) { + return; + } + + return URL::SSRCanConnect($mu_user); + } + + if(URL::CanMethodConnect($user->method) != 2 && URL::CanProtocolConnect($user->protocol) != 2 && URL::CanObfsConnect($user->obfs) != 2) { + return true; + }else{ + return false; + } + } + + public static function getSSConnectInfo($user) { + $new_user = clone $user; + if(URL::CanObfsConnect($new_user->obfs) == 5) { + $new_user->obfs = 'plain'; + $new_user->obfs_param = ''; + } + + if(URL::CanProtocolConnect($new_user->protocol) == 3) { + $new_user->protocol = 'origin'; + $new_user->protocol_param = ''; + } + + $new_user->obfs = str_replace("_compatible", "", $new_user->obfs); + $new_user->protocol = str_replace("_compatible", "", $new_user->protocol); + + return $new_user; + } + + public static function getSSRConnectInfo($user) { + $new_user = clone $user; + if(URL::CanObfsConnect($new_user->obfs) == 4) { + $new_user->obfs = 'plain'; + $new_user->obfs_param = ''; + } + + $new_user->obfs = str_replace("_compatible", "", $new_user->obfs); + $new_user->protocol = str_replace("_compatible", "", $new_user->protocol); + + return $new_user; + } + + public static function getAllItems($user, $is_mu = 0, $is_ss = 0) { + $return_array = array(); + if ($user->is_admin) { + $nodes=Node::where( + function ($query) { + $query->where('sort', 0) + ->orwhere('sort', 10); + } + )->where("type", "1")->orderBy("name")->get(); + } else { + $nodes=Node::where( + function ($query) { + $query->where('sort', 0) + ->orwhere('sort', 10); + } + )->where( + function ($query) use ($user){ + $query->where("node_group", "=", $user->node_group) + ->orWhere("node_group", "=", 0); + } + )->where("type", "1")->where("node_class", "<=", $user->class)->orderBy("name")->get(); + } + + if($is_mu) { + if ($user->is_admin) { + $mu_nodes = Node::where('sort', 9)->where("type", "1")->get(); + } else { + $mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where("type", "1")->where( + function ($query) use ($user) { + $query->where("node_group", "=", $user->node_group) + ->orWhere("node_group", "=", 0); + } + )->get(); + } + } + + $relay_rules = Relay::where('user_id', $user->id)->orwhere('user_id', 0)->orderBy('id', 'asc')->get(); + + if (!Tools::is_protocol_relay($user)) { + $relay_rules = array(); + } + + foreach ($nodes as $node) { + if ($node->mu_only != 1 && $is_mu == 0) { + if ($node->sort == 10) { + $relay_rule_id = 0; + + $relay_rule = Tools::pick_out_relay_rule($node->id, $user->port, $relay_rules); + + if ($relay_rule != null) { + if ($relay_rule->dist_node() != null) { + $relay_rule_id = $relay_rule->id; + } + } + + $item = URL::getItem($user, $node, 0, $relay_rule_id, $is_ss); + if($item != null) { + array_push($return_array, $item); + } + }else{ + $item = URL::getItem($user, $node, 0, 0, $is_ss); + if($item != null) { + array_push($return_array, $item); + } + } + } + + + if ($node->custom_rss == 1 && $node->mu_only != -1 && $is_mu == 1) { + foreach ($mu_nodes as $mu_node) { + if ($node->sort == 10) { + $relay_rule_id = 0; + + $relay_rule = Tools::pick_out_relay_rule($node->id, $mu_node->server, $relay_rules); + + if ($relay_rule != null) { + if ($relay_rule->dist_node() != null) { + $relay_rule_id = $relay_rule->id; + } + } + + $item = URL::getItem($user, $node, $mu_node->server, $relay_rule_id, $is_ss); + if($item != null) { + array_push($return_array, $item); + } + }else{ + $item = URL::getItem($user, $node, $mu_node->server, 0, $is_ss); + if($item != null) { + array_push($return_array, $item); + } + } + } + } + } + + return $return_array; + } + + public static function getAllUrl($user, $is_mu, $is_ss = 0, $enter = 0) { + $items = URL::getAllItems($user, $is_mu, $is_ss); + $return_url = ''; + foreach($items as $item) { + $return_url .= URL::getItemUrl($item, $is_ss).($enter == 0 ? ' ' : "\n"); + } + return $return_url; + } + + public static function getItemUrl($item, $is_ss) { + $ss_obfs_list = Config::getSupportParam('ss_obfs'); + + if(!$is_ss) { + $ssurl = $item['address'].":".$item['port'].":".$item['protocol'].":".$item['method'].":".$item['obfs'].":".Tools::base64_url_encode($item['passwd'])."/?obfsparam=".Tools::base64_url_encode($item['obfs_param'])."&protoparam=".Tools::base64_url_encode($item['protocol_param'])."&remarks=".Tools::base64_url_encode($item['remark'])."&group=".Tools::base64_url_encode(Config::get('appName')); + return "ssr://".Tools::base64_url_encode($ssurl); + } else { + if($is_ss == 2) { + $personal_info = $item['method'].':'.$item['passwd']."@".$item['address'].":".$item['port']; + $ssurl = "ss://".Tools::base64_url_encode($personal_info); + + $ssurl .= "#".rawurlencode(Config::get('appName')." - ".$item['remark']); + }else{ + $personal_info = $item['method'].':'.$item['passwd']; + $ssurl = "ss://".Tools::base64_url_encode($personal_info)."@".$item['address'].":".$item['port']; + + if(in_array($item['obfs'], $ss_obfs_list)) { + if(strpos($item['obfs'], 'http') !== FALSE) { + $ssurl .= "?plugin=obfs-local%3Bobfs%3Dhttp"; + } else { + $ssurl .= "?plugin=obfs-local%3Bobfs%3Dtls"; + } + } + + $ssurl .= "#".rawurlencode(Config::get('appName')." - ".$item['remark']); + } + return $ssurl; + } + } + + public static function getJsonObfs($item) { + $ss_obfs_list = Config::getSupportParam('ss_obfs'); + $plugin = ""; + if(in_array($item['obfs'], $ss_obfs_list)) { + if(strpos($item['obfs'], 'http') !== FALSE) { + $plugin .= "obfs-local --obfs http"; + } else { + $plugin .= "obfs-local --obfs tls"; + } + + if($item['obfs_param'] != '') { + $plugin .= "--obfs-host ".$item['obfs_param']; + } + } + + return $plugin; + } + + public static function getSurgeObfs($item) { + $ss_obfs_list = Config::getSupportParam('ss_obfs'); + $plugin = ""; + if(in_array($item['obfs'], $ss_obfs_list)) { + if(strpos($item['obfs'], 'http') !== FALSE) { + $plugin .= ",obfs=http"; + } else { + $plugin .= ",obfs=tls"; + } + + if($item['obfs_param'] != '') { + $plugin .= ",obfs-host=".$item['obfs_param']; + } + } + + return $plugin; + } + + /* + * Conn info + * address + * port + * passwd + * method + * remark + * protocol + * protocol_param + * obfs + * obfs_param + */ + + public static function getItem($user, $node, $mu_port = 0, $relay_rule_id = 0, $is_ss = 0) { + $relay_rule = Relay::where('id', $relay_rule_id)->where( + function ($query) use ($user) { + $query->Where("user_id", "=", $user->id) + ->orWhere("user_id", "=", 0); + } + )->first(); + + $node_name = $node->name; + + if ($relay_rule != null) { + $node_name .= " - ".$relay_rule->dist_node()->name; + } + + if($mu_port != 0) { + $mu_user = User::where('port', '=', $mu_port)->where("is_multi_user", "<>", 0)->first(); + + if ($mu_user == null) { + return; + } + + $mu_user->obfs_param = $user->getMuMd5(); + $mu_user->protocol_param = $user->id.":".$user->passwd; + + $user = $mu_user; + + $node_name .= " - ".$mu_port." 端口单端口多用户"; + } + + if($is_ss) { + if(!URL::SSCanConnect($user)) { + return; + } + $user = URL::getSSConnectInfo($user); + }else{ + if(!URL::SSRCanConnect($user)) { + return; + } + $user = URL::getSSRConnectInfo($user); + } + + $return_array['address'] = $node->server; + $return_array['port'] = $user->port; + $return_array['passwd'] = $user->passwd; + $return_array['method'] = $user->method; + $return_array['remark'] = $node_name; + $return_array['protocol'] = $user->protocol; + $return_array['protocol_param'] = $user->protocol_param; + $return_array['obfs'] = $user->obfs; + $return_array['obfs_param'] = $user->obfs_param; + return $return_array; + } + + public static function cloneUser($user) { + $new_user = clone $user; + return $new_user; + } +} diff --git a/bootstrap.php b/bootstrap.php index d901b3e..ffb766e 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -11,7 +11,7 @@ use App\Services\Boot; // BASE_PATH define('BASE_PATH', __DIR__); -define('VERSION', '20170605'); +define('VERSION', '20170802'); // Vendor Autoload require BASE_PATH.'/vendor/autoload.php'; diff --git a/config/.config.php b/config/.config.php deleted file mode 100644 index e38077e..0000000 --- a/config/.config.php +++ /dev/null @@ -1,326 +0,0 @@ -Glzjin mod-2016042210000'; - -// mu key 用于校验ss-go mu的请求,半角逗号分隔 -$System_Config['muKey'] = 'mmmwhy'; -// 邮件 -$System_Config['mailDriver'] = 'mailgun'; // mailgun or smtp or sendgrid - -// 用户签到设置 -$System_Config['checkinMin'] = '1989'; // 签到最少流量 单位MB -$System_Config['checkinMax'] = '8964'; // 签到最多流量 - -// -$System_Config['defaultTraffic'] = '100'; // 用户初始流量 单位GB - -// 注册后获得的邀请码数量 -$System_Config['inviteNum'] = '0'; - -# database 数据库配置 -$System_Config['db_driver'] = 'mysql'; -$System_Config['db_host'] = 'localhost'; -$System_Config['db_database'] = 'sspanel'; -$System_Config['db_username'] = 'root'; -$System_Config['db_password'] = 'root'; -$System_Config['db_charset'] = 'utf8'; -$System_Config['db_collation'] = 'utf8_general_ci'; -$System_Config['db_prefix'] = ''; - -# redis -$System_Config['redis_scheme'] = 'tcp'; -$System_Config['redis_host'] = '127.0.0.1'; -$System_Config['redis_port'] = '6379'; -$System_Config['redis_database'] = '0'; -$System_Config['redis_password']=""; - -# mailgun -$System_Config['mailgun_key'] = ''; -$System_Config['mailgun_domain'] = ''; -$System_Config['mailgun_sender'] = ''; - -# smtp -$System_Config['smtp_host'] = ''; -$System_Config['smtp_username'] = ''; -$System_Config['smtp_port'] = '25'; -$System_Config['smtp_name'] = ''; -$System_Config['smtp_sender'] = ''; -$System_Config['smtp_passsword'] = ''; -$System_Config['smtp_ssl'] = 'false'; - -# aws -$System_Config['aws_access_key_id'] = ''; -$System_Config['aws_secret_access_key'] = ''; - - -#glzjin's time - -#功能开关 -$System_Config['enable_wecenter']='false'; -$System_Config['enable_radius']='false'; -$System_Config['enable_cloudxns']='false'; -$System_Config['enable_duoshuo']='false'; - - - - -#用户过期时间,在注册时设置。(天) -$System_Config['user_expire_in_default']='99999'; - -#Radius数据库设置 -$System_Config['radius_db_host']=''; -$System_Config['radius_db_database']=''; -$System_Config['radius_db_user']=''; -$System_Config['radius_db_password']=''; - -#Radius连接密钥 -$System_Config['radius_secret']=''; - - - - -#多说设置 -$System_Config['duoshuo_shortname']=""; -$System_Config['duoshuo_apptoken']=""; - - -#节点离线设置 -$System_Config['node_offline_warn']='true'; - -#异地登陆提示 -$System_Config['login_warn']='true'; - -#端口池 -$System_Config['min_port']='10000'; -$System_Config['max_port']='65535'; - -#两种方式相对于ss端口的偏移 -$System_Config['pacp_offset']='-20000'; -$System_Config['pacpp_offset']='-20000'; - -#测速周期/h -$System_Config['Speedtest_duration']='6'; - - -#随机分组,注册时随机分配到的分组,多个分组请用英文半角逗号分隔。 -$System_Config['ramdom_group']='0'; - -#Wecenter 数据库信息 -$System_Config['wecenter_db_host']='localhost'; -$System_Config['wecenter_db_database']=''; -$System_Config['wecenter_db_user']=''; -$System_Config['wecenter_db_password']=''; - -#系统根域名 zhaoj.in 这样 -$System_Config['wecenter_system_main_domain']=''; - -#访问路径,不开启这个功能的话就清空这个设置项吧 -$System_Config['wecenter_url']='http://help.'; - -#可从安装好的 wecenter 目录下的 system/config.inc.php 得到 - -#G_COOKIE_PREFIX -$System_Config['wecenter_cookie_prefix']='mmg_'; - -#G_COOKIE_HASH_KEY -$System_Config['wecenter_cookie_key']=''; - -#充值返利百分比 -$System_Config['code_payback']='20'; - -#注册时的流量重置日以及需要重置的流量,0不重置 -$System_Config['reg_auto_reset_day']='0'; -$System_Config['reg_auto_reset_bandwidth']='100'; - -#Cloudxns -$System_Config['cloudxns_apikey']='';#自己去 cloudxns.net 申请 -$System_Config['cloudxns_apisecret']=''; -$System_Config['cloudxns_domain']='zhaoj.in';#你的域名 - - - -#自动备份设置 -$System_Config['enable_auto_backup']='false'; -$System_Config['auto_backup_email']='your email'; -$System_Config['auto_backup_webroot']='your base dir ,such as /home/wwwroot/ss.panel/'; -$System_Config['auto_backup_passwd']='zip password'; - - -#跳转延时,ms -$System_Config['jump_delay']='1800'; - - - -#是否启用邀请码注册 -$System_Config['enable_invite_code']='false'; - -#是否启用邮箱验证码 -$System_Config['enable_email_verify']='false'; - -#邮箱验证码有效期 -$System_Config['email_verify_ttl']='3600'; - -#单IP可请求验证码次数(上面那个周期内) -$System_Config['email_verify_iplimit']='10'; - - -#注册时默认加密方式 -$System_Config['reg_method']='rc4-md5'; - -#注册时默认协议 -$System_Config['reg_protocol']='origin'; - -#注册时默认协议参数 -$System_Config['reg_protocol_param']=''; - -#注册时默认混淆方式 -$System_Config['reg_obfs']='plain'; - -#注册时默认混淆参数 -$System_Config['reg_obfs_param']=''; - -#注册时默认禁止访问IP列表,半角英文逗号分割 -$System_Config['reg_forbidden_ip']='127.0.0.0/8,::1/128'; - -#注册时默认禁止访问端口列表,半角英文逗号分割,支持端口段 -$System_Config['reg_forbidden_port']=''; - -#是否将登陆线程和IP绑定 -$System_Config['enable_login_bind_ip']='true'; - - - -#等级到期时是否重置流量 -$System_Config['enable_class_expire_reset']='true'; - -#等级到期时重置为的流量值,GB -$System_Config['enable_class_expire_reset_traffic']='0'; - -#账户到期时是否重置流量 -$System_Config['enable_account_expire_reset']='true'; - -#账户到期时重置为的流量值,GB -$System_Config['enable_account_expire_reset_traffic']='0'; - -#购买时是否重置流量 -$System_Config['enable_bought_reset']='true'; - -#账户到期之后是否会删除账户 -$System_Config['enable_account_expire_delete']='true'; - -#账户到期几天之后会删除账户 -$System_Config['enable_account_expire_delete_days']='0'; - -#验证码相关设置,自己去 Geetest.com 申请 -$System_Config['geetest_id']=''; -$System_Config['geetest_key']=''; - -#启用注册验证码 -$System_Config['enable_geetest_reg']='false'; - -#启用登录验证码 -$System_Config['enable_geetest_login']='false'; - -#启用签到验证码 -$System_Config['enable_geetest_checkin']='false'; - -#自动清理多少天没签到的0级用户 -$System_Config['enable_auto_clean_uncheck']='false'; -$System_Config['enable_auto_clean_uncheck_days']='7'; - - -#自动清理多少天没使用的0级用户 -$System_Config['enable_auto_clean_unused']='false'; -$System_Config['enable_auto_clean_unused_days']='30'; - - -#是否夹带统计代码,自己在 resources/views/{主题名} 下创建一个 analytics.tpl ,如果有必要就用 literal 界定符 -$System_Config['enable_analytics_code']='false'; - -#是否启用捐赠相关功能 -$System_Config['enable_donate']='true'; - -#telegram bot,是否启用 -$System_Config['enable_telegram']='false'; - -#telegram bot,bot 的 token ,跟 father bot 申请 -$System_Config['telegram_token']=''; - -#telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到。 -$System_Config['telegram_chatid']=''; - -#多用户混淆参数后缀 -$System_Config['mu_suffix']='baidu.com'; - -#多用户混淆参数表达式,%5m代表取用户特征 md5 的前五位,%id 代表用户id,%suffix 代表上面这个后缀。 -$System_Config['mu_regex']='%5m%id.%suffix'; - - -#图灵机器人 -$System_Config['enable_tuling']='false'; -$System_Config['tuling_apikey']=''; -$System_Config['tuling_apisecert']=''; - -#Telegram 机器人账号 -$System_Config['telegram_bot']='_bot'; - -#Telegram 机器人在群组中不回应 -$System_Config['telegram_group_quiet']='false'; - -#二维码解码方式,online,phpzbar,zxing_online,zxing_local -$System_Config['telegram_qrcode']='zxing_local'; - -#Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,复杂一些,用于校验请求,更新这个参数之后请 php xcat setTelegram -$System_Config['telegram_request_token']='sjhueAMAndnenw2k2k1mmsJSJWMWiwiwthgfhgfh'; - -# sendgrid -$System_Config['sendgrid_key'] = ''; -$System_Config['sendgrid_sender'] = ''; - - -#支付系统 - -#取值 paymentwall,zfbjk,spay,none -$System_Config['payment_system']='f2fpay'; - -#PaymentWall -$System_Config['pmw_publickey']=''; -$System_Config['pmw_privatekey']=''; -$System_Config['pmw_widget']='m2_1'; -$System_Config['pmw_height']='350px'; - -#alipay,spay -$System_Config['alipay_id']=''; -$System_Config['alipay_key']=''; - -#alipay,zfbjk.com -$System_Config['zfbjk_pid']=''; -$System_Config['zfbjk_key']=''; -$System_Config['zfbjk_qrcodeurl']='https://www.zhaojin97.cn/wp-content/uploads/2016/01/630c50ab52bc139b2a33af8cc64e47ad2016010111570425541.jpg'; - -#alipay,f2fpay ---> https://91vps.club/2017/06/09/alipay_f2f_ss_panel_mod/ -$System_Config['f2fpay_app_id']=''; -$System_Config['f2fpay_p_id']=''; -$System_Config['alipay_public_key']=''; -$System_Config['merchant_private_key']=''; -$System_Config['f2fpay_activate_key']=''; #请联系 https://t.me/gh012363 - - -#不安全中转模式,这个开启之后使用除了 auth_aes128_md5 或者 auth_aes128_sha1 以外的协议地用户也可以设置和使用中转,但是,强烈推荐不开启。 -$System_Config['relay_insecure_mode']='false'; diff --git a/config/.config.php.example b/config/.config.php.example index dd9fbfa..2a419f9 100644 --- a/config/.config.php.example +++ b/config/.config.php.example @@ -3,9 +3,9 @@ // ss-panel v3 配置 // // !!! 修改此key为随机字符串确保网站安全 !!! -$System_Config['key'] = ''; +$System_Config['key'] = 'randomkey'; $System_Config['debug'] = 'false'; // 正式环境请确保为false -$System_Config['appName'] = ''; //站点名称 +$System_Config['appName'] = 'v2no.com'; //站点名称 $System_Config['baseUrl'] = 'https://zhaojin97.cn'; // 站点地址 $System_Config['timeZone'] = 'PRC'; // PRC 天朝时间 UTC 格林时间 $System_Config['pwdMethod'] = 'sha256'; // 密码加密 可选 md5,sha256 @@ -19,7 +19,7 @@ $System_Config['tokenDriver'] = 'db'; //$System_Config['version'] = 'Glzjin mod-2016042210000'; // mu key 用于校验ss-go mu的请求,半角逗号分隔 -$System_Config['muKey'] = 'mmmwhy'; +$System_Config['muKey'] = 'mupass'; // 邮件 $System_Config['mailDriver'] = 'mailgun'; // mailgun or smtp or sendgrid @@ -37,7 +37,7 @@ $System_Config['inviteNum'] = '0'; $System_Config['db_driver'] = 'mysql'; $System_Config['db_host'] = 'localhost'; $System_Config['db_database'] = 'sspanel'; -$System_Config['db_username'] = 'root'; +$System_Config['db_username'] = 'sspanel'; $System_Config['db_password'] = 'root'; $System_Config['db_charset'] = 'utf8'; $System_Config['db_collation'] = 'utf8_general_ci'; @@ -84,10 +84,10 @@ $System_Config['enable_duoshuo']='false'; $System_Config['user_expire_in_default']='99999'; #Radius数据库设置 -$System_Config['radius_db_host']=''; -$System_Config['radius_db_database']=''; -$System_Config['radius_db_user']=''; -$System_Config['radius_db_password']=''; +$System_Config['radius_db_host']='localhost'; +$System_Config['radius_db_database']='radius'; +$System_Config['radius_db_user']='radius'; +$System_Config['radius_db_password']='root'; #Radius连接密钥 $System_Config['radius_secret']=''; @@ -171,7 +171,7 @@ $System_Config['jump_delay']='1800'; $System_Config['enable_invite_code']='false'; #是否启用邮箱验证码 -$System_Config['enable_email_verify']='flase'; +$System_Config['enable_email_verify']='false'; #邮箱验证码有效期 $System_Config['email_verify_ttl']='3600'; @@ -294,10 +294,11 @@ $System_Config['sendgrid_key'] = ''; $System_Config['sendgrid_sender'] = ''; + #支付系统 -#取值 paymentwall,zfbjk,spay,none -$System_Config['payment_system']='none'; +#取值 paymentwall,zfbjk,spay,f2fpay,none +$System_Config['payment_system']=''; #PaymentWall $System_Config['pmw_publickey']=''; @@ -314,11 +315,6 @@ $System_Config['zfbjk_pid']=''; $System_Config['zfbjk_key']=''; $System_Config['zfbjk_qrcodeurl']='https://www.zhaojin97.cn/wp-content/uploads/2016/01/630c50ab52bc139b2a33af8cc64e47ad2016010111570425541.jpg'; -#alipay,f2fpay -$System_Config['f2fpay_app_id']=''; -$System_Config['f2fpay_p_id']=''; -$System_Config['alipay_public_key']=''; -$System_Config['merchant_private_key']=''; #不安全中转模式,这个开启之后使用除了 auth_aes128_md5 或者 auth_aes128_sha1 以外的协议地用户也可以设置和使用中转,但是,强烈推荐不开启。 $System_Config['relay_insecure_mode']='false'; diff --git a/resources/views/material/admin/shop/create.tpl b/resources/views/material/admin/shop/create.tpl index 915fa37..82a6ab5 100644 --- a/resources/views/material/admin/shop/create.tpl +++ b/resources/views/material/admin/shop/create.tpl @@ -16,7 +16,7 @@
- +
@@ -25,19 +25,19 @@
- - + +
- +
- - + +
@@ -45,12 +45,12 @@
- +
- +
- +
-
- - +
+ +
- +
-
- + +
- +
- +
-
- - + + +
+
+
+
+ + +
+ + +
+ + +
+ +
+ + +
+
+
+
+ + + +
- +
@@ -108,23 +132,23 @@
- + {include file='dialog.tpl'} - - - - + + + +
- - - + + +
- - - - + + + + @@ -146,20 +170,23 @@ { var auto_reset_bandwidth=0; } - + $.ajax({ type: "POST", url: "/admin/shop", dataType: "json", data: { name: $("#name").val(), - auto_reset_bandwidth: auto_reset_bandwidth, + auto_reset_bandwidth: auto_reset_bandwidth, price: $("#price").val(), auto_renew: $("#auto_renew").val(), bandwidth: $("#bandwidth").val(), expire: $("#expire").val(), class: $("#class").val(), - class_expire: $("#class_expire").val() + class_expire: $("#class_expire").val(), + reset: $("#reset").val(), + reset_value: $("#reset_value").val(), + reset_exp: $("#reset_exp").val(), }, success: function (data) { if (data.ret) { @@ -187,4 +214,4 @@ submit(); }); }) - \ No newline at end of file + diff --git a/resources/views/material/admin/shop/edit.tpl b/resources/views/material/admin/shop/edit.tpl index e8a8610..8eaa69f 100644 --- a/resources/views/material/admin/shop/edit.tpl +++ b/resources/views/material/admin/shop/edit.tpl @@ -16,7 +16,7 @@
- +
@@ -25,20 +25,20 @@
- - + +
- +
- - - + + +
@@ -46,13 +46,13 @@
- +
- - + +
- +
-
- - +
+ +
- +
-
- +
+
- +
- +
-
- - + + +
+
+
+
+ + +
+ + +
+ + +
+ +
+ + +
+
+
+
+ +
- +
@@ -110,23 +132,23 @@
- + {include file='dialog.tpl'} - - - - + + + +
- - - + + +
- - - - + + + + @@ -148,7 +170,7 @@ { var auto_reset_bandwidth=0; } - + $.ajax({ type: "PUT", url: "/admin/shop/{$shop->id}", @@ -161,7 +183,10 @@ bandwidth: $("#bandwidth").val(), expire: $("#expire").val(), class: $("#class").val(), - class_expire: $("#class_expire").val() + class_expire: $("#class_expire").val(), + reset: $("#reset").val(), + reset_value: $("#reset_value").val(), + reset_exp: $("#reset_exp").val(), }, success: function (data) { if (data.ret) { @@ -189,4 +214,4 @@ submit(); }); }) - \ No newline at end of file + diff --git a/resources/views/material/staff.tpl b/resources/views/material/staff.tpl index b80cb3b..69d9e04 100644 --- a/resources/views/material/staff.tpl +++ b/resources/views/material/staff.tpl @@ -143,7 +143,7 @@

致谢

-

本站使用91vps.club教程搭建

+

本站使用v2no.com教程搭建

diff --git a/resources/views/material/user/edit.tpl b/resources/views/material/user/edit.tpl index 1209b46..483708a 100644 --- a/resources/views/material/user/edit.tpl +++ b/resources/views/material/user/edit.tpl @@ -75,13 +75,14 @@

加密方式修改

+

注意:SS 和 SSR 支持的加密方式有所不同,请根据实际情况来进行选择!

当前加密方式:{$user->method}

@@ -151,15 +152,16 @@
-

SSR 协议&混淆设置

+

协议&混淆设置

当前协议:{$user->protocol}

-

注意:如果需要兼容原版SS请选择带_compatible的兼容选项!

+

注意1:如果需要兼容原版SS请选择带_compatible的兼容选项!

+

注意2:如果您使用原版 SS 客户端此处请直接设置为 origin!

@@ -168,13 +170,14 @@

当前混淆方式:{$user->obfs}

-

注意:如果需要兼容原版SS请选择带_compatible的兼容选项!

+

注意1:如果需要兼容原版SS请选择带_compatible的兼容选项!

+

注意2:SS 和 SSR 支持的混淆类型有所不同,simple_obfs_* 为原版 SS 的混淆方式,其他为 SSR 的混淆方式!

diff --git a/resources/views/material/user/index.tpl b/resources/views/material/user/index.tpl index 406c890..ba7b227 100644 --- a/resources/views/material/user/index.tpl +++ b/resources/views/material/user/index.tpl @@ -6,10 +6,7 @@ {include file='user/main.tpl'} - - - - +{$ssr_prefer = URL::SSRCanConnect($user, 0)}
@@ -40,56 +37,196 @@
-

All-in-One

-

这里为您提供了自动化地配置文件生成,包含了所有 Shadowsocks 服务器的信息,方便您在诸多的服务器中快速添加,快速切换。

+

连接信息 以及 All-in-One(快速配置指导)

+

您可以在这里查看您的连接信息。
同时,这里为您提供了自动化地配置文件生成,包含了所有 Shadowsocks 服务器的信息,方便您在诸多的服务器中快速添加,快速切换。

-
-

下载,解压,运行程序,然后您有两种方式导入所有节点
(1)下载这个或者这个(无单端口多用户),右键小飞机 服务器 -- 从配置文件导入服务器,选择这个文件,
(2)点击这里或者这个(无单端口多用户),然后右键小飞机 -- 从剪贴板复制地址
然后选择一个合适的服务器,更新一下PAC为绕过国内IP,然后开启系统代理即可上网。

-
-
-

下载,安装,然后下载这个或者这个(无单端口多用户),运行程序,小飞机上右键 服务器列表 子菜单 的 “导入服务器配置文件...” 导入这个文件,然后选择一个合适的服务器,更新一下PAC,然后开启系统代理即可上网。

-
-
-

推荐下载Shadowrocket,然后在 Safari 中点击这个或者这个(无单端口多用户),然后点击确定,就可以批量添加节点。

-

iOS 下载这个,导入到 Surge 中,然后就可以随意切换服务器上网了。

-
-
-

下载,安装,然后在手机上默认浏览器中点击这个或者这个(无单端口多用户),然后点击确定,批量添加完节点,然后路由选择绕过大陆,右上角开启就可以上网了。同时提供一个 ACL 地址,长按复制地址到客户端里应用即可。

+
+ {$pre_user = URL::cloneUser($user)} + + +
+ {$user = URL::getSSRConnectInfo($pre_user)} + {$ssr_url_all = URL::getAllUrl($pre_user, 0, 0)} + {$ssr_url_all_mu = URL::getAllUrl($pre_user, 1, 0)} + {if URL::SSRCanConnect($user)} +
+

端口
+
{$user->port}

+ +

密码
+
{$user->passwd}

+ +

自定义加密
+
{$user->method}

+ +

自定义协议
+
{$user->protocol}

+ +

自定义混淆
+
{$user->obfs}

+
+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ +

同时, ShadowsocksR 单端口多用户的连接不受您设置的影响,您可以在此使用相应的客户端进行连接~

+ {/if} +
+
+

下载,解压,运行程序,然后您有三种方式导入所有节点
+ (1)下载这个(普通端口)或者这个(单端口多用户),右键小飞机 服务器 -- 从配置文件导入服务器,选择这个文件,
+ (2)点击这里(普通端口)或者这个(单端口多用户),然后右键小飞机 -- 从剪贴板复制地址
+ (3)(推荐)右键小飞机--服务器--SSR服务器订阅设置,将订阅地址设置为下面的地址,其他参数留空,确定之后再更新 SSR 服务器订阅。
+ 然后选择一个合适的服务器,系统代理模式选”全局模式”,代理规则选“绕过局域网和大陆”,然后即可上网。

+ +

SSR 订阅地址:
+ 普通端口地址:{$baseUrl}/link/{$ssr_sub_token}?mu=0
+ 单端口多用户端口地址:{$baseUrl}/link/{$ssr_sub_token}?mu=1 +

+
+
+

下载,安装,然后下载这个(普通端口)或者这个(单端口多用户),运行程序,小飞机上右键 服务器列表 子菜单 的 “导入服务器配置文件...” 导入这个文件,然后选择一个合适的服务器,更新一下PAC,然后开启系统代理即可上网。

+
+
+

推荐下载Shadowrocket,然后在 Safari 中点击这个(普通端口)或者这个(单端口多用户),然后点击确定,就可以批量添加节点。

+
+
+

下载,安装,然后在手机上默认浏览器中点击这个链接(普通端口)或者这个链接(单端口多用户),然后点击确定,批量添加完节点,然后路由选择绕过大陆,右上角开启就可以上网了。同时提供一个 ACL 地址,长按复制地址到客户端里应用即可。

+

SSR 订阅地址,您可以在节点列表处添加订阅来自动更新节点:
+ 普通端口地址:{$baseUrl}/link/{$ssr_sub_token}?mu=0
+ 单端口多用户端口地址:{$baseUrl}/link/{$ssr_sub_token}?mu=1 +

+
+
+

路由器 刷入这个固件,然后 SSH 登陆路由器,执行以下命令(导入普通端口)
+ wget -O- {$baseUrl}/link/{$router_token}?is_ss=0 | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token}?is_ss=0 | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
+ 或者这个单端口多用户的
+ wget -O- {$baseUrl}/link/{$router_token_without_mu}?is_ss=0 | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token_without_mu}?is_ss=0 | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
+ 执行完毕以后就可以到路由器的设置面板里随意选择 Shadowsocks 服务器进行连接了。

+
+
-
-

路由器 刷入这个固件,然后 SSH 登陆路由器,执行以下命令
- wget -O- {$baseUrl}/link/{$router_token} | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token} | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
- 或者这个不含单端口多用户的
- wget -O- {$baseUrl}/link/{$router_token_without_mu} | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token_without_mu} | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
- 执行完毕以后就可以到路由器的设置面板里随意选择 Shadowsocks 服务器进行连接了。

+
+ +
+ {$user = URL::getSSConnectInfo($pre_user)} + {$ss_url_all = URL::getAllUrl($pre_user, 0, 1)} + {$ss_url_all_mu = URL::getAllUrl($pre_user, 1, 1)} + {$ss_url_all_win = URL::getAllUrl($pre_user, 0, 2)} + + {if URL::SSCanConnect($user)} +
+

各个节点的地址请到节点列表查看!

+ + +

端口
+
{$user->port}

+ +

密码
+
{$user->passwd}

+ +

自定义加密
+
{$user->method}

+ +

自定义混淆
+
{$user->obfs}

+
+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 SS 客户端下无法连接。请您选用 SSR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+

同时, Shadowsocks 单端口多用户的连接不受您设置的影响,您可以在此使用相应的客户端进行连接~

+ {/if} +
+
+

下载,解压,运行程序,然后您有两种方式导入所有节点
+ (1)下载这个(普通端口),放到小飞机的目录下,然后打开小飞机。
+ (2)点击这里(普通端口), 然后右键小飞机 -- 从剪贴板导入 URL
+

+
+

下载,安装,然后下载这个(普通端口)或者这个(单端口多用户),运行程序,小飞机上右键 服务器列表 子菜单 的 “导入服务器配置文件...” 导入这个文件,然后选择一个合适的服务器,更新一下PAC,然后开启系统代理即可上网。

+
+
+

推荐下载Shadowrocket,然后在 Safari 中点击这个(普通端口)或者这个(单端口多用户),然后点击确定,就可以批量添加节点。

+

iOS 下载这个(普通端口)或者这个(单端口多用户),导入到 Surge 中,然后就可以随意切换服务器上网了。

+
+
+

下载,再下载,然后安装,然后在手机上点击这个链接(普通端口)或者这个链接(单端口多用户端口)复制到剪贴板,打开 Shadowsocks 客户端,选择从剪贴板导入,然后选择一个节点,设置一下路由为绕过大陆,点击飞机就可以上网了。

+
+
+

路由器 刷入这个固件,然后 SSH 登陆路由器,执行以下命令(导入普通端口)
+ wget -O- {$baseUrl}/link/{$router_token}?is_ss=1 | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token}?is_ss=1 | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
+ 或者这个单端口多用户的
+ wget -O- {$baseUrl}/link/{$router_token_without_mu}?is_ss=1 | bash && echo -e "\n0 */3 * * * wget -O- {$baseUrl}/link/{$router_token_without_mu}?is_ss=1 | bash\n">> /etc/storage/cron/crontabs/admin && killall crond && crond
+ 执行完毕以后就可以到路由器的设置面板里随意选择 Shadowsocks 服务器进行连接了。

+
+
+
+ +
+
@@ -110,21 +247,15 @@ {else}
不限速
{/if}

+ +

上次使用
+
{$user->lastSsTime()}

- - - -
- -
- - -
@@ -216,36 +347,6 @@
-
-
-
-

连接信息

-
-

端口
-
{$user->port}

- -

密码
-
{$user->passwd}

- -

自定义加密
-
{$user->method}

- -

自定义协议
-
{$user->protocol}

- -

自定义混淆
-
{$user->obfs}

- -

上次使用
-
{$user->lastSsTime()}

-
-
- -
-
- - - {if $enable_duoshuo=='true'} diff --git a/resources/views/material/user/nodeinfo.tpl b/resources/views/material/user/nodeinfo.tpl index ad24444..a035e70 100644 --- a/resources/views/material/user/nodeinfo.tpl +++ b/resources/views/material/user/nodeinfo.tpl @@ -4,7 +4,7 @@ {include file='user/header_info.tpl'} - +{$ssr_prefer = URL::SSRCanConnect($user, $mu)} @@ -30,36 +30,103 @@
+ +

配置信息

-

服务器地址:{$ary['server']}
- 服务器端口:{$ary['server_port']}
- 加密方式:{$ary['method']}
- 密码:{$ary['password']}
- 协议:{$user->protocol}
- 协议参数:{$user->protocol_param}
- 混淆:{$user->obfs}
- 混淆参数:{$user->obfs_param}
- -

+
+ + +
+ {if URL::SSRCanConnect($user, $mu)} + {$ssr_item = URL::getItem($user, $node, $mu, $relay_rule_id, 0)} +

服务器地址:{$ssr_item['address']}
+ 服务器端口:{$ssr_item['port']}
+ 加密方式:{$ssr_item['method']}
+ 密码:{$ssr_item['passwd']}
+ 协议:{$ssr_item['protocol']}
+ 协议参数:{$ssr_item['protocol_param']}
+ 混淆:{$ssr_item['obfs']}
+ 混淆参数:{$ssr_item['obfs_param']}

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+

同时, ShadowsocksR 单端口多用户的连接不受您设置的影响,您可以在此使用相应的客户端进行连接~

+ {/if} +
+
+ {if URL::SSCanConnect($user, $mu)} + {$ss_item = URL::getItem($user, $node, $mu, $relay_rule_id, 1)} +

服务器地址:{$ss_item['address']}
+ 服务器端口:{$ss_item['port']}
+ 加密方式:{$ss_item['method']}
+ 密码:{$ss_item['passwd']}
+ 混淆:{$ss_item['obfs']}
+ 混淆参数:{$ss_item['obfs_param']}

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 Shadowsocks 客户端下无法连接。请您选用 ShadowsocksR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
-
+ + +

客户端下载

-

desktop_windows Windows

-

laptop_mac Mac OS X

-

laptop_windows Linux

-

android Android

-

phone_iphone iOS

+ + + +
+ {if URL::SSRCanConnect($user, $mu)} +

desktop_windows Windows

+

laptop_mac Mac OS X

+

laptop_windows Linux

+

android Android

+

phone_iphone iOS

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
+ {if URL::SSCanConnect($user, $mu)} +

desktop_windows Windows

+

laptop_mac Mac OS X

+

laptop_windows Linux

+

android Android

+

android Android Obfs插件

+

phone_iphone iOS

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 Shadowsocks 客户端下无法连接。请您选用 ShadowsocksR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
@@ -70,8 +137,60 @@
-

SSR-Python 配置Json

- +

配置Json

+ + +
+ {if URL::SSRCanConnect($user, $mu)} + + {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
+ {if URL::SSCanConnect($user, $mu)} + + {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 Shadowsocks 客户端下无法连接。请您选用 ShadowsocksR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
@@ -83,40 +202,90 @@ -
-
- - {if $mu == 0} -
-
-
-
-

原版配置二维码

-
-
-
+ +
+ {if URL::SSRCanConnect($user, $mu)} +

Android 手机上用默认浏览器打开点我就可以直接添加了(给 ShadowsocksR APP)

+

iOS 上用 Safari 打开点我就可以直接添加了(给 Shadowrocket)

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
+ {if URL::SSCanConnect($user, $mu)} +

Android 手机上用默认浏览器打开点我就可以直接添加了(给 Shadowsocks)

+

iOS 上用 Safari 打开点我就可以直接添加了(给 Shadowrocket)

+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 Shadowsocks 客户端下无法连接。请您选用 ShadowsocksR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if}
-
+
- {/if} +
-

SSR 配置二维码

-
-
+

配置二维码

+ + + +
+ {if URL::SSRCanConnect($user, $mu)} +
+
+
+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 ShadowsocksR 客户端下无法连接。请您选用 Shadowsocks 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if} +
+
+ {if URL::SSCanConnect($user, $mu)} + +
+
+
+
+
+
+
+
+
+
+ {else} +

您好,您目前的 加密方式,混淆,或者协议设置在 Shadowsocks 客户端下无法连接。请您选用 ShadowsocksR 客户端来连接,或者到 资料编辑 页面修改后再来查看此处。

+ {/if}
@@ -125,31 +294,6 @@
- {if $mu == 0} -
-
-
-
- -

iOS9 上 Surge 配置

-
- -
-

您要先安装 surge 。

-

配置的话,直接下载生成好的配置文件,然后在 APP 里添加设置时选择 Download configuration from URL ,把地址粘贴进去添加。

-

第一种分流方式,按照域名的文件下载地址,点击直接下载:{$link1}

- -

第二种分流方式,按照地区的文件下载地址,感谢 @Tony 提供,点击直接下载:{$link2}

-
-
-
-
-
- -
-
-
- {/if}
@@ -168,15 +312,24 @@ diff --git a/sql/sspanel.sql b/sql/sspanel.sql new file mode 100644 index 0000000..90f23b9 --- /dev/null +++ b/sql/sspanel.sql @@ -0,0 +1,903 @@ +-- phpMyAdmin SQL Dump +-- version 4.4.15.6 +-- http://www.phpmyadmin.net +-- +-- Host: localhost +-- Generation Time: 2017-05-26 20:29:46 +-- 服务器版本: 5.5.48-log +-- PHP Version: 7.0.7 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `sspanel` +-- + +-- -------------------------------------------------------- + +-- +-- 表的结构 `alive_ip` +-- + +CREATE TABLE IF NOT EXISTS `alive_ip` ( + `id` bigint(20) NOT NULL, + `nodeid` int(11) NOT NULL, + `userid` int(11) NOT NULL, + `ip` text NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `announcement` +-- + +CREATE TABLE IF NOT EXISTS `announcement` ( + `id` int(11) NOT NULL, + `date` datetime NOT NULL, + `content` longtext NOT NULL, + `markdown` longtext NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `auto` +-- + +CREATE TABLE IF NOT EXISTS `auto` ( + `id` bigint(20) NOT NULL, + `type` int(11) NOT NULL, + `value` longtext NOT NULL, + `sign` longtext NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `blockip` +-- + +CREATE TABLE IF NOT EXISTS `blockip` ( + `id` bigint(20) NOT NULL, + `nodeid` int(11) NOT NULL, + `ip` text NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `bought` +-- + +CREATE TABLE IF NOT EXISTS `bought` ( + `id` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL, + `shopid` bigint(20) NOT NULL, + `datetime` bigint(20) NOT NULL, + `renew` bigint(11) NOT NULL, + `coupon` text NOT NULL, + `price` decimal(12,2) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `code` +-- + +CREATE TABLE IF NOT EXISTS `code` ( + `id` bigint(20) NOT NULL, + `code` text NOT NULL, + `type` int(11) NOT NULL, + `number` decimal(11,2) NOT NULL, + `isused` int(11) NOT NULL DEFAULT '0', + `userid` bigint(20) NOT NULL, + `usedatetime` datetime NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `coupon` +-- + +CREATE TABLE IF NOT EXISTS `coupon` ( + `id` bigint(20) NOT NULL, + `code` text NOT NULL, + `onetime` int(11) NOT NULL, + `expire` bigint(20) NOT NULL, + `shop` text NOT NULL, + `credit` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `detect_list` +-- + +CREATE TABLE IF NOT EXISTS `detect_list` ( + `id` bigint(20) NOT NULL, + `name` longtext NOT NULL, + `text` longtext NOT NULL, + `regex` longtext NOT NULL, + `type` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `detect_log` +-- + +CREATE TABLE IF NOT EXISTS `detect_log` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL, + `list_id` bigint(20) NOT NULL, + `datetime` bigint(20) NOT NULL, + `node_id` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `disconnect_ip` +-- + +CREATE TABLE IF NOT EXISTS `disconnect_ip` ( + `id` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL, + `ip` text NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `email_verify` +-- + +CREATE TABLE IF NOT EXISTS `email_verify` ( + `id` bigint(20) NOT NULL, + `email` text NOT NULL, + `ip` text NOT NULL, + `code` text NOT NULL, + `expire_in` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `link` +-- + +CREATE TABLE IF NOT EXISTS `link` ( + `id` bigint(20) NOT NULL, + `type` int(11) NOT NULL, + `address` text NOT NULL, + `port` int(11) NOT NULL, + `token` text NOT NULL, + `ios` int(11) NOT NULL DEFAULT '0', + `userid` bigint(20) NOT NULL, + `isp` text, + `geo` int(11) DEFAULT NULL, + `method` text +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +-- +-- 转存表中的数据 `link` +-- + +INSERT INTO `link` (`id`, `type`, `address`, `port`, `token`, `ios`, `userid`, `isp`, `geo`, `method`) VALUES +(1, -1, 'smart', 0, 'uqLssejxwrnwpMj7', 1, 1, NULL, 0, 'smart'), +(2, 9, 'smart', 0, '7d7VqbO3kDPeXyOq', 0, 1, NULL, 0, 'smart'), +(3, 10, '', 0, 'SLXNV6TKViEvIkV7', 0, 1, NULL, 0, ''), +(4, 10, '', 0, 'tyMNIMkJiSZCRwbz', 0, 1, NULL, 1, ''); + +-- -------------------------------------------------------- + +-- +-- 表的结构 `login_ip` +-- + +CREATE TABLE IF NOT EXISTS `login_ip` ( + `id` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL, + `ip` text NOT NULL, + `datetime` bigint(20) NOT NULL, + `type` int(11) NOT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- +-- 转存表中的数据 `login_ip` +-- + +INSERT INTO `login_ip` (`id`, `userid`, `ip`, `datetime`, `type`) VALUES +(1, 1, '211.86.158.21', 1495801576, 0); + +-- -------------------------------------------------------- + +-- +-- 表的结构 `payback` +-- + +CREATE TABLE IF NOT EXISTS `payback` ( + `id` bigint(20) NOT NULL, + `total` decimal(12,2) NOT NULL, + `userid` bigint(20) NOT NULL, + `ref_by` bigint(20) NOT NULL, + `ref_get` decimal(12,2) NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `paylist` +-- + +CREATE TABLE IF NOT EXISTS `paylist` ( + `id` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL, + `total` decimal(12,2) NOT NULL, + `status` int(11) NOT NULL DEFAULT '0', + `tradeno` text, + `datetime` bigint(20) NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `radius_ban` +-- + +CREATE TABLE IF NOT EXISTS `radius_ban` ( + `id` int(11) NOT NULL, + `userid` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `relay` +-- + +CREATE TABLE IF NOT EXISTS `relay` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL, + `source_node_id` bigint(20) NOT NULL, + `dist_node_id` bigint(20) NOT NULL, + `dist_ip` text NOT NULL, + `port` int(11) NOT NULL, + `priority` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `shop` +-- + +CREATE TABLE IF NOT EXISTS `shop` ( + `id` bigint(20) NOT NULL, + `name` text NOT NULL, + `price` decimal(12,2) NOT NULL, + `content` text NOT NULL, + `auto_renew` int(11) NOT NULL, + `auto_reset_bandwidth` int(11) NOT NULL DEFAULT '0', + `status` int(11) NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `speedtest` +-- + +CREATE TABLE IF NOT EXISTS `speedtest` ( + `id` bigint(20) NOT NULL, + `nodeid` int(11) NOT NULL, + `datetime` bigint(20) NOT NULL, + `telecomping` text NOT NULL, + `telecomeupload` text NOT NULL, + `telecomedownload` text NOT NULL, + `unicomping` text NOT NULL, + `unicomupload` text NOT NULL, + `unicomdownload` text NOT NULL, + `cmccping` text NOT NULL, + `cmccupload` text NOT NULL, + `cmccdownload` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ss_invite_code` +-- + +CREATE TABLE IF NOT EXISTS `ss_invite_code` ( + `id` int(11) NOT NULL, + `code` varchar(128) NOT NULL, + `user_id` int(11) NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updated_at` timestamp NOT NULL DEFAULT '2016-06-01 00:00:00' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ss_node` +-- + +CREATE TABLE IF NOT EXISTS `ss_node` ( + `id` int(11) NOT NULL, + `name` varchar(128) NOT NULL, + `type` int(3) NOT NULL, + `server` varchar(128) NOT NULL, + `method` varchar(64) NOT NULL, + `info` varchar(128) NOT NULL, + `status` varchar(128) NOT NULL, + `sort` int(3) NOT NULL, + `custom_method` tinyint(1) NOT NULL DEFAULT '0', + `traffic_rate` float NOT NULL DEFAULT '1', + `node_class` int(11) NOT NULL DEFAULT '0', + `node_speedlimit` decimal(12,2) NOT NULL DEFAULT '0.00', + `node_connector` int(11) NOT NULL DEFAULT '0', + `node_bandwidth` bigint(20) NOT NULL DEFAULT '0', + `node_bandwidth_limit` bigint(20) NOT NULL DEFAULT '0', + `bandwidthlimit_resetday` int(11) NOT NULL DEFAULT '0', + `node_heartbeat` bigint(20) NOT NULL DEFAULT '0', + `node_ip` text, + `node_group` int(11) NOT NULL DEFAULT '0', + `custom_rss` int(11) NOT NULL DEFAULT '0', + `mu_only` int(11) DEFAULT '0' +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4; + +-- +-- 转存表中的数据 `ss_node` +-- + +INSERT INTO `ss_node` (`id`, `name`, `type`, `server`, `method`, `info`, `status`, `sort`, `custom_method`, `traffic_rate`, `node_class`, `node_speedlimit`, `node_connector`, `node_bandwidth`, `node_bandwidth_limit`, `bandwidthlimit_resetday`, `node_heartbeat`, `node_ip`, `node_group`, `custom_rss`, `mu_only`) VALUES +(1, '统一验证登陆', 0, 'zhaojin97.cn', 'radius', '统一登陆验证', '可用', 999, 0, 1, 0, '0.00', 0, 0, 0, 0, 0, '', 0, 0, 0), +(2, 'VPN 统一流量结算', 0, 'zhaojin97.cn', 'radius', 'VPN 统一流量结算', '可用', 999, 0, 1, 0, '0.00', 0, 0, 0, 0, 0, NULL, 0, 0, 0); + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ss_node_info` +-- + +CREATE TABLE IF NOT EXISTS `ss_node_info` ( + `id` int(11) NOT NULL, + `node_id` int(11) NOT NULL, + `uptime` float NOT NULL, + `load` varchar(32) NOT NULL, + `log_time` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ss_node_online_log` +-- + +CREATE TABLE IF NOT EXISTS `ss_node_online_log` ( + `id` int(11) NOT NULL, + `node_id` int(11) NOT NULL, + `online_user` int(11) NOT NULL, + `log_time` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ss_password_reset` +-- + +CREATE TABLE IF NOT EXISTS `ss_password_reset` ( + `id` int(11) NOT NULL, + `email` varchar(32) NOT NULL, + `token` varchar(128) NOT NULL, + `init_time` int(11) NOT NULL, + `expire_time` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `telegram_session` +-- + +CREATE TABLE IF NOT EXISTS `telegram_session` ( + `id` bigint(20) NOT NULL, + `user_id` bigint(20) NOT NULL, + `type` int(11) NOT NULL, + `session_content` text NOT NULL, + `datetime` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `ticket` +-- + +CREATE TABLE IF NOT EXISTS `ticket` ( + `id` bigint(20) NOT NULL, + `title` longtext NOT NULL, + `content` longtext NOT NULL, + `rootid` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL, + `datetime` bigint(20) NOT NULL, + `status` int(11) NOT NULL DEFAULT '1' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `unblockip` +-- + +CREATE TABLE IF NOT EXISTS `unblockip` ( + `id` bigint(20) NOT NULL, + `ip` text NOT NULL, + `datetime` bigint(20) NOT NULL, + `userid` bigint(20) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `id` int(11) NOT NULL, + `user_name` varchar(128) CHARACTER SET utf8mb4 NOT NULL, + `email` varchar(32) NOT NULL, + `pass` varchar(64) NOT NULL, + `passwd` varchar(16) NOT NULL, + `t` int(11) NOT NULL DEFAULT '0', + `u` bigint(20) NOT NULL, + `d` bigint(20) NOT NULL, + `plan` varchar(2) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'A', + `transfer_enable` bigint(20) NOT NULL, + `port` int(11) NOT NULL, + `switch` tinyint(4) NOT NULL DEFAULT '1', + `enable` tinyint(4) NOT NULL DEFAULT '1', + `type` tinyint(4) NOT NULL DEFAULT '1', + `last_get_gift_time` int(11) NOT NULL DEFAULT '0', + `last_check_in_time` int(11) NOT NULL DEFAULT '0', + `last_rest_pass_time` int(11) NOT NULL DEFAULT '0', + `reg_date` datetime NOT NULL, + `invite_num` int(8) NOT NULL, + `money` decimal(12,2) NOT NULL, + `ref_by` int(11) NOT NULL DEFAULT '0', + `expire_time` int(11) NOT NULL DEFAULT '0', + `method` varchar(64) NOT NULL DEFAULT 'rc4-md5', + `is_email_verify` tinyint(4) NOT NULL DEFAULT '0', + `reg_ip` varchar(128) NOT NULL DEFAULT '127.0.0.1', + `node_speedlimit` decimal(12,2) NOT NULL DEFAULT '0.00', + `node_connector` int(11) NOT NULL DEFAULT '0', + `is_admin` int(2) NOT NULL DEFAULT '0', + `im_type` int(11) DEFAULT '1', + `im_value` text, + `last_day_t` bigint(20) NOT NULL DEFAULT '0', + `sendDailyMail` int(11) NOT NULL DEFAULT '1', + `class` int(11) NOT NULL DEFAULT '0', + `class_expire` datetime NOT NULL DEFAULT '1989-06-04 00:05:00', + `expire_in` datetime NOT NULL DEFAULT '2099-06-04 00:05:00', + `theme` text NOT NULL, + `ga_token` text NOT NULL, + `ga_enable` int(11) NOT NULL DEFAULT '0', + `pac` longtext, + `remark` text, + `node_group` int(11) NOT NULL DEFAULT '0', + `auto_reset_day` int(11) NOT NULL DEFAULT '0', + `auto_reset_bandwidth` decimal(12,2) NOT NULL DEFAULT '0.00', + `protocol` varchar(128) DEFAULT 'origin', + `protocol_param` varchar(128) DEFAULT NULL, + `obfs` varchar(128) DEFAULT 'plain', + `obfs_param` varchar(128) DEFAULT NULL, + `forbidden_ip` longtext, + `forbidden_port` longtext, + `disconnect_ip` longtext, + `is_hide` int(11) NOT NULL DEFAULT '0', + `is_multi_user` int(11) NOT NULL DEFAULT '0', + `telegram_id` bigint(20) DEFAULT NULL +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- +-- 转存表中的数据 `user` +-- + +INSERT INTO `user` (`id`, `user_name`, `email`, `pass`, `passwd`, `t`, `u`, `d`, `plan`, `transfer_enable`, `port`, `switch`, `enable`, `type`, `last_get_gift_time`, `last_check_in_time`, `last_rest_pass_time`, `reg_date`, `invite_num`, `money`, `ref_by`, `expire_time`, `method`, `is_email_verify`, `reg_ip`, `node_speedlimit`, `node_connector`, `is_admin`, `im_type`, `im_value`, `last_day_t`, `sendDailyMail`, `class`, `class_expire`, `expire_in`, `theme`, `ga_token`, `ga_enable`, `pac`, `remark`, `node_group`, `auto_reset_day`, `auto_reset_bandwidth`, `protocol`, `protocol_param`, `obfs`, `obfs_param`, `forbidden_ip`, `forbidden_port`, `disconnect_ip`, `is_hide`, `is_multi_user`, `telegram_id`) VALUES +(1, 'admin', 'ss@feiyang.li', '25f5e13433dccbb8d6eb680c4ac831ec6a0cd1d6c4bc8f68f11e7cd328dbc6fc', 'nHHpgf', 0, 0, 0, 'A', 107374182400, 1025, 1, 1, 1, 0, 0, 0, '2017-05-26 20:04:42', 0, '0.00', 0, 0, 'rc4-md5', 0, '127.0.0.1', '0.00', 0, 1, 1, '', 0, 1, 0, '1989-06-04 00:05:00', '2291-03-10 20:04:42', 'material', '2TFGSYHQ3FJLZSWX', 0, NULL, NULL, 0, 0, '0.00', 'origin', NULL, 'plain', NULL, NULL, NULL, NULL, 0, 0, NULL); + +-- -------------------------------------------------------- + +-- +-- 表的结构 `user_token` +-- + +CREATE TABLE IF NOT EXISTS `user_token` ( + `id` int(11) NOT NULL, + `token` varchar(256) NOT NULL, + `user_id` int(11) NOT NULL, + `create_time` int(11) NOT NULL, + `expire_time` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- 表的结构 `user_traffic_log` +-- + +CREATE TABLE IF NOT EXISTS `user_traffic_log` ( + `id` int(11) NOT NULL, + `user_id` int(11) NOT NULL, + `u` bigint(20) NOT NULL, + `d` bigint(20) NOT NULL, + `node_id` int(11) NOT NULL, + `rate` float NOT NULL, + `traffic` varchar(32) NOT NULL, + `log_time` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `alive_ip` +-- +ALTER TABLE `alive_ip` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `announcement` +-- +ALTER TABLE `announcement` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `auto` +-- +ALTER TABLE `auto` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `blockip` +-- +ALTER TABLE `blockip` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `bought` +-- +ALTER TABLE `bought` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `code` +-- +ALTER TABLE `code` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `coupon` +-- +ALTER TABLE `coupon` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `detect_list` +-- +ALTER TABLE `detect_list` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `detect_log` +-- +ALTER TABLE `detect_log` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `disconnect_ip` +-- +ALTER TABLE `disconnect_ip` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `email_verify` +-- +ALTER TABLE `email_verify` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `link` +-- +ALTER TABLE `link` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `login_ip` +-- +ALTER TABLE `login_ip` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `payback` +-- +ALTER TABLE `payback` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `paylist` +-- +ALTER TABLE `paylist` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `radius_ban` +-- +ALTER TABLE `radius_ban` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `relay` +-- +ALTER TABLE `relay` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `shop` +-- +ALTER TABLE `shop` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `speedtest` +-- +ALTER TABLE `speedtest` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `ss_invite_code` +-- +ALTER TABLE `ss_invite_code` + ADD PRIMARY KEY (`id`), + ADD KEY `user_id` (`user_id`); + +-- +-- Indexes for table `ss_node` +-- +ALTER TABLE `ss_node` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `ss_node_info` +-- +ALTER TABLE `ss_node_info` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `ss_node_online_log` +-- +ALTER TABLE `ss_node_online_log` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `ss_password_reset` +-- +ALTER TABLE `ss_password_reset` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `telegram_session` +-- +ALTER TABLE `telegram_session` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `ticket` +-- +ALTER TABLE `ticket` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `unblockip` +-- +ALTER TABLE `unblockip` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`id`), + ADD KEY `user_name` (`user_name`), + ADD KEY `uid` (`id`), + ADD KEY `email` (`email`); + +-- +-- Indexes for table `user_token` +-- +ALTER TABLE `user_token` + ADD PRIMARY KEY (`id`); + +-- +-- Indexes for table `user_traffic_log` +-- +ALTER TABLE `user_traffic_log` + ADD PRIMARY KEY (`id`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `alive_ip` +-- +ALTER TABLE `alive_ip` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `announcement` +-- +ALTER TABLE `announcement` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `auto` +-- +ALTER TABLE `auto` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `blockip` +-- +ALTER TABLE `blockip` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `bought` +-- +ALTER TABLE `bought` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `code` +-- +ALTER TABLE `code` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `coupon` +-- +ALTER TABLE `coupon` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `detect_list` +-- +ALTER TABLE `detect_list` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `detect_log` +-- +ALTER TABLE `detect_log` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `disconnect_ip` +-- +ALTER TABLE `disconnect_ip` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `email_verify` +-- +ALTER TABLE `email_verify` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `link` +-- +ALTER TABLE `link` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5; +-- +-- AUTO_INCREMENT for table `login_ip` +-- +ALTER TABLE `login_ip` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; +-- +-- AUTO_INCREMENT for table `payback` +-- +ALTER TABLE `payback` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `paylist` +-- +ALTER TABLE `paylist` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `radius_ban` +-- +ALTER TABLE `radius_ban` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `relay` +-- +ALTER TABLE `relay` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `shop` +-- +ALTER TABLE `shop` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `speedtest` +-- +ALTER TABLE `speedtest` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `ss_invite_code` +-- +ALTER TABLE `ss_invite_code` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `ss_node` +-- +ALTER TABLE `ss_node` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3; +-- +-- AUTO_INCREMENT for table `ss_node_info` +-- +ALTER TABLE `ss_node_info` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `ss_node_online_log` +-- +ALTER TABLE `ss_node_online_log` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `ss_password_reset` +-- +ALTER TABLE `ss_password_reset` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `telegram_session` +-- +ALTER TABLE `telegram_session` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `ticket` +-- +ALTER TABLE `ticket` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `unblockip` +-- +ALTER TABLE `unblockip` + MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `user` +-- +ALTER TABLE `user` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; +-- +-- AUTO_INCREMENT for table `user_token` +-- +ALTER TABLE `user_token` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +-- +-- AUTO_INCREMENT for table `user_traffic_log` +-- +ALTER TABLE `user_traffic_log` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;