mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
commit
23b6364cc0
@ -5,7 +5,7 @@ namespace App\Http\Controllers\Admin\Server;
|
|||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use App\Models\ServerShadowsocks;
|
use App\Models\ServerShadowsocks;
|
||||||
use App\Models\ServerTrojan;
|
use App\Models\ServerTrojan;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerGroup;
|
use App\Models\ServerGroup;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Services\ServerService;
|
use App\Services\ServerService;
|
||||||
@ -65,7 +65,7 @@ class GroupController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$servers = ServerV2ray::all();
|
$servers = ServerVmess::all();
|
||||||
foreach ($servers as $server) {
|
foreach ($servers as $server) {
|
||||||
if (in_array($request->input('id'), $server->group_id)) {
|
if (in_array($request->input('id'), $server->group_id)) {
|
||||||
abort(500, '该组已被节点所使用,无法删除');
|
abort(500, '该组已被节点所使用,无法删除');
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Admin\Server;
|
namespace App\Http\Controllers\Admin\Server;
|
||||||
|
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerShadowsocks;
|
use App\Models\ServerShadowsocks;
|
||||||
use App\Models\ServerTrojan;
|
use App\Models\ServerTrojan;
|
||||||
use App\Services\ServerService;
|
use App\Services\ServerService;
|
||||||
@ -24,22 +24,22 @@ class ManageController extends Controller
|
|||||||
{
|
{
|
||||||
ini_set('post_max_size', '1m');
|
ini_set('post_max_size', '1m');
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
foreach ($request->input('sorts') as $k => $v) {
|
foreach ($request->input('sorts') ?? [] as $k => $v) {
|
||||||
switch ($v['key']) {
|
switch ($v['key']) {
|
||||||
case 'shadowsocks':
|
case 'shadowsocks':
|
||||||
if (!ServerShadowsocks::find($v['value'])->update(['sort' => $k + 1])) {
|
if (!ServerShadowsocks::find($v['value'])->update(['sort' => $v['sort']])) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'v2ray':
|
case 'vmess':
|
||||||
if (!ServerV2ray::find($v['value'])->update(['sort' => $k + 1])) {
|
if (!ServerVmess::find($v['value'])->update(['sort' => $v['sort']])) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'trojan':
|
case 'trojan':
|
||||||
if (!ServerTrojan::find($v['value'])->update(['sort' => $k + 1])) {
|
if (!ServerTrojan::find($v['value'])->update(['sort' => $v['sort']])) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
abort(500, '保存失败');
|
abort(500, '保存失败');
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,21 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers\Admin\Server;
|
namespace App\Http\Controllers\Admin\Server;
|
||||||
|
|
||||||
use App\Http\Requests\Admin\ServerV2raySave;
|
use App\Http\Requests\Admin\ServerVmessSave;
|
||||||
use App\Http\Requests\Admin\ServerV2rayUpdate;
|
use App\Http\Requests\Admin\ServerVmessUpdate;
|
||||||
use App\Services\ServerService;
|
use App\Services\ServerService;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
|
|
||||||
class V2rayController extends Controller
|
class VmessController extends Controller
|
||||||
{
|
{
|
||||||
public function save(ServerV2raySave $request)
|
public function save(ServerVmessSave $request)
|
||||||
{
|
{
|
||||||
$params = $request->validated();
|
$params = $request->validated();
|
||||||
|
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$server = ServerV2ray::find($request->input('id'));
|
$server = ServerVmess::find($request->input('id'));
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, '服务器不存在');
|
abort(500, '服务器不存在');
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ class V2rayController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ServerV2ray::create($params)) {
|
if (!ServerVmess::create($params)) {
|
||||||
abort(500, '创建失败');
|
abort(500, '创建失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class V2rayController extends Controller
|
|||||||
public function drop(Request $request)
|
public function drop(Request $request)
|
||||||
{
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$server = ServerV2ray::find($request->input('id'));
|
$server = ServerVmess::find($request->input('id'));
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, '节点ID不存在');
|
abort(500, '节点ID不存在');
|
||||||
}
|
}
|
||||||
@ -52,13 +52,13 @@ class V2rayController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update(ServerV2rayUpdate $request)
|
public function update(ServerVmessUpdate $request)
|
||||||
{
|
{
|
||||||
$params = $request->only([
|
$params = $request->only([
|
||||||
'show',
|
'show',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$server = ServerV2ray::find($request->input('id'));
|
$server = ServerVmess::find($request->input('id'));
|
||||||
|
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, '该服务器不存在');
|
abort(500, '该服务器不存在');
|
||||||
@ -76,12 +76,12 @@ class V2rayController extends Controller
|
|||||||
|
|
||||||
public function copy(Request $request)
|
public function copy(Request $request)
|
||||||
{
|
{
|
||||||
$server = ServerV2ray::find($request->input('id'));
|
$server = ServerVmess::find($request->input('id'));
|
||||||
$server->show = 0;
|
$server->show = 0;
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, '服务器不存在');
|
abort(500, '服务器不存在');
|
||||||
}
|
}
|
||||||
if (!ServerV2ray::create($server->toArray())) {
|
if (!ServerVmess::create($server->toArray())) {
|
||||||
abort(500, '复制失败');
|
abort(500, '复制失败');
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ use App\Services\ServerService;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ServerGroup;
|
use App\Models\ServerGroup;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Ticket;
|
use App\Models\Ticket;
|
||||||
@ -99,8 +99,9 @@ class StatController extends Controller
|
|||||||
{
|
{
|
||||||
$servers = [
|
$servers = [
|
||||||
'shadowsocks' => ServerShadowsocks::where('parent_id', null)->get()->toArray(),
|
'shadowsocks' => ServerShadowsocks::where('parent_id', null)->get()->toArray(),
|
||||||
'v2ray' => ServerV2ray::where('parent_id', null)->get()->toArray(),
|
'v2ray' => ServerVmess::where('parent_id', null)->get()->toArray(),
|
||||||
'trojan' => ServerTrojan::where('parent_id', null)->get()->toArray()
|
'trojan' => ServerTrojan::where('parent_id', null)->get()->toArray(),
|
||||||
|
'vmess' => ServerVmess::where('parent_id', null)->get()->toArray()
|
||||||
];
|
];
|
||||||
$startAt = strtotime('-1 day', strtotime(date('Y-m-d')));
|
$startAt = strtotime('-1 day', strtotime(date('Y-m-d')));
|
||||||
$endAt = strtotime(date('Y-m-d'));
|
$endAt = strtotime(date('Y-m-d'));
|
||||||
|
@ -9,7 +9,7 @@ use App\Utils\CacheKey;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ServerGroup;
|
use App\Models\ServerGroup;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\Plan;
|
use App\Models\Plan;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Ticket;
|
use App\Models\Ticket;
|
||||||
|
@ -7,6 +7,7 @@ use App\Http\Requests\Admin\UserGenerate;
|
|||||||
use App\Http\Requests\Admin\UserSendMail;
|
use App\Http\Requests\Admin\UserSendMail;
|
||||||
use App\Http\Requests\Admin\UserUpdate;
|
use App\Http\Requests\Admin\UserUpdate;
|
||||||
use App\Jobs\SendEmailJob;
|
use App\Jobs\SendEmailJob;
|
||||||
|
use App\Services\AuthService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -128,6 +129,11 @@ class UserController extends Controller
|
|||||||
$params['invite_user_id'] = null;
|
$params['invite_user_id'] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($params['banned']) && (int)$params['banned'] === 1) {
|
||||||
|
$authService = new AuthService($user);
|
||||||
|
$authService->removeAllSession();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user->update($params);
|
$user->update($params);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
@ -5,9 +5,7 @@ namespace App\Http\Controllers\Client;
|
|||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Services\ServerService;
|
use App\Services\ServerService;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use App\Utils\Clash;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\ServerV2ray;
|
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
|
|
||||||
@ -44,7 +42,7 @@ class AppController extends Controller
|
|||||||
array_push($proxy, Protocols\Clash::buildShadowsocks($user['uuid'], $item));
|
array_push($proxy, Protocols\Clash::buildShadowsocks($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
array_push($proxy, Protocols\Clash::buildVmess($user['uuid'], $item));
|
array_push($proxy, Protocols\Clash::buildVmess($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ class ClientController extends Controller
|
|||||||
|
|
||||||
private function setSubscribeInfoToServers(&$servers, $user)
|
private function setSubscribeInfoToServers(&$servers, $user)
|
||||||
{
|
{
|
||||||
|
if (!isset($servers[0])) return;
|
||||||
if (!(int)config('v2board.show_info_to_server_enable', 0)) return;
|
if (!(int)config('v2board.show_info_to_server_enable', 0)) return;
|
||||||
$useTraffic = round($user['u'] / (1024*1024*1024), 2) + round($user['d'] / (1024*1024*1024), 2);
|
$useTraffic = round($user['u'] / (1024*1024*1024), 2) + round($user['d'] / (1024*1024*1024), 2);
|
||||||
$totalTraffic = round($user['transfer_enable'] / (1024*1024*1024), 2);
|
$totalTraffic = round($user['transfer_enable'] / (1024*1024*1024), 2);
|
||||||
|
@ -34,6 +34,7 @@ class Clash
|
|||||||
} else {
|
} else {
|
||||||
$config = Yaml::parseFile($defaultConfig);
|
$config = Yaml::parseFile($defaultConfig);
|
||||||
}
|
}
|
||||||
|
$this->patch($config);
|
||||||
$proxy = [];
|
$proxy = [];
|
||||||
$proxies = [];
|
$proxies = [];
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ class Clash
|
|||||||
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
@ -78,11 +79,12 @@ class Clash
|
|||||||
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
||||||
}
|
}
|
||||||
// Force the current subscription domain to be a direct rule
|
// Force the current subscription domain to be a direct rule
|
||||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
$subsDomain = $_SERVER['HTTP_HOST'];
|
||||||
$subsDomainRule = "DOMAIN,{$subsDomain},DIRECT";
|
if ($subsDomain) {
|
||||||
array_unshift($config['rules'], $subsDomainRule);
|
array_unshift($config['rules'], "DOMAIN,{$subsDomain},DIRECT");
|
||||||
|
}
|
||||||
|
|
||||||
$yaml = Yaml::dump($config);
|
$yaml = Yaml::dump($config, 2, 4, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
|
||||||
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
||||||
return $yaml;
|
return $yaml;
|
||||||
}
|
}
|
||||||
@ -172,4 +174,11 @@ class Clash
|
|||||||
{
|
{
|
||||||
return @preg_match($exp, null) !== false;
|
return @preg_match($exp, null) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function patch(&$config)
|
||||||
|
{
|
||||||
|
// fix clash x dns mode
|
||||||
|
preg_match('#(ClashX)[/ ]([0-9.]*)#', $_SERVER['HTTP_USER_AGENT'], $matches);
|
||||||
|
if (isset($matches[2]) && $matches[2] < '1.96.2') $config['dns']['enhanced-mode'] = 'redir-host';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ class ClashMeta
|
|||||||
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
@ -69,11 +69,12 @@ class ClashMeta
|
|||||||
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
||||||
}
|
}
|
||||||
// Force the current subscription domain to be a direct rule
|
// Force the current subscription domain to be a direct rule
|
||||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
$subsDomain = $_SERVER['HTTP_HOST'];
|
||||||
$subsDomainRule = "DOMAIN,{$subsDomain},DIRECT";
|
if ($subsDomain) {
|
||||||
array_unshift($config['rules'], $subsDomainRule);
|
array_unshift($config['rules'], "DOMAIN,{$subsDomain},DIRECT");
|
||||||
|
}
|
||||||
|
|
||||||
$yaml = Yaml::dump($config);
|
$yaml = Yaml::dump($config, 2, 4, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
|
||||||
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
||||||
return $yaml;
|
return $yaml;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class Passwall
|
|||||||
$uri = '';
|
$uri = '';
|
||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
|
@ -25,7 +25,7 @@ class QuantumultX
|
|||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
$uri .= self::buildShadowsocks($user['uuid'], $item);
|
$uri .= self::buildShadowsocks($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'trojan') {
|
if ($item['type'] === 'trojan') {
|
||||||
|
@ -22,7 +22,7 @@ class SSRPlus
|
|||||||
$uri = '';
|
$uri = '';
|
||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
|
@ -21,7 +21,7 @@ class SagerNet
|
|||||||
$uri = '';
|
$uri = '';
|
||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
|
@ -32,7 +32,7 @@ class Shadowrocket
|
|||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
$uri .= self::buildShadowsocks($user['uuid'], $item);
|
$uri .= self::buildShadowsocks($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'trojan') {
|
if ($item['type'] === 'trojan') {
|
||||||
|
@ -30,7 +30,7 @@ class Shadowsocks
|
|||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'shadowsocks'
|
if ($item['type'] === 'shadowsocks'
|
||||||
&& in_array($item['cipher'], ['aes-128-gcm', 'aes-256-gcm', 'aes-192-gcm'])
|
&& in_array($item['cipher'], ['aes-128-gcm', 'aes-256-gcm', 'aes-192-gcm', 'chacha20-ietf-poly1305'])
|
||||||
) {
|
) {
|
||||||
array_push($configs, self::SIP008($item, $user));
|
array_push($configs, self::SIP008($item, $user));
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class Stash
|
|||||||
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
array_push($proxy, self::buildShadowsocks($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
array_push($proxy, self::buildVmess($user['uuid'], $item));
|
||||||
array_push($proxies, $item['name']);
|
array_push($proxies, $item['name']);
|
||||||
}
|
}
|
||||||
@ -76,11 +76,12 @@ class Stash
|
|||||||
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
$config['proxy-groups'][$k]['proxies'] = array_merge($config['proxy-groups'][$k]['proxies'], $proxies);
|
||||||
}
|
}
|
||||||
// Force the current subscription domain to be a direct rule
|
// Force the current subscription domain to be a direct rule
|
||||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
$subsDomain = $_SERVER['HTTP_HOST'];
|
||||||
$subsDomainRule = "DOMAIN,{$subsDomain},DIRECT";
|
if ($subsDomain) {
|
||||||
array_unshift($config['rules'], $subsDomainRule);
|
array_unshift($config['rules'], "DOMAIN,{$subsDomain},DIRECT");
|
||||||
|
}
|
||||||
|
|
||||||
$yaml = Yaml::dump($config);
|
$yaml = Yaml::dump($config, 2, 4, Yaml::DUMP_EMPTY_ARRAY_AS_SEQUENCE);
|
||||||
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
$yaml = str_replace('$app_name', config('v2board.app_name', 'V2Board'), $yaml);
|
||||||
return $yaml;
|
return $yaml;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ class Surfboard
|
|||||||
// [Proxy Group]
|
// [Proxy Group]
|
||||||
$proxyGroup .= $item['name'] . ', ';
|
$proxyGroup .= $item['name'] . ', ';
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
// [Proxy]
|
// [Proxy]
|
||||||
$proxies .= self::buildVmess($user['uuid'], $item);
|
$proxies .= self::buildVmess($user['uuid'], $item);
|
||||||
// [Proxy Group]
|
// [Proxy Group]
|
||||||
@ -65,7 +65,7 @@ class Surfboard
|
|||||||
|
|
||||||
// Subscription link
|
// Subscription link
|
||||||
$subsURL = Helper::getSubscribeUrl("/api/v1/client/subscribe?token={$user['token']}");
|
$subsURL = Helper::getSubscribeUrl("/api/v1/client/subscribe?token={$user['token']}");
|
||||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
$subsDomain = $_SERVER['HTTP_HOST'];
|
||||||
|
|
||||||
$config = str_replace('$subs_link', $subsURL, $config);
|
$config = str_replace('$subs_link', $subsURL, $config);
|
||||||
$config = str_replace('$subs_domain', $subsDomain, $config);
|
$config = str_replace('$subs_domain', $subsDomain, $config);
|
||||||
|
@ -41,7 +41,7 @@ class Surge
|
|||||||
// [Proxy Group]
|
// [Proxy Group]
|
||||||
$proxyGroup .= $item['name'] . ', ';
|
$proxyGroup .= $item['name'] . ', ';
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
// [Proxy]
|
// [Proxy]
|
||||||
$proxies .= self::buildVmess($user['uuid'], $item);
|
$proxies .= self::buildVmess($user['uuid'], $item);
|
||||||
// [Proxy Group]
|
// [Proxy Group]
|
||||||
@ -65,7 +65,7 @@ class Surge
|
|||||||
|
|
||||||
// Subscription link
|
// Subscription link
|
||||||
$subsURL = Helper::getSubscribeUrl("/api/v1/client/subscribe?token={$user['token']}");
|
$subsURL = Helper::getSubscribeUrl("/api/v1/client/subscribe?token={$user['token']}");
|
||||||
$subsDomain = $_SERVER['SERVER_NAME'];
|
$subsDomain = $_SERVER['HTTP_HOST'];
|
||||||
$subsURL = 'https://' . $subsDomain . '/api/v1/client/subscribe?token=' . $user['token'];
|
$subsURL = 'https://' . $subsDomain . '/api/v1/client/subscribe?token=' . $user['token'];
|
||||||
|
|
||||||
$config = str_replace('$subs_link', $subsURL, $config);
|
$config = str_replace('$subs_link', $subsURL, $config);
|
||||||
|
@ -24,7 +24,7 @@ class V2rayN
|
|||||||
$uri = '';
|
$uri = '';
|
||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
|
@ -22,7 +22,7 @@ class V2rayNG
|
|||||||
$uri = '';
|
$uri = '';
|
||||||
|
|
||||||
foreach ($servers as $item) {
|
foreach ($servers as $item) {
|
||||||
if ($item['type'] === 'v2ray') {
|
if ($item['type'] === 'vmess') {
|
||||||
$uri .= self::buildVmess($user['uuid'], $item);
|
$uri .= self::buildVmess($user['uuid'], $item);
|
||||||
}
|
}
|
||||||
if ($item['type'] === 'shadowsocks') {
|
if ($item['type'] === 'shadowsocks') {
|
||||||
|
@ -26,7 +26,7 @@ class AuthController extends Controller
|
|||||||
abort(404);
|
abort(404);
|
||||||
}
|
}
|
||||||
$params = $request->validate([
|
$params = $request->validate([
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'redirect' => 'nullable'
|
'redirect' => 'nullable'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ use App\Utils\CacheKey;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerLog;
|
use App\Models\ServerLog;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
@ -37,11 +37,11 @@ class DeepbworkController extends Controller
|
|||||||
{
|
{
|
||||||
ini_set('memory_limit', -1);
|
ini_set('memory_limit', -1);
|
||||||
$nodeId = $request->input('node_id');
|
$nodeId = $request->input('node_id');
|
||||||
$server = ServerV2ray::find($nodeId);
|
$server = ServerVmess::find($nodeId);
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, 'fail');
|
abort(500, 'fail');
|
||||||
}
|
}
|
||||||
Cache::put(CacheKey::get('SERVER_V2RAY_LAST_CHECK_AT', $server->id), time(), 3600);
|
Cache::put(CacheKey::get('SERVER_VMESS_LAST_CHECK_AT', $server->id), time(), 3600);
|
||||||
$serverService = new ServerService();
|
$serverService = new ServerService();
|
||||||
$users = $serverService->getAvailableUsers($server->group_id);
|
$users = $serverService->getAvailableUsers($server->group_id);
|
||||||
$result = [];
|
$result = [];
|
||||||
@ -69,7 +69,7 @@ class DeepbworkController extends Controller
|
|||||||
public function submit(Request $request)
|
public function submit(Request $request)
|
||||||
{
|
{
|
||||||
// Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
|
// Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
|
||||||
$server = ServerV2ray::find($request->input('node_id'));
|
$server = ServerVmess::find($request->input('node_id'));
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
return response([
|
return response([
|
||||||
'ret' => 0,
|
'ret' => 0,
|
||||||
@ -78,13 +78,13 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
$data = file_get_contents('php://input');
|
$data = file_get_contents('php://input');
|
||||||
$data = json_decode($data, true);
|
$data = json_decode($data, true);
|
||||||
Cache::put(CacheKey::get('SERVER_V2RAY_ONLINE_USER', $server->id), count($data), 3600);
|
Cache::put(CacheKey::get('SERVER_VMESS_ONLINE_USER', $server->id), count($data), 3600);
|
||||||
Cache::put(CacheKey::get('SERVER_V2RAY_LAST_PUSH_AT', $server->id), time(), 3600);
|
Cache::put(CacheKey::get('SERVER_VMESS_LAST_PUSH_AT', $server->id), time(), 3600);
|
||||||
$userService = new UserService();
|
$userService = new UserService();
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
$u = $item['u'];
|
$u = $item['u'];
|
||||||
$d = $item['d'];
|
$d = $item['d'];
|
||||||
$userService->trafficFetch($u, $d, $item['user_id'], $server->toArray(), 'v2ray');
|
$userService->trafficFetch($u, $d, $item['user_id'], $server->toArray(), 'vmess');
|
||||||
}
|
}
|
||||||
|
|
||||||
return response([
|
return response([
|
||||||
@ -112,7 +112,7 @@ class DeepbworkController extends Controller
|
|||||||
|
|
||||||
private function getV2RayConfig(int $nodeId, int $localPort)
|
private function getV2RayConfig(int $nodeId, int $localPort)
|
||||||
{
|
{
|
||||||
$server = ServerV2ray::find($nodeId);
|
$server = ServerVmess::find($nodeId);
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
abort(500, '节点不存在');
|
abort(500, '节点不存在');
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ class DeepbworkController extends Controller
|
|||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setDns(ServerV2ray $server, object $json)
|
private function setDns(ServerVmess $server, object $json)
|
||||||
{
|
{
|
||||||
if ($server->dnsSettings) {
|
if ($server->dnsSettings) {
|
||||||
$dns = $server->dnsSettings;
|
$dns = $server->dnsSettings;
|
||||||
@ -142,7 +142,7 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setNetwork(ServerV2ray $server, object $json)
|
private function setNetwork(ServerVmess $server, object $json)
|
||||||
{
|
{
|
||||||
if ($server->networkSettings) {
|
if ($server->networkSettings) {
|
||||||
switch ($server->network) {
|
switch ($server->network) {
|
||||||
@ -171,7 +171,7 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setRule(ServerV2ray $server, object $json)
|
private function setRule(ServerVmess $server, object $json)
|
||||||
{
|
{
|
||||||
$domainRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_domain')));
|
$domainRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_domain')));
|
||||||
$protocolRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_protocol')));
|
$protocolRules = array_filter(explode(PHP_EOL, config('v2board.server_v2ray_protocol')));
|
||||||
@ -211,7 +211,7 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setTls(ServerV2ray $server, object $json)
|
private function setTls(ServerVMess $server, object $json)
|
||||||
{
|
{
|
||||||
if ((int)$server->tls) {
|
if ((int)$server->tls) {
|
||||||
$tlsSettings = $server->tlsSettings;
|
$tlsSettings = $server->tlsSettings;
|
||||||
|
@ -9,7 +9,7 @@ use App\Utils\Helper;
|
|||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\ServerShadowsocks;
|
use App\Models\ServerShadowsocks;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerTrojan;
|
use App\Models\ServerTrojan;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
@ -30,6 +30,7 @@ class UniProxyController extends Controller
|
|||||||
abort(500, 'token is error');
|
abort(500, 'token is error');
|
||||||
}
|
}
|
||||||
$this->nodeType = $request->input('node_type');
|
$this->nodeType = $request->input('node_type');
|
||||||
|
if ($this->nodeType === 'v2ray') $this->nodeType = 'vmess';
|
||||||
$this->nodeId = $request->input('node_id');
|
$this->nodeId = $request->input('node_id');
|
||||||
$this->serverService = new ServerService();
|
$this->serverService = new ServerService();
|
||||||
$this->nodeInfo = $this->serverService->getServer($this->nodeId, $this->nodeType);
|
$this->nodeInfo = $this->serverService->getServer($this->nodeId, $this->nodeType);
|
||||||
@ -92,7 +93,7 @@ class UniProxyController extends Controller
|
|||||||
$response['server_key'] = Helper::getShadowsocksServerKey($this->nodeInfo->created_at, 32);
|
$response['server_key'] = Helper::getShadowsocksServerKey($this->nodeInfo->created_at, 32);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'v2ray':
|
case 'vmess':
|
||||||
$response = [
|
$response = [
|
||||||
'server_port' => $this->nodeInfo->server_port,
|
'server_port' => $this->nodeInfo->server_port,
|
||||||
'network' => $this->nodeInfo->network,
|
'network' => $this->nodeInfo->network,
|
||||||
|
@ -8,7 +8,7 @@ use App\Services\UserService;
|
|||||||
use App\Utils\CacheKey;
|
use App\Utils\CacheKey;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerLog;
|
use App\Models\ServerLog;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
|
||||||
@ -26,8 +26,7 @@ class ServerController extends Controller
|
|||||||
$serverService = new ServerService();
|
$serverService = new ServerService();
|
||||||
$servers = $serverService->getAvailableServers($user);
|
$servers = $serverService->getAvailableServers($user);
|
||||||
}
|
}
|
||||||
|
$eTag = sha1(json_encode(array_column($servers, 'cache_key')));
|
||||||
$eTag = sha1(json_encode(array_column($servers, 'updated_at')));
|
|
||||||
if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
|
if (strpos($request->header('If-None-Match'), $eTag) !== false ) {
|
||||||
abort(304);
|
abort(304);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ class UserController extends Controller
|
|||||||
}
|
}
|
||||||
$authService = new AuthService($user);
|
$authService = new AuthService($user);
|
||||||
return response([
|
return response([
|
||||||
'data' => $authService->delSession($request->input('session_id'))
|
'data' => $authService->removeSession($request->input('session_id'))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class OrderFetch extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'filter.*.key' => 'required|in:email,trade_no,status,commission_status,user_id,invite_user_id,callback_no',
|
'filter.*.key' => 'required|in:email,trade_no,status,commission_status,user_id,invite_user_id,callback_no,commission_balance',
|
||||||
'filter.*.condition' => 'required|in:>,<,=,>=,<=,模糊,!=',
|
'filter.*.condition' => 'required|in:>,<,=,>=,<=,模糊,!=',
|
||||||
'filter.*.value' => ''
|
'filter.*.value' => ''
|
||||||
];
|
];
|
||||||
|
@ -4,7 +4,7 @@ namespace App\Http\Requests\Admin;
|
|||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ServerV2raySave extends FormRequest
|
class ServerVmessSave extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
@ -4,7 +4,7 @@ namespace App\Http\Requests\Admin;
|
|||||||
|
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
|
||||||
class ServerV2rayUpdate extends FormRequest
|
class ServerVmessUpdate extends FormRequest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
@ -14,7 +14,7 @@ class UserUpdate extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'password' => 'nullable|min:8',
|
'password' => 'nullable|min:8',
|
||||||
'transfer_enable' => 'numeric',
|
'transfer_enable' => 'numeric',
|
||||||
'expired_at' => 'nullable|integer',
|
'expired_at' => 'nullable|integer',
|
||||||
|
@ -14,7 +14,7 @@ class AuthForget extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'password' => 'required|min:8',
|
'password' => 'required|min:8',
|
||||||
'email_code' => 'required'
|
'email_code' => 'required'
|
||||||
];
|
];
|
||||||
|
@ -14,7 +14,7 @@ class AuthLogin extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'password' => 'required|min:8'
|
'password' => 'required|min:8'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class AuthRegister extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'password' => 'required|min:8'
|
'password' => 'required|min:8'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ class CommSendEmailVerify extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email'
|
'email' => 'required|email:strict'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class UserUpdate extends FormRequest
|
|||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'email' => 'required|email',
|
'email' => 'required|email:strict',
|
||||||
'password' => 'nullable',
|
'password' => 'nullable',
|
||||||
'transfer_enable' => 'numeric',
|
'transfer_enable' => 'numeric',
|
||||||
'expired_at' => 'nullable|integer',
|
'expired_at' => 'nullable|integer',
|
||||||
|
@ -45,14 +45,14 @@ class AdminRoute
|
|||||||
$router->post('viewConfig', 'Admin\\Server\\TrojanController@viewConfig');
|
$router->post('viewConfig', 'Admin\\Server\\TrojanController@viewConfig');
|
||||||
});
|
});
|
||||||
$router->group([
|
$router->group([
|
||||||
'prefix' => 'server/v2ray'
|
'prefix' => 'server/vmess'
|
||||||
], function ($router) {
|
], function ($router) {
|
||||||
$router->get ('fetch', 'Admin\\Server\\V2rayController@fetch');
|
$router->get ('fetch', 'Admin\\Server\\VmessController@fetch');
|
||||||
$router->post('save', 'Admin\\Server\\V2rayController@save');
|
$router->post('save', 'Admin\\Server\\VmessController@save');
|
||||||
$router->post('drop', 'Admin\\Server\\V2rayController@drop');
|
$router->post('drop', 'Admin\\Server\\VmessController@drop');
|
||||||
$router->post('update', 'Admin\\Server\\V2rayController@update');
|
$router->post('update', 'Admin\\Server\\VmessController@update');
|
||||||
$router->post('copy', 'Admin\\Server\\V2rayController@copy');
|
$router->post('copy', 'Admin\\Server\\VmessController@copy');
|
||||||
$router->post('sort', 'Admin\\Server\\V2rayController@sort');
|
$router->post('sort', 'Admin\\Server\\VmessController@sort');
|
||||||
});
|
});
|
||||||
$router->group([
|
$router->group([
|
||||||
'prefix' => 'server/shadowsocks'
|
'prefix' => 'server/shadowsocks'
|
||||||
|
@ -20,7 +20,6 @@ class PassportRoute
|
|||||||
// Comm
|
// Comm
|
||||||
$router->post('/comm/sendEmailVerify', 'Passport\\CommController@sendEmailVerify');
|
$router->post('/comm/sendEmailVerify', 'Passport\\CommController@sendEmailVerify');
|
||||||
$router->post('/comm/pv', 'Passport\\CommController@pv');
|
$router->post('/comm/pv', 'Passport\\CommController@pv');
|
||||||
$router->get ('/comm/config', 'Guest\\CommController@config'); // TODO:REMOVE:1.7.0
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,9 @@ namespace App\Models;
|
|||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class ServerV2ray extends Model
|
class ServerVmess extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'v2_server_v2ray';
|
protected $table = 'v2_server_vmess';
|
||||||
protected $dateFormat = 'U';
|
protected $dateFormat = 'U';
|
||||||
protected $guarded = ['id'];
|
protected $guarded = ['id'];
|
||||||
protected $casts = [
|
protected $casts = [
|
@ -84,7 +84,7 @@ class AuthService
|
|||||||
return (array)Cache::get(CacheKey::get("USER_SESSIONS", $this->user->id), []);
|
return (array)Cache::get(CacheKey::get("USER_SESSIONS", $this->user->id), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delSession($sessionId)
|
public function removeSession($sessionId)
|
||||||
{
|
{
|
||||||
$cacheKey = CacheKey::get("USER_SESSIONS", $this->user->id);
|
$cacheKey = CacheKey::get("USER_SESSIONS", $this->user->id);
|
||||||
$sessions = (array)Cache::get($cacheKey, []);
|
$sessions = (array)Cache::get($cacheKey, []);
|
||||||
@ -95,4 +95,10 @@ class AuthService
|
|||||||
)) return false;
|
)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeAllSession()
|
||||||
|
{
|
||||||
|
$cacheKey = CacheKey::get("USER_SESSIONS", $this->user->id);
|
||||||
|
return Cache::forget($cacheKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,43 +184,35 @@ class OrderService
|
|||||||
$order->surplus_order_ids = array_column($orderModel->get()->toArray(), 'id');
|
$order->surplus_order_ids = array_column($orderModel->get()->toArray(), 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function orderIsUsed(Order $order):bool
|
|
||||||
{
|
|
||||||
$month = self::STR_TO_TIME[$order->period];
|
|
||||||
$orderExpireDay = strtotime('+' . $month . ' month', $order->created_at);
|
|
||||||
if ($orderExpireDay < time()) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function getSurplusValueByPeriod(User $user, Order $order)
|
private function getSurplusValueByPeriod(User $user, Order $order)
|
||||||
{
|
{
|
||||||
$orderModel = Order::where('user_id', $user->id)
|
$orders = Order::where('user_id', $user->id)
|
||||||
->where('period', '!=', 'reset_price')
|
->where('period', '!=', 'reset_price')
|
||||||
->where('status', 3);
|
->where('period', '!=', 'onetime_price')
|
||||||
$orders = $orderModel->get();
|
->where('status', 3)
|
||||||
$orderSurplusMonth = 0;
|
->get()
|
||||||
$orderSurplusAmount = 0;
|
->toArray();
|
||||||
$userSurplusMonth = ($user->expired_at - time()) / 2678400;
|
if (!$orders) return;
|
||||||
foreach ($orders as $k => $item) {
|
$orderAmountSum = 0;
|
||||||
// 兼容历史余留问题
|
$orderMonthSum = 0;
|
||||||
if ($item->period === 'onetime_price') continue;
|
$lastValidateAt = 0;
|
||||||
if ($this->orderIsUsed($item)) continue;
|
foreach ($orders as $item) {
|
||||||
$orderSurplusMonth = $orderSurplusMonth + self::STR_TO_TIME[$item->period];
|
$period = self::STR_TO_TIME[$item['period']];
|
||||||
$orderSurplusAmount = $orderSurplusAmount + ($item['total_amount'] + $item['balance_amount'] + $item['surplus_amount'] - $item['refund_amount']);
|
if (strtotime("+{$period} month", $item['created_at']) < time()) continue;
|
||||||
}
|
$lastValidateAt = $item['created_at'];
|
||||||
if (!$orderSurplusMonth || !$orderSurplusAmount) return;
|
$orderMonthSum = $period + $orderMonthSum;
|
||||||
$monthUnitPrice = $orderSurplusAmount / $orderSurplusMonth;
|
$orderAmountSum = $orderAmountSum + ($item['total_amount'] + $item['balance_amount'] + $item['surplus_amount'] - $item['refund_amount']);
|
||||||
// 如果用户过期月大于订单过期月
|
|
||||||
if ($userSurplusMonth > $orderSurplusMonth) {
|
|
||||||
$orderSurplusAmount = $orderSurplusMonth * $monthUnitPrice;
|
|
||||||
} else {
|
|
||||||
$orderSurplusAmount = $userSurplusMonth * $monthUnitPrice;
|
|
||||||
}
|
|
||||||
if (!$orderSurplusAmount) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if (!$lastValidateAt) return;
|
||||||
|
$expiredAtByOrder = strtotime("+{$orderMonthSum} month", $lastValidateAt);
|
||||||
|
if ($expiredAtByOrder < time()) return;
|
||||||
|
$orderSurplusSecond = $expiredAtByOrder - time();
|
||||||
|
$orderRangeSecond = $expiredAtByOrder - $lastValidateAt;
|
||||||
|
$avgPrice = $orderAmountSum / $orderRangeSecond;
|
||||||
|
$orderSurplusAmount = $avgPrice * $orderSurplusSecond;
|
||||||
|
if (!$orderSurplusSecond || !$orderSurplusAmount) return;
|
||||||
$order->surplus_amount = $orderSurplusAmount > 0 ? $orderSurplusAmount : 0;
|
$order->surplus_amount = $orderSurplusAmount > 0 ? $orderSurplusAmount : 0;
|
||||||
$order->surplus_order_ids = array_column($orders->toArray(), 'id');
|
$order->surplus_order_ids = array_column($orders, 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paid(string $callbackNo)
|
public function paid(string $callbackNo)
|
||||||
|
@ -6,7 +6,7 @@ use App\Models\ServerLog;
|
|||||||
use App\Models\ServerRoute;
|
use App\Models\ServerRoute;
|
||||||
use App\Models\ServerShadowsocks;
|
use App\Models\ServerShadowsocks;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerVmess;
|
||||||
use App\Models\ServerTrojan;
|
use App\Models\ServerTrojan;
|
||||||
use App\Utils\CacheKey;
|
use App\Utils\CacheKey;
|
||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
@ -15,97 +15,89 @@ use Illuminate\Support\Facades\Cache;
|
|||||||
class ServerService
|
class ServerService
|
||||||
{
|
{
|
||||||
|
|
||||||
public function getV2ray(User $user, $all = false):array
|
public function getAvailableVmess(User $user):array
|
||||||
{
|
{
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$model = ServerV2ray::orderBy('sort', 'ASC');
|
$model = ServerVmess::orderBy('sort', 'ASC');
|
||||||
if (!$all) {
|
$vmess = $model->get();
|
||||||
$model->where('show', 1);
|
foreach ($vmess as $key => $v) {
|
||||||
|
if (!$v['show']) continue;
|
||||||
|
$vmess[$key]['type'] = 'vmess';
|
||||||
|
if (!in_array($user->group_id, $vmess[$key]['group_id'])) continue;
|
||||||
|
if (strpos($vmess[$key]['port'], '-') !== false) {
|
||||||
|
$vmess[$key]['port'] = Helper::randomPort($vmess[$key]['port']);
|
||||||
}
|
}
|
||||||
$v2ray = $model->get();
|
if ($vmess[$key]['parent_id']) {
|
||||||
for ($i = 0; $i < count($v2ray); $i++) {
|
$vmess[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_VMESS_LAST_CHECK_AT', $vmess[$key]['parent_id']));
|
||||||
$v2ray[$i]['type'] = 'v2ray';
|
|
||||||
$groupId = $v2ray[$i]['group_id'];
|
|
||||||
if (!in_array($user->group_id, $groupId)) continue;
|
|
||||||
if (strpos($v2ray[$i]['port'], '-') !== false) {
|
|
||||||
$v2ray[$i]['port'] = Helper::randomPort($v2ray[$i]['port']);
|
|
||||||
}
|
|
||||||
if ($v2ray[$i]['parent_id']) {
|
|
||||||
$v2ray[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_V2RAY_LAST_CHECK_AT', $v2ray[$i]['parent_id']));
|
|
||||||
} else {
|
} else {
|
||||||
$v2ray[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_V2RAY_LAST_CHECK_AT', $v2ray[$i]['id']));
|
$vmess[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_VMESS_LAST_CHECK_AT', $vmess[$key]['id']));
|
||||||
}
|
}
|
||||||
array_push($servers, $v2ray[$i]->toArray());
|
$servers[] = $vmess[$key]->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTrojan(User $user, $all = false):array
|
public function getAvailableTrojan(User $user):array
|
||||||
{
|
{
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$model = ServerTrojan::orderBy('sort', 'ASC');
|
$model = ServerTrojan::orderBy('sort', 'ASC');
|
||||||
if (!$all) {
|
|
||||||
$model->where('show', 1);
|
|
||||||
}
|
|
||||||
$trojan = $model->get();
|
$trojan = $model->get();
|
||||||
for ($i = 0; $i < count($trojan); $i++) {
|
foreach ($trojan as $key => $v) {
|
||||||
$trojan[$i]['type'] = 'trojan';
|
if (!$v['show']) continue;
|
||||||
$groupId = $trojan[$i]['group_id'];
|
$trojan[$key]['type'] = 'trojan';
|
||||||
if (!in_array($user->group_id, $groupId)) continue;
|
if (!in_array($user->group_id, $trojan[$key]['group_id'])) continue;
|
||||||
if (strpos($trojan[$i]['port'], '-') !== false) {
|
if (strpos($trojan[$key]['port'], '-') !== false) {
|
||||||
$trojan[$i]['port'] = Helper::randomPort($trojan[$i]['port']);
|
$trojan[$key]['port'] = Helper::randomPort($trojan[$key]['port']);
|
||||||
}
|
}
|
||||||
if ($trojan[$i]['parent_id']) {
|
if ($trojan[$key]['parent_id']) {
|
||||||
$trojan[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_TROJAN_LAST_CHECK_AT', $trojan[$i]['parent_id']));
|
$trojan[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_TROJAN_LAST_CHECK_AT', $trojan[$key]['parent_id']));
|
||||||
} else {
|
} else {
|
||||||
$trojan[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_TROJAN_LAST_CHECK_AT', $trojan[$i]['id']));
|
$trojan[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_TROJAN_LAST_CHECK_AT', $trojan[$key]['id']));
|
||||||
}
|
}
|
||||||
array_push($servers, $trojan[$i]->toArray());
|
$servers[] = $trojan[$key]->toArray();
|
||||||
}
|
}
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShadowsocks(User $user, $all = false)
|
public function getAvailableShadowsocks(User $user)
|
||||||
{
|
{
|
||||||
$servers = [];
|
$servers = [];
|
||||||
$model = ServerShadowsocks::orderBy('sort', 'ASC');
|
$model = ServerShadowsocks::orderBy('sort', 'ASC');
|
||||||
if (!$all) {
|
$shadowsocks = $model->get()->keyBy('id');
|
||||||
$model->where('show', 1);
|
foreach ($shadowsocks as $key => $v) {
|
||||||
|
if (!$v['show']) continue;
|
||||||
|
$shadowsocks[$key]['type'] = 'shadowsocks';
|
||||||
|
$shadowsocks[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_SHADOWSOCKS_LAST_CHECK_AT', $v['id']));
|
||||||
|
if (!in_array($user->group_id, $v['group_id'])) continue;
|
||||||
|
if (strpos($v['port'], '-') !== false) {
|
||||||
|
$shadowsocks[$key]['port'] = Helper::randomPort($v['port']);
|
||||||
}
|
}
|
||||||
$shadowsocks = $model->get();
|
if (isset($shadowsocks[$v['parent_id']])) {
|
||||||
for ($i = 0; $i < count($shadowsocks); $i++) {
|
$shadowsocks[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_SHADOWSOCKS_LAST_CHECK_AT', $v['parent_id']));
|
||||||
$shadowsocks[$i]['type'] = 'shadowsocks';
|
$shadowsocks[$key]['created_at'] = $shadowsocks[$v['parent_id']]['created_at'];
|
||||||
$groupId = $shadowsocks[$i]['group_id'];
|
|
||||||
if (!in_array($user->group_id, $groupId)) continue;
|
|
||||||
if (strpos($shadowsocks[$i]['port'], '-') !== false) {
|
|
||||||
$shadowsocks[$i]['port'] = Helper::randomPort($shadowsocks[$i]['port']);
|
|
||||||
}
|
}
|
||||||
if ($shadowsocks[$i]['parent_id']) {
|
$servers[] = $shadowsocks[$key]->toArray();
|
||||||
$shadowsocks[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_SHADOWSOCKS_LAST_CHECK_AT', $shadowsocks[$i]['parent_id']));
|
|
||||||
} else {
|
|
||||||
$shadowsocks[$i]['last_check_at'] = Cache::get(CacheKey::get('SERVER_SHADOWSOCKS_LAST_CHECK_AT', $shadowsocks[$i]['id']));
|
|
||||||
}
|
|
||||||
array_push($servers, $shadowsocks[$i]->toArray());
|
|
||||||
}
|
}
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAvailableServers(User $user, $all = false)
|
public function getAvailableServers(User $user)
|
||||||
{
|
{
|
||||||
$servers = array_merge(
|
$servers = array_merge(
|
||||||
$this->getShadowsocks($user, $all),
|
$this->getAvailableShadowsocks($user),
|
||||||
$this->getV2ray($user, $all),
|
$this->getAvailableVmess($user),
|
||||||
$this->getTrojan($user, $all)
|
$this->getAvailableTrojan($user)
|
||||||
);
|
);
|
||||||
$tmp = array_column($servers, 'sort');
|
$tmp = array_column($servers, 'sort');
|
||||||
array_multisort($tmp, SORT_ASC, $servers);
|
array_multisort($tmp, SORT_ASC, $servers);
|
||||||
$servers = array_map(function ($server) {
|
return array_map(function ($server) {
|
||||||
$server['port'] = (int)$server['port'];
|
$server['port'] = (int)$server['port'];
|
||||||
|
$server['is_online'] = (time() - 300 > $server['last_check_at']) ? 0 : 1;
|
||||||
|
$server['cache_key'] = "{$server['type']}-{$server['id']}-{$server['updated_at']}-{$server['is_online']}";
|
||||||
return $server;
|
return $server;
|
||||||
}, $servers);
|
}, $servers);
|
||||||
return $servers;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAvailableUsers($groupId)
|
public function getAvailableUsers($groupId)
|
||||||
@ -157,45 +149,46 @@ class ServerService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getShadowsocksServers()
|
public function getAllShadowsocks()
|
||||||
{
|
{
|
||||||
$server = ServerShadowsocks::orderBy('sort', 'ASC')->get();
|
$servers = ServerShadowsocks::orderBy('sort', 'ASC')
|
||||||
for ($i = 0; $i < count($server); $i++) {
|
->get()
|
||||||
$server[$i]['type'] = 'shadowsocks';
|
->toArray();
|
||||||
|
foreach ($servers as $k => $v) {
|
||||||
|
$servers[$k]['type'] = 'shadowsocks';
|
||||||
}
|
}
|
||||||
return $server->toArray();
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getV2rayServers()
|
public function getAllVMess()
|
||||||
{
|
{
|
||||||
$server = ServerV2ray::orderBy('sort', 'ASC')->get();
|
$servers = ServerVmess::orderBy('sort', 'ASC')
|
||||||
for ($i = 0; $i < count($server); $i++) {
|
->get()
|
||||||
$server[$i]['type'] = 'v2ray';
|
->toArray();
|
||||||
|
foreach ($servers as $k => $v) {
|
||||||
|
$servers[$k]['type'] = 'vmess';
|
||||||
}
|
}
|
||||||
return $server->toArray();
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTrojanServers()
|
public function getAllTrojan()
|
||||||
{
|
{
|
||||||
$server = ServerTrojan::orderBy('sort', 'ASC')->get();
|
$servers = ServerTrojan::orderBy('sort', 'ASC')
|
||||||
for ($i = 0; $i < count($server); $i++) {
|
->get()
|
||||||
$server[$i]['type'] = 'trojan';
|
->toArray();
|
||||||
|
foreach ($servers as $k => $v) {
|
||||||
|
$servers[$k]['type'] = 'trojan';
|
||||||
}
|
}
|
||||||
return $server->toArray();
|
return $servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mergeData(&$servers)
|
private function mergeData(&$servers)
|
||||||
{
|
{
|
||||||
foreach ($servers as $k => $v) {
|
foreach ($servers as $k => $v) {
|
||||||
$serverType = strtoupper($servers[$k]['type']);
|
$serverType = strtoupper($v['type']);
|
||||||
$servers[$k]['online'] = Cache::get(CacheKey::get("SERVER_{$serverType}_ONLINE_USER", $servers[$k]['parent_id'] ? $servers[$k]['parent_id'] : $servers[$k]['id']));
|
$servers[$k]['online'] = Cache::get(CacheKey::get("SERVER_{$serverType}_ONLINE_USER", $v['parent_id'] ?? $v['id']));
|
||||||
if ($servers[$k]['parent_id']) {
|
$servers[$k]['last_check_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_CHECK_AT", $v['parent_id'] ?? $v['id']));
|
||||||
$servers[$k]['last_check_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_CHECK_AT", $servers[$k]['parent_id']));
|
$servers[$k]['last_push_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_PUSH_AT", $v['parent_id'] ?? $v['id']));
|
||||||
$servers[$k]['last_push_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_PUSH_AT", $servers[$k]['parent_id']));
|
|
||||||
} else {
|
|
||||||
$servers[$k]['last_check_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_CHECK_AT", $servers[$k]['id']));
|
|
||||||
$servers[$k]['last_push_at'] = Cache::get(CacheKey::get("SERVER_{$serverType}_LAST_PUSH_AT", $servers[$k]['id']));
|
|
||||||
}
|
|
||||||
if ((time() - 300) >= $servers[$k]['last_check_at']) {
|
if ((time() - 300) >= $servers[$k]['last_check_at']) {
|
||||||
$servers[$k]['available_status'] = 0;
|
$servers[$k]['available_status'] = 0;
|
||||||
} else if ((time() - 300) >= $servers[$k]['last_push_at']) {
|
} else if ((time() - 300) >= $servers[$k]['last_push_at']) {
|
||||||
@ -209,9 +202,9 @@ class ServerService
|
|||||||
public function getAllServers()
|
public function getAllServers()
|
||||||
{
|
{
|
||||||
$servers = array_merge(
|
$servers = array_merge(
|
||||||
$this->getShadowsocksServers(),
|
$this->getAllShadowsocks(),
|
||||||
$this->getV2rayServers(),
|
$this->getAllVMess(),
|
||||||
$this->getTrojanServers()
|
$this->getAllTrojan()
|
||||||
);
|
);
|
||||||
$this->mergeData($servers);
|
$this->mergeData($servers);
|
||||||
$tmp = array_column($servers, 'sort');
|
$tmp = array_column($servers, 'sort');
|
||||||
@ -234,8 +227,8 @@ class ServerService
|
|||||||
public function getServer($serverId, $serverType)
|
public function getServer($serverId, $serverType)
|
||||||
{
|
{
|
||||||
switch ($serverType) {
|
switch ($serverType) {
|
||||||
case 'v2ray':
|
case 'vmess':
|
||||||
return ServerV2ray::find($serverId);
|
return ServerVmess::find($serverId);
|
||||||
case 'shadowsocks':
|
case 'shadowsocks':
|
||||||
return ServerShadowsocks::find($serverId);
|
return ServerShadowsocks::find($serverId);
|
||||||
case 'trojan':
|
case 'trojan':
|
||||||
|
@ -44,6 +44,9 @@ class UserService
|
|||||||
$md = date('m-d', $expiredAt);
|
$md = date('m-d', $expiredAt);
|
||||||
$nowYear = strtotime(date("Y-{$md}"));
|
$nowYear = strtotime(date("Y-{$md}"));
|
||||||
$nextYear = strtotime('+1 year', $nowYear);
|
$nextYear = strtotime('+1 year', $nowYear);
|
||||||
|
if ($nowYear > time()) {
|
||||||
|
return (int)(($nowYear - time()) / 86400);
|
||||||
|
}
|
||||||
return (int)(($nextYear - time()) / 86400);
|
return (int)(($nextYear - time()) / 86400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ class CacheKey
|
|||||||
CONST KEYS = [
|
CONST KEYS = [
|
||||||
'EMAIL_VERIFY_CODE' => '邮箱验证码',
|
'EMAIL_VERIFY_CODE' => '邮箱验证码',
|
||||||
'LAST_SEND_EMAIL_VERIFY_TIMESTAMP' => '最后一次发送邮箱验证码时间',
|
'LAST_SEND_EMAIL_VERIFY_TIMESTAMP' => '最后一次发送邮箱验证码时间',
|
||||||
'SERVER_V2RAY_ONLINE_USER' => '节点在线用户',
|
'SERVER_VMESS_ONLINE_USER' => '节点在线用户',
|
||||||
'SERVER_V2RAY_LAST_CHECK_AT' => '节点最后检查时间',
|
'SERVER_VMESS_LAST_CHECK_AT' => '节点最后检查时间',
|
||||||
'SERVER_V2RAY_LAST_PUSH_AT' => '节点最后推送时间',
|
'SERVER_VMESS_LAST_PUSH_AT' => '节点最后推送时间',
|
||||||
'SERVER_TROJAN_ONLINE_USER' => 'trojan节点在线用户',
|
'SERVER_TROJAN_ONLINE_USER' => 'trojan节点在线用户',
|
||||||
'SERVER_TROJAN_LAST_CHECK_AT' => 'trojan节点最后检查时间',
|
'SERVER_TROJAN_LAST_CHECK_AT' => 'trojan节点最后检查时间',
|
||||||
'SERVER_TROJAN_LAST_PUSH_AT' => 'trojan节点最后推送时间',
|
'SERVER_TROJAN_LAST_PUSH_AT' => 'trojan节点最后推送时间',
|
||||||
|
@ -30,8 +30,8 @@ class Helper
|
|||||||
|
|
||||||
public static function generateOrderNo(): string
|
public static function generateOrderNo(): string
|
||||||
{
|
{
|
||||||
$randomChar = rand(10000, 99999);
|
$randomChar = mt_rand(10000, 99999);
|
||||||
return date('YmdHms') . $randomChar;
|
return date('YmdHms') . substr(microtime(), 2, 6) . $randomChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function exchange($from, $to)
|
public static function exchange($from, $to)
|
||||||
|
@ -237,5 +237,5 @@ return [
|
|||||||
| The only modification by laravel config
|
| The only modification by laravel config
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'version' => '1.7.2.1671471846226'
|
'version' => '1.7.3.1672843907081'
|
||||||
];
|
];
|
||||||
|
@ -134,7 +134,8 @@ CREATE TABLE `v2_order` (
|
|||||||
`paid_at` int(11) DEFAULT NULL,
|
`paid_at` int(11) DEFAULT NULL,
|
||||||
`created_at` int(11) NOT NULL,
|
`created_at` int(11) NOT NULL,
|
||||||
`updated_at` int(11) NOT NULL,
|
`updated_at` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `trade_no` (`trade_no`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
@ -163,11 +164,11 @@ CREATE TABLE `v2_plan` (
|
|||||||
`group_id` int(11) NOT NULL,
|
`group_id` int(11) NOT NULL,
|
||||||
`transfer_enable` int(11) NOT NULL,
|
`transfer_enable` int(11) NOT NULL,
|
||||||
`speed_limit` int(11) DEFAULT NULL,
|
`speed_limit` int(11) DEFAULT NULL,
|
||||||
`name` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
|
`name` varchar(255) NOT NULL,
|
||||||
`show` tinyint(1) NOT NULL DEFAULT '0',
|
`show` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`sort` int(11) DEFAULT NULL,
|
`sort` int(11) DEFAULT NULL,
|
||||||
`renew` tinyint(1) NOT NULL DEFAULT '1',
|
`renew` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
`content` text CHARACTER SET utf8mb4,
|
`content` text,
|
||||||
`month_price` int(11) DEFAULT NULL,
|
`month_price` int(11) DEFAULT NULL,
|
||||||
`quarter_price` int(11) DEFAULT NULL,
|
`quarter_price` int(11) DEFAULT NULL,
|
||||||
`half_year_price` int(11) DEFAULT NULL,
|
`half_year_price` int(11) DEFAULT NULL,
|
||||||
@ -181,7 +182,7 @@ CREATE TABLE `v2_plan` (
|
|||||||
`created_at` int(11) NOT NULL,
|
`created_at` int(11) NOT NULL,
|
||||||
`updated_at` int(11) NOT NULL,
|
`updated_at` int(11) NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `v2_server_group`;
|
DROP TABLE IF EXISTS `v2_server_group`;
|
||||||
@ -252,8 +253,8 @@ CREATE TABLE `v2_server_trojan` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='trojan伺服器表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='trojan伺服器表';
|
||||||
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `v2_server_v2ray`;
|
DROP TABLE IF EXISTS `v2_server_vmess`;
|
||||||
CREATE TABLE `v2_server_v2ray` (
|
CREATE TABLE `v2_server_vmess` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`group_id` varchar(255) NOT NULL,
|
`group_id` varchar(255) NOT NULL,
|
||||||
`route_id` varchar(255) DEFAULT NULL,
|
`route_id` varchar(255) DEFAULT NULL,
|
||||||
@ -265,7 +266,7 @@ CREATE TABLE `v2_server_v2ray` (
|
|||||||
`tls` tinyint(4) NOT NULL DEFAULT '0',
|
`tls` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`tags` varchar(255) DEFAULT NULL,
|
`tags` varchar(255) DEFAULT NULL,
|
||||||
`rate` varchar(11) NOT NULL,
|
`rate` varchar(11) NOT NULL,
|
||||||
`network` text NOT NULL,
|
`network` varchar(11) NOT NULL,
|
||||||
`rules` text,
|
`rules` text,
|
||||||
`networkSettings` text,
|
`networkSettings` text,
|
||||||
`tlsSettings` text,
|
`tlsSettings` text,
|
||||||
@ -397,4 +398,4 @@ CREATE TABLE `v2_user` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
-- 2022-12-15 05:24:08
|
-- 2023-03-07 13:10:15
|
||||||
|
@ -642,3 +642,18 @@ CREATE TABLE `v2_server_route` (
|
|||||||
|
|
||||||
ALTER TABLE `v2_server_route`
|
ALTER TABLE `v2_server_route`
|
||||||
CHANGE `match` `match` text COLLATE 'utf8mb4_general_ci' NOT NULL AFTER `remarks`;
|
CHANGE `match` `match` text COLLATE 'utf8mb4_general_ci' NOT NULL AFTER `remarks`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_order`
|
||||||
|
ADD UNIQUE `trade_no` (`trade_no`);
|
||||||
|
|
||||||
|
ALTER TABLE `v2_plan`
|
||||||
|
CHANGE `content` `content` text COLLATE 'utf8mb4_general_ci' NULL AFTER `renew`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_plan`
|
||||||
|
COLLATE 'utf8mb4_general_ci';
|
||||||
|
|
||||||
|
ALTER TABLE `v2_server_v2ray`
|
||||||
|
RENAME TO `v2_server_vmess`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_server_vmess`
|
||||||
|
CHANGE `network` `network` varchar(11) COLLATE 'utf8mb4_general_ci' NOT NULL AFTER `rate`;
|
||||||
|
2
public/assets/admin/umi.js
vendored
2
public/assets/admin/umi.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/theme/v2board/assets/umi.js
vendored
2
public/theme/v2board/assets/umi.js
vendored
File diff suppressed because one or more lines are too long
2
public/theme/v2board/assets/vendors.async.js
vendored
2
public/theme/v2board/assets/vendors.async.js
vendored
File diff suppressed because one or more lines are too long
@ -17,7 +17,7 @@ dns:
|
|||||||
default-nameserver:
|
default-nameserver:
|
||||||
- 223.5.5.5
|
- 223.5.5.5
|
||||||
- 119.29.29.29
|
- 119.29.29.29
|
||||||
enhanced-mode: redir-host
|
enhanced-mode: fake-ip
|
||||||
fake-ip-range: 198.18.0.1/16
|
fake-ip-range: 198.18.0.1/16
|
||||||
use-hosts: true
|
use-hosts: true
|
||||||
nameserver:
|
nameserver:
|
||||||
|
Loading…
Reference in New Issue
Block a user