Explorar el Código

2.4.0 phase 3: db.sql 转换至 Migration + 优化

兔姬桑 hace 4 años
padre
commit
aeb4af6f0f
Se han modificado 81 ficheros con 3546 adiciones y 916 borrados
  1. 2 2
      app/Components/Helpers.php
  2. 2 4
      app/Console/Commands/AutoClearLog.php
  3. 15 17
      app/Console/Commands/AutoJob.php
  4. 2 2
      app/Console/Commands/DailyJob.php
  5. 9 13
      app/Console/Commands/UserTrafficAbnormalAutoWarning.php
  6. 1 4
      app/Console/Commands/UserTrafficAutoWarning.php
  7. 2 1
      app/Http/Controllers/Admin/CouponController.php
  8. 1 1
      app/Http/Controllers/Admin/SubscribeController.php
  9. 6 20
      app/Http/Controllers/AdminController.php
  10. 3 10
      app/Http/Controllers/AuthController.php
  11. 3 3
      app/Http/Controllers/Controller.php
  12. 2 1
      app/Http/Controllers/Gateway/AbstractPayment.php
  13. 5 4
      app/Http/Controllers/NodeController.php
  14. 2 3
      app/Http/Controllers/User/SubscribeController.php
  15. 4 7
      app/Http/Controllers/UserController.php
  16. 1 0
      app/Models/EmailFilter.php
  17. 1 0
      app/Models/Label.php
  18. 1 0
      app/Models/Level.php
  19. 1 0
      app/Models/Rule.php
  20. 1 0
      app/Models/SsConfig.php
  21. 1 1
      app/Models/UserSubscribeLog.php
  22. 3 2
      app/Observers/NodeObserver.php
  23. 7 0
      app/Observers/UserObserver.php
  24. 0 19
      app/helpers.php
  25. 0 1
      composer.json
  26. 469 109
      composer.lock
  27. 36 0
      database/migrations/2020_08_21_145711_create_article_table.php
  28. 28 0
      database/migrations/2020_08_21_145711_create_config_table.php
  29. 28 0
      database/migrations/2020_08_21_145711_create_country_table.php
  30. 32 0
      database/migrations/2020_08_21_145711_create_coupon_log_table.php
  31. 40 0
      database/migrations/2020_08_21_145711_create_coupon_table.php
  32. 29 0
      database/migrations/2020_08_21_145711_create_email_filter_table.php
  33. 32 0
      database/migrations/2020_08_21_145711_create_failed_jobs_table.php
  34. 47 0
      database/migrations/2020_08_21_145711_create_goods_table.php
  35. 35 0
      database/migrations/2020_08_21_145711_create_invite_table.php
  36. 33 0
      database/migrations/2020_08_21_145711_create_jobs_table.php
  37. 29 0
      database/migrations/2020_08_21_145711_create_label_table.php
  38. 29 0
      database/migrations/2020_08_21_145711_create_level_table.php
  39. 35 0
      database/migrations/2020_08_21_145711_create_marketing_table.php
  40. 32 0
      database/migrations/2020_08_21_145711_create_node_auth_table.php
  41. 32 0
      database/migrations/2020_08_21_145711_create_node_certificate_table.php
  42. 33 0
      database/migrations/2020_08_21_145711_create_node_daily_data_flow_table.php
  43. 33 0
      database/migrations/2020_08_21_145711_create_node_hourly_data_flow_table.php
  44. 30 0
      database/migrations/2020_08_21_145711_create_node_label_table.php
  45. 33 0
      database/migrations/2020_08_21_145711_create_node_ping_table.php
  46. 32 0
      database/migrations/2020_08_21_145711_create_node_rule_table.php
  47. 35 0
      database/migrations/2020_08_21_145711_create_notification_log_table.php
  48. 41 0
      database/migrations/2020_08_21_145711_create_order_table.php
  49. 33 0
      database/migrations/2020_08_21_145711_create_payment_callback_table.php
  50. 36 0
      database/migrations/2020_08_21_145711_create_payment_table.php
  51. 33 0
      database/migrations/2020_08_21_145711_create_products_pool_table.php
  52. 35 0
      database/migrations/2020_08_21_145711_create_referral_apply_table.php
  53. 35 0
      database/migrations/2020_08_21_145711_create_referral_log_table.php
  54. 31 0
      database/migrations/2020_08_21_145711_create_rule_group_node_table.php
  55. 33 0
      database/migrations/2020_08_21_145711_create_rule_group_table.php
  56. 33 0
      database/migrations/2020_08_21_145711_create_rule_log_table.php
  57. 30 0
      database/migrations/2020_08_21_145711_create_rule_table.php
  58. 31 0
      database/migrations/2020_08_21_145711_create_ss_config_table.php
  59. 31 0
      database/migrations/2020_08_21_145711_create_ss_node_info_table.php
  60. 33 0
      database/migrations/2020_08_21_145711_create_ss_node_ip_table.php
  61. 30 0
      database/migrations/2020_08_21_145711_create_ss_node_online_log_table.php
  62. 17 21
      database/migrations/2020_08_21_145711_create_ss_node_table.php
  63. 33 0
      database/migrations/2020_08_21_145711_create_ticket_reply_table.php
  64. 34 0
      database/migrations/2020_08_21_145711_create_ticket_table.php
  65. 33 0
      database/migrations/2020_08_21_145711_create_user_baned_log_table.php
  66. 34 0
      database/migrations/2020_08_21_145711_create_user_credit_log_table.php
  67. 35 0
      database/migrations/2020_08_21_145711_create_user_daily_data_flow_table.php
  68. 33 0
      database/migrations/2020_08_21_145711_create_user_data_modify_log_table.php
  69. 29 0
      database/migrations/2020_08_21_145711_create_user_group_table.php
  70. 35 0
      database/migrations/2020_08_21_145711_create_user_hourly_data_flow_table.php
  71. 36 0
      database/migrations/2020_08_21_145711_create_user_login_log_table.php
  72. 31 0
      database/migrations/2020_08_21_145711_create_user_subscribe_log_table.php
  73. 36 0
      database/migrations/2020_08_21_145711_create_user_subscribe_table.php
  74. 63 0
      database/migrations/2020_08_21_145711_create_user_table.php
  75. 35 0
      database/migrations/2020_08_21_145711_create_user_traffic_log_table.php
  76. 32 0
      database/migrations/2020_08_21_145711_create_verify_code_table.php
  77. 33 0
      database/migrations/2020_08_21_145711_create_verify_table.php
  78. 528 0
      database/migrations/2020_08_21_150711_preset_data.php
  79. 1 1
      resources/views/admin/subscribe/subscribeList.blade.php
  80. 674 670
      sql/db.sql
  81. 92 0
      sql/mod/20200823.sql

+ 2 - 2
app/Components/Helpers.php

@@ -57,7 +57,7 @@ class Helpers {
 
 	// 生成用户的订阅码
 	public static function makeSubscribeCode(): string {
-		$code = makeRandStr(5);
+		$code = Str::random();
 		if(UserSubscribe::whereCode($code)->exists()){
 			$code = self::makeSubscribeCode();
 		}
@@ -83,7 +83,7 @@ class Helpers {
 		$user->password = $password;
 		// 生成一个可用端口
 		$user->port = self::sysConfig()['is_rand_port']? self::getRandPort() : self::getOnlyPort();
-		$user->passwd = makeRandStr();
+		$user->passwd = Str::random();
 		$user->vmess_id = Str::uuid();
 		$user->enable = 1;
 		$user->method = self::getDefaultMethod();

+ 2 - 4
app/Console/Commands/AutoClearLog.php

@@ -50,14 +50,12 @@ class AutoClearLog extends Command {
 			// 清除用户每时各流量数据日志
 			UserHourlyDataFlow::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 days')))->delete();
 
-			// 清除用户各节点的每天流量数据日志
+			// 清除用户各节点 / 节点总计的每天流量数据日志
 			UserDailyDataFlow::where('node_id', '<>', 0)
 			                 ->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-1 month')))
+			                 ->orWhere('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 month')))
 			                 ->delete();
 
-			// 清除用户每天流量数据日志
-			UserDailyDataFlow::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 month')))->delete();
-
 			// 清除节点每小时流量数据日志
 			NodeHourlyDataFlow::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 days')))->delete();
 

+ 15 - 17
app/Console/Commands/AutoJob.php

@@ -77,11 +77,12 @@ class AutoJob extends Command {
 		// 注册验证码自动置无效
 		VerifyCode::recentUnused()->update(['status' => 2]);
 
-		// 优惠券到期自动置无效
-		Coupon::whereStatus(0)->where('end_time', '<=', time())->update(['status' => 2]);
-
-		// 用尽的优惠劵
-		Coupon::whereStatus(0)->whereIn('type', [1, 2])->whereUsableTimes(0)->update(['status' => 2]);
+		// 优惠券到期 / 用尽的 自动置无效
+		Coupon::whereStatus(0)
+		      ->where('end_time', '<=', time())
+		      ->orWhereIn('type', [1, 2])
+		      ->whereUsableTimes(0)
+		      ->update(['status' => 2]);
 
 		// 邀请码到期自动置无效
 		Invite::whereStatus(0)->where('dateline', '<=', date('Y-m-d H:i:s'))->update(['status' => 2]);
@@ -133,7 +134,7 @@ class AutoJob extends Command {
 	private function blockUsers(): void {
 		// 封禁1小时内流量异常账号
 		if(sysConfig('is_traffic_ban')){
-			$userList = User::activeUser()->whereBanTime(0)->get();
+			$userList = User::activeUser()->whereBanTime(null)->get();
 			foreach($userList as $user){
 				// 对管理员豁免
 				if($user->is_admin){
@@ -155,7 +156,7 @@ class AutoJob extends Command {
 		}
 
 		// 禁用流量超限用户
-		$userList = User::activeUser()->whereBanTime(0)->whereRaw("u + d >= transfer_enable")->get();
+		$userList = User::activeUser()->whereBanTime(null)->whereRaw("u + d >= transfer_enable")->get();
 		foreach($userList as $user){
 			$user->update(['enable' => 0]);
 
@@ -167,10 +168,10 @@ class AutoJob extends Command {
 	// 解封被临时封禁的账号
 	private function unblockUsers(): void {
 		// 解封被临时封禁的账号
-		$userList = User::whereEnable(0)->where('status', '>=', 0)->where('ban_time', '>', 0)->get();
+		$userList = User::whereEnable(0)->where('status', '>=', 0)->whereNotNull('ban_time')->get();
 		foreach($userList as $user){
 			if($user->ban_time < time()){
-				$user->update(['enable' => 1, 'ban_time' => 0]);
+				$user->update(['enable' => 1, 'ban_time' => null]);
 
 				// 写入操作日志
 				$this->addUserBanLog($user->id, 0, '【自动解封】-临时封禁到期');
@@ -180,7 +181,7 @@ class AutoJob extends Command {
 		// 可用流量大于已用流量也解封(比如:邀请返利自动加了流量)
 		$userList = User::whereEnable(0)
 		                ->where('status', '>=', 0)
-		                ->whereBanTime(0)
+		                ->whereBanTime(null)
 		                ->where('expired_at', '>=', date('Y-m-d'))
 		                ->whereRaw("u + d < transfer_enable")
 		                ->get();
@@ -201,13 +202,10 @@ class AutoJob extends Command {
 			$user->update(['port' => $port]);
 		}
 
-		## 被封禁的账号自动释放端口
-		User::whereEnable(0)->whereStatus(-1)->where('port', '!=', 0)->update(['port' => 0]);
-
-		## 过期一个月的账户自动释放端口
-		User::whereEnable(0)
-		    ->where('port', '!=', 0)
-		    ->where('expired_at', '<=', date("Y-m-d", strtotime("-1 months")))
+		// 被封禁 / 过期一个月 的账号自动释放端口
+		User::where('port', '<>', 0)
+		    ->whereStatus(-1)
+		    ->orWhere('expired_at', '<=', date("Y-m-d", strtotime("-1 months")))
 		    ->update(['port' => 0]);
 	}
 

+ 2 - 2
app/Console/Commands/DailyJob.php

@@ -48,7 +48,7 @@ class DailyJob extends Command {
 					'transfer_enable' => 0,
 					'enable'          => 0,
 					'reset_time'      => null,
-					'ban_time'        => 0,
+					'ban_time'        => null,
 					'status'          => -1
 				]);
 
@@ -66,7 +66,7 @@ class DailyJob extends Command {
 					'transfer_enable' => 0,
 					'enable'          => 0,
 					'reset_time'      => null,
-					'ban_time'        => 0
+					'ban_time'        => null
 				]);
 
 				$this->addUserBanLog($user->id, 0, '【封禁代理,清空账户】-账号已过期');

+ 9 - 13
app/Console/Commands/UserTrafficAbnormalAutoWarning.php

@@ -33,22 +33,18 @@ class UserTrafficAbnormalAutoWarning extends Command {
 		                                          ->groupBy('user_id')
 		                                          ->selectRaw("user_id, sum(total) as totalTraffic")
 		                                          ->get(); // 只统计100M以上的记录,加快查询速度
-		if(!$userTotalTrafficList->isEmpty()){
-			$title = "流量异常用户提醒";
 
-			foreach($userTotalTrafficList as $vo){
-				$user = User::find($vo->user_id);
+		foreach($userTotalTrafficList as $vo){
+			$user = User::find($vo->user_id);
 
-				// 推送通知管理员
-				if($vo->totalTraffic > sysConfig('traffic_ban_value') * GB){
-					$traffic = UserHourlyDataFlow::userRecentUsed($user->id)
-					                             ->selectRaw("user_id, sum(`u`) as totalU, sum(`d`) as totalD, sum(total) as totalTraffic")
-					                             ->firstOrFail();
+			// 推送通知管理员
+			if($vo->totalTraffic > sysConfig('traffic_ban_value') * GB){
+				$traffic = UserHourlyDataFlow::userRecentUsed($user->id)
+				                             ->selectRaw("user_id, sum(`u`) as totalU, sum(`d`) as totalD, sum(total) as totalTraffic")
+				                             ->first();
 
-					$content = "用户**{$user->email}(ID:{$user->id})**,最近1小时**上行流量:".flowAutoShow($traffic->totalU).",下行流量:".flowAutoShow($traffic->totalD).",共计:".flowAutoShow($traffic->totalTraffic)."**。";
-
-					PushNotification::send($title, $content);
-				}
+				PushNotification::send("流量异常用户提醒",
+					"用户**{$user->email}(ID:{$user->id})**,最近1小时**上行流量:".flowAutoShow($traffic->totalU).",下行流量:".flowAutoShow($traffic->totalD).",共计:".flowAutoShow($traffic->totalTraffic)."**。");
 			}
 		}
 	}

+ 1 - 4
app/Console/Commands/UserTrafficAutoWarning.php

@@ -37,10 +37,7 @@ class UserTrafficAutoWarning extends Command {
 
 			$usedPercent = round(($user->d + $user->u) / $user->transfer_enable, 2) * 100; // 已使用流量百分比
 			if($usedPercent >= sysConfig('traffic_warning_percent')){
-				$title = '流量提醒';
-				$content = '流量已使用:'.$usedPercent.'%,请保持关注。';
-
-				$logId = Helpers::addNotificationLog($title, $content, 1, $user->email);
+				$logId = Helpers::addNotificationLog("流量提醒", '流量已使用:'.$usedPercent.'%,请保持关注。', 1, $user->email);
 				Mail::to($user->email)->send(new userTrafficWarning($logId, $usedPercent));
 			}
 		}

+ 2 - 1
app/Http/Controllers/Admin/CouponController.php

@@ -13,6 +13,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
 use Redirect;
 use Response;
+use Str;
 use Validator;
 
 /**
@@ -98,7 +99,7 @@ class CouponController extends Controller {
 					$obj = new Coupon();
 					$obj->name = $request->input('name');
 					$obj->logo = $logo;
-					$obj->sn = $num == 1 && $request->input('sn')? $request->input('sn') : makeRandStr(8);
+					$obj->sn = $num == 1 && $request->input('sn')? $request->input('sn') : Str::random(8);
 					$obj->type = $type;
 					$obj->usable_times = $request->input('usable_times');
 					$obj->value = $request->input('value');

+ 1 - 1
app/Http/Controllers/Admin/SubscribeController.php

@@ -68,7 +68,7 @@ class SubscribeController extends Controller {
 		}
 
 		if($status){
-			UserSubscribe::find($id)->update(['status' => 1, 'ban_time' => 0, 'ban_desc' => '']);
+			UserSubscribe::find($id)->update(['status' => 1, 'ban_time' => null, 'ban_desc' => '']);
 		}else{
 			UserSubscribe::find($id)->update(['status' => 0, 'ban_time' => time(), 'ban_desc' => '后台手动封禁']);
 		}

+ 6 - 20
app/Http/Controllers/AdminController.php

@@ -28,7 +28,6 @@ use App\Models\UserDataFlowLog;
 use App\Models\UserDataModifyLog;
 use App\Models\UserGroup;
 use App\Models\UserHourlyDataFlow;
-use App\Models\UserSubscribe;
 use App\Services\UserService;
 use Auth;
 use DB;
@@ -221,9 +220,9 @@ class AdminController extends Controller {
 			$user = new User();
 			$user->username = $request->input('username');
 			$user->email = $request->input('email');
-			$user->password = Hash::make($request->input('password')?: makeRandStr());
+			$user->password = Hash::make($request->input('password')?: Str::random());
 			$user->port = $request->input('port')?: $this->makePort();
-			$user->passwd = $request->input('passwd')?: makeRandStr();
+			$user->passwd = $request->input('passwd')?: Str::random();
 			$user->vmess_id = $request->input('uuid')?: Str::uuid();
 			$user->transfer_enable = toGB($request->input('transfer_enable')?: 0);
 			$user->enable = $request->input('enable')?: 0;
@@ -244,12 +243,6 @@ class AdminController extends Controller {
 			$user->save();
 
 			if($user->id){
-				// 生成订阅码
-				$subscribe = new UserSubscribe();
-				$subscribe->user_id = $user->id;
-				$subscribe->code = Helpers::makeSubscribeCode();
-				$subscribe->times = 0;
-				$subscribe->save();
 
 				// 写入用户流量变动记录
 				Helpers::addUserTrafficModifyLog($user->id, 0, 0, toGB($request->input('transfer_enable', 0)),
@@ -283,17 +276,10 @@ class AdminController extends Controller {
 			DB::beginTransaction();
 
 			for($i = 0; $i < $amount; $i++){
-				$uid = Helpers::addUser('批量生成-'.makeRandStr(), Hash::make(makeRandStr()), toGB(1024), 365);
+				$uid = Helpers::addUser(Str::random(8).'@auto.generate', Hash::make(Str::random()), toGB(1024), 365);
 				// 生成一个可用端口
 
 				if($uid){
-					// 生成订阅码
-					$subscribe = new UserSubscribe();
-					$subscribe->user_id = $uid;
-					$subscribe->code = Helpers::makeSubscribeCode();
-					$subscribe->times = 0;
-					$subscribe->save();
-
 					// 写入用户流量变动记录
 					Helpers::addUserTrafficModifyLog($uid, 0, 0, toGB(1024), '后台批量生成用户');
 				}
@@ -341,7 +327,7 @@ class AdminController extends Controller {
 					'username'        => $request->input('username'),
 					'email'           => $email,
 					'port'            => $port,
-					'passwd'          => $request->input('passwd')?: makeRandStr(),
+					'passwd'          => $request->input('passwd')?: Str::random(),
 					'vmess_id'        => $request->input('uuid')?: Str::uuid(),
 					'transfer_enable' => toGB($transfer_enable?: 0),
 					'enable'          => $status < 0? 0 : $request->input('enable'),
@@ -657,7 +643,7 @@ class AdminController extends Controller {
 		}
 
 		// 生成JSON文件
-		$fileName = makeRandStr('16').'_shadowsocks.json';
+		$fileName = Str::random().'_shadowsocks.json';
 		$filePath = public_path('downloads/'.$fileName);
 		file_put_contents($filePath, $json);
 
@@ -1147,7 +1133,7 @@ class AdminController extends Controller {
 			$obj = new Invite();
 			$obj->inviter_id = 0;
 			$obj->invitee_id = 0;
-			$obj->code = strtoupper(substr(md5(microtime().makeRandStr()), 8, 12));
+			$obj->code = strtoupper(substr(md5(microtime().Str::random(6)), 8, 12));
 			$obj->status = 0;
 			$obj->dateline = date('Y-m-d H:i:s', strtotime("+".self::$sysConfig['admin_invite_days']." days"));
 			$obj->save();

+ 3 - 10
app/Http/Controllers/AuthController.php

@@ -12,7 +12,6 @@ use App\Models\EmailFilter;
 use App\Models\Invite;
 use App\Models\User;
 use App\Models\UserLoginLog;
-use App\Models\UserSubscribe;
 use App\Models\Verify;
 use App\Models\VerifyCode;
 use App\Services\UserService;
@@ -28,6 +27,7 @@ use Mail;
 use Redirect;
 use Response;
 use Session;
+use Str;
 use Validator;
 
 /**
@@ -351,13 +351,6 @@ class AuthController extends Controller {
 			// 更新昵称
 			User::find($uid)->update(['username' => $username]);
 
-			// 生成订阅码
-			$subscribe = new UserSubscribe();
-			$subscribe->user_id = $uid;
-			$subscribe->code = Helpers::makeSubscribeCode();
-			$subscribe->times = 0;
-			$subscribe->save();
-
 			// 注册次数+1
 			if(Cache::has($cacheKey)){
 				Cache::increment($cacheKey);
@@ -403,7 +396,7 @@ class AuthController extends Controller {
 		}
 
 		$view['emailList'] = self::$sysConfig['is_email_filtering'] != 2? false : EmailFilter::whereType(2)->get();
-		Session::put('register_token', makeRandStr(16));
+		Session::put('register_token', Str::random());
 
 		return Response::view('auth.register', $view);
 	}
@@ -773,7 +766,7 @@ class AuthController extends Controller {
 		}
 
 		// 发送邮件
-		$code = makeRandStr(6, true);
+		$code = Str::random(6);
 		$logId = Helpers::addNotificationLog('发送注册验证码', '验证码:'.$code, 1, $email);
 		Mail::to($email)->send(new sendVerifyCode($logId, $code));
 

+ 3 - 3
app/Http/Controllers/Controller.php

@@ -25,7 +25,7 @@ class Controller extends BaseController {
 
 	// 生成随机密码
 	public function makePasswd() {
-		return makeRandStr();
+		return Str::random();
 	}
 
 	// 生成UUID
@@ -35,7 +35,7 @@ class Controller extends BaseController {
 
 	// 生成网站安全码
 	public function makeSecurityCode(): string {
-		return strtolower(makeRandStr(8));
+		return strtolower(Str::random(8));
 	}
 
 	// 类似Linux中的tail命令
@@ -109,7 +109,7 @@ class Controller extends BaseController {
 				throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
 			}
 
-			$fileName = makeRandStr(18, true).".{$type}";
+			$fileName = Str::random(18).".{$type}";
 			if(file_put_contents(public_path($path.$fileName),
 				base64_decode(str_replace($result[1], '', $base64_image_content)))){
 				chmod(public_path($path.$fileName), 0744);

+ 2 - 1
app/Http/Controllers/Gateway/AbstractPayment.php

@@ -7,6 +7,7 @@ use App\Models\Payment;
 use App\Models\PaymentCallback;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\Request;
+use Str;
 
 abstract class AbstractPayment {
 	protected static $sysConfig;
@@ -21,7 +22,7 @@ abstract class AbstractPayment {
 
 	protected function creatNewPayment($uid, $oid, $amount): Payment {
 		$payment = new Payment();
-		$payment->trade_no = makeRandStr(8);
+		$payment->trade_no = Str::random(8);
 		$payment->user_id = $uid;
 		$payment->order_id = $oid;
 		$payment->amount = $amount;

+ 5 - 4
app/Http/Controllers/NodeController.php

@@ -21,6 +21,7 @@ use Log;
 use Redirect;
 use Response;
 use Session;
+use Str;
 use Validator;
 
 class NodeController extends Controller {
@@ -402,8 +403,8 @@ class NodeController extends Controller {
 		foreach(array_diff($nodeArray, $authArray) as $nodeId){
 			$obj = new NodeAuth();
 			$obj->node_id = $nodeId;
-			$obj->key = makeRandStr(16);
-			$obj->secret = makeRandStr(8);
+			$obj->key = Str::random();
+			$obj->secret = Str::random(8);
 			$obj->save();
 		}
 		return Response::json(['status' => 'success', 'message' => '生成成功']);
@@ -422,8 +423,8 @@ class NodeController extends Controller {
 	// 重置节点授权
 	public function refreshAuth(Request $request): ?JsonResponse {
 		$ret = NodeAuth::whereId($request->input('id'))->update([
-			'key'    => makeRandStr(16),
-			'secret' => makeRandStr(8)
+			'key'    => Str::random(),
+			'secret' => Str::random(8)
 		]);
 		if($ret){
 			return Response::json(['status' => 'success', 'message' => '操作成功']);

+ 2 - 3
app/Http/Controllers/User/SubscribeController.php

@@ -4,7 +4,6 @@ namespace App\Http\Controllers\User;
 
 use App\Components\Helpers;
 use App\Http\Controllers\Controller;
-use App\Models\User;
 use App\Models\UserSubscribe;
 use App\Models\UserSubscribeLog;
 use Arr;
@@ -38,7 +37,7 @@ class SubscribeController extends Controller {
 		}
 
 		// 检查用户是否有效
-		$user = User::find($subscribe->user_id);
+		$user = $subscribe->user;
 		if(!$user){
 			exit($this->infoGenerator('错误订阅链接,账号不存在!请前往官网重新获取订阅链接'));
 		}
@@ -49,7 +48,7 @@ class SubscribeController extends Controller {
 
 		if($user->enable != 1){
 			$unusedTransfer = $user->transfer_enable - $user->u - $user->d;
-			if($user->ban_time > 0){
+			if($user->ban_time){
 				exit($this->infoGenerator('您的账号处于封禁状态,请在'.date('Y-m-d H:i:s', $user->ban_time).'之后再更新!'));
 			}
 

+ 4 - 7
app/Http/Controllers/UserController.php

@@ -34,6 +34,7 @@ use Mail;
 use Redirect;
 use Response;
 use Session;
+use Str;
 use Validator;
 
 /**
@@ -67,11 +68,7 @@ class UserController extends Controller {
 		$hourlyTraffic = UserHourlyDataFlow::userRecentUsed($user->id)->sum('total');
 		$view['isTrafficWarning'] = $hourlyTraffic >= (self::$sysConfig['traffic_ban_value'] * GB)?: 0;
 		//付费用户判断
-		$view['not_paying_user'] = Order::uid()
-		                                ->whereStatus(2)
-		                                ->whereIsExpire(0)
-		                                ->where('origin_amount', '>', 0)
-		                                ->doesntExist();
+		$view['not_paying_user'] = Order::uid()->active()->where('origin_amount', '>', 0)->doesntExist();
 		$view['userLoginLog'] = UserLoginLog::whereUserId($user->id)->latest()->first(); // 近期登录日志
 		$view = array_merge($view, $this->dataFlowChart($user->id));
 
@@ -423,7 +420,7 @@ class UserController extends Controller {
 		$obj = new Invite();
 		$obj->inviter_id = $user->id;
 		$obj->invitee_id = 0;
-		$obj->code = strtoupper(mb_substr(md5(microtime().makeRandStr()), 8, 12));
+		$obj->code = strtoupper(mb_substr(md5(microtime().Str::random()), 8, 12));
 		$obj->status = 0;
 		$obj->dateline = date('Y-m-d H:i:s', strtotime("+".self::$sysConfig['user_invite_days']." days"));
 		$obj->save();
@@ -540,7 +537,7 @@ class UserController extends Controller {
 			Auth::getUser()->subscribe->update(['code' => Helpers::makeSubscribeCode()]);
 
 			// 更换连接密码
-			Auth::getUser()->update(['passwd' => makeRandStr()]);
+			Auth::getUser()->update(['passwd' => Str::random()]);
 
 			DB::commit();
 

+ 1 - 0
app/Models/EmailFilter.php

@@ -10,4 +10,5 @@ use Illuminate\Database\Eloquent\Model;
 class EmailFilter extends Model {
 	public $timestamps = false;
 	protected $table = 'email_filter';
+	protected $guarded = ['id'];
 }

+ 1 - 0
app/Models/Label.php

@@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
 class Label extends Model {
 	public $timestamps = false;
 	protected $table = 'label';
+	protected $guarded = ['id'];
 
 	public function nodes(): HasMany {
 		return $this->hasMany(NodeLabel::class);

+ 1 - 0
app/Models/Level.php

@@ -10,4 +10,5 @@ use Illuminate\Database\Eloquent\Model;
 class Level extends Model {
 	public $timestamps = false;
 	protected $table = 'level';
+	protected $guarded = ['id'];
 }

+ 1 - 0
app/Models/Rule.php

@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Model;
 class Rule extends Model {
 	public $timestamps = false;
 	protected $table = 'rule';
+	protected $guarded = ['id'];
 
 	public function getTypeLabelAttribute(): string {
 		switch($this->attributes['type']){

+ 1 - 0
app/Models/SsConfig.php

@@ -10,6 +10,7 @@ use Illuminate\Database\Eloquent\Model;
 class SsConfig extends Model {
 	public $timestamps = false;
 	protected $table = 'ss_config';
+	protected $guarded = ['id'];
 
 	// 筛选默认
 

+ 1 - 1
app/Models/UserSubscribeLog.php

@@ -15,7 +15,7 @@ class UserSubscribeLog extends Model {
 	protected $table = 'user_subscribe_log';
 
 	public function subscribe(): BelongsTo {
-		return $this->belongsTo(UserSubscribe::class);
+		return $this->belongsTo(UserSubscribe::class, 'user_subscribe_id');
 	}
 
 	public function user(): HasOneThrough {

+ 3 - 2
app/Observers/NodeObserver.php

@@ -9,6 +9,7 @@ use App\Models\RuleGroup;
 use App\Models\UserGroup;
 use App\Services\NodeService;
 use Log;
+use Str;
 
 class NodeObserver {
 	public function saved(Node $node): void {
@@ -18,8 +19,8 @@ class NodeObserver {
 	public function created(Node $node): void {
 		$auth = new NodeAuth();
 		$auth->node_id = $node->id;
-		$auth->key = makeRandStr(16);
-		$auth->secret = makeRandStr(8);
+		$auth->key = Str::random();
+		$auth->secret = Str::random(8);
 		if(!$auth->save()){
 			Log::error('节点生成-自动生成授权时出现错误,请稍后自行生成授权!');
 		}

+ 7 - 0
app/Observers/UserObserver.php

@@ -2,11 +2,13 @@
 
 namespace App\Observers;
 
+use App\Components\Helpers;
 use App\Jobs\VNet\addUser;
 use App\Jobs\VNet\delUser;
 use App\Jobs\VNet\editUser;
 use App\Models\Node;
 use App\Models\User;
+use App\Models\UserSubscribe;
 use Arr;
 use DB;
 use Exception;
@@ -14,6 +16,11 @@ use Log;
 
 class UserObserver {
 	public function created(User $user): void {
+		$subscribe = new UserSubscribe();
+		$subscribe->user_id = $user->id;
+		$subscribe->code = Helpers::makeSubscribeCode();
+		$subscribe->save();
+
 		$allowNodes = Node::userAllowNodes($user->group_id, $user->level)->whereType(4)->get();
 		if($allowNodes){
 			addUser::dispatch($user->id, $allowNodes);

+ 0 - 19
app/helpers.php

@@ -15,25 +15,6 @@ define('Day', 86400);
 
 define('Mbps', 125000);
 
-// 生成SS密码
-if(!function_exists('makeRandStr')){
-	function makeRandStr($length = 6, $isNumbers = false) {
-		// 密码字符集,可任意添加你需要的字符
-		if(!$isNumbers){
-			$chars = 'abcdefghijkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ0123456789';
-		}else{
-			$chars = '0123456789';
-		}
-
-		$char = '';
-		for($i = 0; $i < $length; $i++){
-			$char .= $chars[random_int(0, strlen($chars) - 1)];
-		}
-
-		return $char;
-	}
-}
-
 // base64加密(处理URL)
 if(!function_exists('base64url_encode')){
 	function base64url_encode($data) {

+ 0 - 1
composer.json

@@ -36,7 +36,6 @@
 	"xhat/payjs": "^1.4"
   },
   "require-dev": {
-	"roave/security-advisories": "dev-master",
 	"barryvdh/laravel-debugbar": "^3",
 	"beyondcode/laravel-dump-server": "^1.0",
 	"filp/whoops": "^2.7",

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 469 - 109
composer.lock


+ 36 - 0
database/migrations/2020_08_21_145711_create_article_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateArticleTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('article', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('类型:1-文章、2-站内公告、3-站外公告');
+			$table->string('title', 100)->comment('标题');
+			$table->string('summary')->nullable()->comment('简介');
+			$table->string('logo')->nullable()->comment('LOGO');
+			$table->text('content')->nullable()->comment('内容');
+			$table->unsignedTinyInteger('sort')->default(0)->comment('排序');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->softDeletes()->comment('删除时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('article');
+	}
+}

+ 28 - 0
database/migrations/2020_08_21_145711_create_config_table.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateConfigTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('config', function(Blueprint $table) {
+			$table->string('name')->primary()->comment('配置名');
+			$table->text('value')->nullable()->comment('配置值');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('config');
+	}
+}

+ 28 - 0
database/migrations/2020_08_21_145711_create_country_table.php

@@ -0,0 +1,28 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCountryTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('country', function(Blueprint $table) {
+			$table->char('code', 2)->primary()->comment('ISO国家代码');
+			$table->string('name', 10)->comment('名称');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('country');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_coupon_log_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCouponLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('coupon_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('coupon_id')->default(0)->comment('优惠券ID');
+			$table->unsignedInteger('goods_id')->default(0)->comment('商品ID');
+			$table->unsignedInteger('order_id')->default(0)->comment('订单ID');
+			$table->string('description', 50)->nullable()->comment('备注');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('coupon_log');
+	}
+}

+ 40 - 0
database/migrations/2020_08_21_145711_create_coupon_table.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateCouponTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('coupon', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name', 50)->comment('优惠券名称');
+			$table->string('logo')->nullable()->comment('优惠券LOGO');
+			$table->string('sn', 50)->unique()->comment('优惠券码');
+			$table->boolean('type')->default(1)->comment('类型:1-抵用券、2-折扣券、3-充值券');
+			$table->unsignedSmallInteger('usable_times')->nullable()->comment('可使用次数');
+			$table->unsignedInteger('value')->comment('折扣金额(元)/折扣力度');
+			$table->unsignedInteger('rule')->nullable()->comment('使用限制(元)');
+			$table->unsignedInteger('start_time')->default(0)->comment('有效期开始');
+			$table->unsignedInteger('end_time')->default(0)->comment('有效期结束');
+			$table->boolean('status')->default(0)->comment('状态:0-未使用、1-已使用、2-已失效');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->softDeletes()->comment('删除时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('coupon');
+	}
+}

+ 29 - 0
database/migrations/2020_08_21_145711_create_email_filter_table.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateEmailFilterTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('email_filter', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('类型:1-黑名单、2-白名单');
+			$table->string('words', 50)->comment('敏感词');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('email_filter');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_failed_jobs_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateFailedJobsTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('failed_jobs', function(Blueprint $table) {
+			$table->bigIncrements('id');
+			$table->text('connection');
+			$table->text('queue');
+			$table->longText('payload');
+			$table->longText('exception');
+			$table->timestamp('failed_at')->useCurrent();
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('failed_jobs');
+	}
+}

+ 47 - 0
database/migrations/2020_08_21_145711_create_goods_table.php

@@ -0,0 +1,47 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateGoodsTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('goods', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name', 100)->comment('商品名称');
+			$table->string('logo')->nullable()->comment('商品图片地址');
+			$table->unsignedBigInteger('traffic')->default(0)->comment('商品内含多少流量,单位MiB');
+			$table->boolean('type')->default(1)->comment('商品类型:1-流量包、2-套餐');
+			$table->unsignedInteger('price')->default(0)->comment('售价,单位分');
+			$table->unsignedTinyInteger('level')->default(0)->comment('购买后给用户授权的等级');
+			$table->unsignedInteger('renew')->nullable()->comment('流量重置价格,单位分');
+			$table->unsignedInteger('period')->nullable()->comment('流量自动重置周期');
+			$table->string('info')->nullable()->comment('商品信息');
+			$table->string('description')->nullable()->comment('商品描述');
+			$table->unsignedInteger('days')->default(30)->comment('有效期');
+			$table->unsignedInteger('invite_num')->nullable()->comment('赠送邀请码数');
+			$table->unsignedInteger('limit_num')->nullable()->comment('限购数量,默认为null不限购');
+			$table->string('color', 50)->default('green')->comment('商品颜色');
+			$table->unsignedTinyInteger('sort')->default(0)->comment('排序');
+			$table->boolean('is_hot')->default(0)->comment('是否热销:0-否、1-是');
+			$table->boolean('status')->default(0)->comment('状态:0-下架、1-上架');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->softDeletes()->comment('删除时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('goods');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_invite_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateInviteTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('invite', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('inviter_id')->default(0)->comment('邀请ID');
+			$table->unsignedInteger('invitee_id')->nullable()->comment('受邀ID');
+			$table->char('code', 12)->unique()->comment('邀请码');
+			$table->boolean('status')->default(0)->comment('邀请码状态:0-未使用、1-已使用、2-已过期');
+			$table->dateTime('dateline')->comment('有效期至');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->softDeletes()->comment('删除时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('invite');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_jobs_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateJobsTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('jobs', function(Blueprint $table) {
+			$table->bigIncrements('id');
+			$table->string('queue')->index();
+			$table->longText('payload');
+			$table->unsignedTinyInteger('attempts');
+			$table->unsignedInteger('reserved_at')->nullable();
+			$table->unsignedInteger('available_at');
+			$table->unsignedInteger('created_at');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('jobs');
+	}
+}

+ 29 - 0
database/migrations/2020_08_21_145711_create_label_table.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateLabelTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('label', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name')->comment('名称');
+			$table->unsignedTinyInteger('sort')->default(0)->comment('排序值');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('label');
+	}
+}

+ 29 - 0
database/migrations/2020_08_21_145711_create_level_table.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateLevelTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('level', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedTinyInteger('level')->comment('等级');
+			$table->string('name', 100)->comment('等级名称');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('level');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_marketing_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMarketingTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('marketing', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->comment('类型:1-邮件群发');
+			$table->text('receiver')->comment('接收者');
+			$table->string('title')->comment('标题');
+			$table->text('content')->comment('内容');
+			$table->string('error')->nullable()->comment('错误信息');
+			$table->boolean('status')->comment('状态:-1-失败、0-待发送、1-成功');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('marketing');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_node_auth_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeAuthTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_auth', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->comment('授权节点ID');
+			$table->char('key', 16)->comment('认证KEY');
+			$table->char('secret', 8)->comment('通信密钥');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_auth');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_node_certificate_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeCertificateTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_certificate', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('domain')->comment('域名');
+			$table->text('key')->nullable()->comment('域名证书KEY');
+			$table->text('pem')->nullable()->comment('域名证书PEM');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_certificate');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_node_daily_data_flow_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeDailyDataFlowTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_daily_data_flow', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->index()->comment('节点ID');
+			$table->unsignedBigInteger('u')->default(0)->comment('上传流量');
+			$table->unsignedBigInteger('d')->default(0)->comment('下载流量');
+			$table->unsignedBigInteger('total')->default(0)->comment('总流量');
+			$table->string('traffic')->nullable()->comment('总流量(带单位)');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_daily_data_flow');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_node_hourly_data_flow_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeHourlyDataFlowTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_hourly_data_flow', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->index()->comment('节点ID');
+			$table->unsignedBigInteger('u')->default(0)->comment('上传流量');
+			$table->unsignedBigInteger('d')->default(0)->comment('下载流量');
+			$table->unsignedBigInteger('total')->default(0)->comment('总流量');
+			$table->string('traffic')->nullable()->comment('总流量(带单位)');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_hourly_data_flow');
+	}
+}

+ 30 - 0
database/migrations/2020_08_21_145711_create_node_label_table.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeLabelTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_label', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->comment('节点ID');
+			$table->unsignedInteger('label_id')->default(0)->comment('标签ID');
+			$table->index(['node_id', 'label_id'], 'idx_node_label');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_label');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_node_ping_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodePingTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_ping', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->index()->comment('对应节点id');
+			$table->integer('ct')->default(0)->comment('电信');
+			$table->integer('cu')->default(0)->comment('联通');
+			$table->integer('cm')->default(0)->comment('移动');
+			$table->integer('hk')->default(0)->comment('香港');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_ping');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_node_rule_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNodeRuleTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('node_rule', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->nullable()->comment('节点ID');
+			$table->unsignedInteger('rule_id')->nullable()->comment('审计规则ID');
+			$table->boolean('is_black')->default(1)->comment('是否黑名单模式:0-不是、1-是');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('node_rule');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_notification_log_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateNotificationLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('notification_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('类型:1-邮件、2-ServerChan、3-Bark、4-Telegram');
+			$table->string('address')->comment('收信地址');
+			$table->string('title')->comment('标题');
+			$table->text('content')->comment('内容');
+			$table->boolean('status')->default(0)->comment('状态:-1发送失败、0-等待发送、1-发送成功');
+			$table->text('error')->nullable()->comment('发送失败抛出的异常信息');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('notification_log');
+	}
+}

+ 41 - 0
database/migrations/2020_08_21_145711_create_order_table.php

@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('order', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('order_sn', 20)->comment('订单编号');
+			$table->unsignedInteger('user_id')->comment('操作人');
+			$table->unsignedInteger('goods_id')->nullable()->comment('商品ID');
+			$table->unsignedInteger('coupon_id')->nullable()->comment('优惠券ID');
+			$table->unsignedInteger('origin_amount')->default(0)->comment('订单原始总价,单位分');
+			$table->unsignedInteger('amount')->default(0)->comment('订单总价,单位分');
+			$table->dateTime('expired_at')->nullable()->comment('过期时间');
+			$table->boolean('is_expire')->default(0)->comment('是否已过期:0-未过期、1-已过期');
+			$table->boolean('pay_type')->default(0)->comment('支付渠道:0-余额、1-支付宝、2-QQ、3-微信、4-虚拟货币、5-paypal');
+			$table->string('pay_way', 10)->default('balance')->comment('支付方式:balance、f2fpay、codepay、payjs、bitpayx等');
+			$table->boolean('status')->default(0)->comment('订单状态:-1-已关闭、0-待支付、1-已支付待确认、2-已完成');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->index(['user_id', 'goods_id', 'is_expire', 'status'], 'idx_order_search');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('order');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_payment_callback_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreatePaymentCallbackTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('payment_callback', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('trade_no', 64)->comment('本地订单号');
+			$table->string('out_trade_no', 64)->comment('外部订单号(支付平台)');
+			$table->unsignedInteger('amount')->comment('交易金额,单位分');
+			$table->boolean('status')->comment('交易状态:0-失败、1-成功');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('payment_callback');
+	}
+}

+ 36 - 0
database/migrations/2020_08_21_145711_create_payment_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreatePaymentTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('payment', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('trade_no', 64)->comment('支付单号(本地订单号)');
+			$table->unsignedInteger('user_id')->comment('用户ID');
+			$table->unsignedInteger('order_id')->comment('本地订单ID');
+			$table->unsignedInteger('amount')->default(0)->comment('金额,单位分');
+			$table->text('qr_code')->nullable()->comment('支付二维码');
+			$table->text('url')->nullable()->comment('支付链接');
+			$table->boolean('status')->default(0)->comment('支付状态:-1-支付失败、0-等待支付、1-支付成功');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('payment');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_products_pool_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateProductsPoolTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('products_pool', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name')->comment('名称');
+			$table->unsignedInteger('min_amount')->default(0)->comment('适用最小金额,单位分');
+			$table->unsignedInteger('max_amount')->default(0)->comment('适用最大金额,单位分');
+			$table->boolean('status')->default(1)->comment('状态:0-未启用、1-已启用');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('products_pool');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_referral_apply_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateReferralApplyTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('referral_apply', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->comment('用户ID');
+			$table->unsignedInteger('before')->default(0)->comment('操作前可提现金额,单位分');
+			$table->unsignedInteger('after')->default(0)->comment('操作后可提现金额,单位分');
+			$table->unsignedInteger('amount')->default(0)->comment('本次提现金额,单位分');
+			$table->json('link_logs')->comment('关联返利日志ID,例如:1,3,4');
+			$table->boolean('status')->default(0)->comment('状态:-1-驳回、0-待审核、1-审核通过待打款、2-已打款');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('referral_apply');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_referral_log_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateReferralLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('referral_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('invitee_id')->comment('用户ID');
+			$table->unsignedInteger('inviter_id')->comment('推广人ID');
+			$table->unsignedInteger('order_id')->comment('关联订单ID');
+			$table->unsignedInteger('amount')->comment('消费金额,单位分');
+			$table->unsignedInteger('commission')->comment('返利金额');
+			$table->boolean('status')->default(0)->comment('状态:0-未提现、1-审核中、2-已提现');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('referral_log');
+	}
+}

+ 31 - 0
database/migrations/2020_08_21_145711_create_rule_group_node_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateRuleGroupNodeTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('rule_group_node', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('rule_group_id')->comment('规则分组ID');
+			$table->unsignedInteger('node_id')->comment('节点ID');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('rule_group_node');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_rule_group_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateRuleGroupTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('rule_group', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('模式:1-阻断、0-放行');
+			$table->string('name')->comment('分组名称');
+			$table->json('rules')->nullable()->comment('关联的规则ID,多个用,号分隔');
+			$table->json('nodes')->nullable()->comment('关联的节点ID,多个用,号分隔');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('rule_group');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_rule_log_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateRuleLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('rule_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->unsignedInteger('node_id')->default(0)->comment('节点ID');
+			$table->unsignedInteger('rule_id')->default(0)->comment('规则ID,0表示白名单模式下访问访问了非规则允许的网址');
+			$table->string('reason')->nullable()->comment('触发原因');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->index(['user_id', 'node_id', 'rule_id'], 'idx');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('rule_log');
+	}
+}

+ 30 - 0
database/migrations/2020_08_21_145711_create_rule_table.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateRuleTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('rule', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('类型:1-正则表达式、2-域名、3-IP、4-协议');
+			$table->string('name', 100)->comment('规则描述');
+			$table->text('pattern')->comment('规则值');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('rule');
+	}
+}

+ 31 - 0
database/migrations/2020_08_21_145711_create_ss_config_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateSsConfigTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ss_config', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name', 50)->comment('配置名');
+			$table->boolean('type')->default(1)->comment('类型:1-加密方式、2-协议、3-混淆');
+			$table->boolean('is_default')->default(0)->comment('是否默认:0-不是、1-是');
+			$table->unsignedTinyInteger('sort')->default(0)->comment('排序:值越大排越前');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ss_config');
+	}
+}

+ 31 - 0
database/migrations/2020_08_21_145711_create_ss_node_info_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateSsNodeInfoTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ss_node_info', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->index()->comment('节点ID');
+			$table->unsignedInteger('uptime')->comment('后端存活时长,单位秒');
+			$table->string('load')->comment('负载');
+			$table->unsignedInteger('log_time')->comment('记录时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ss_node_info');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_ss_node_ip_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateSsNodeIpTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ss_node_ip', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->default(0)->index()->comment('节点ID');
+			$table->unsignedInteger('user_id')->default(0)->index()->comment('用户ID');
+			$table->unsignedSmallInteger('port')->default(0)->index()->comment('端口');
+			$table->char('type', 3)->default('tcp')->comment('类型:all、tcp、udp');
+			$table->text('ip')->nullable()->comment('连接IP:每个IP用,号隔开');
+			$table->unsignedInteger('created_at')->default(0)->comment('上报时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ss_node_ip');
+	}
+}

+ 30 - 0
database/migrations/2020_08_21_145711_create_ss_node_online_log_table.php

@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateSsNodeOnlineLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ss_node_online_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('node_id')->index()->comment('节点ID');
+			$table->unsignedInteger('online_user')->comment('在线用户数');
+			$table->unsignedInteger('log_time')->comment('记录时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ss_node_online_log');
+	}
+}

+ 17 - 21
database/migrations/2020_07_18_032504_create_node_table.php → database/migrations/2020_08_21_145711_create_ss_node_table.php

@@ -4,38 +4,39 @@ use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
 
-class CreateNodeTable extends Migration {
+class CreateSsNodeTable extends Migration {
 	/**
 	 * Run the migrations.
 	 *
 	 * @return void
 	 */
 	public function up() {
-		Schema::create('node', function(Blueprint $table) {
-			$table->bigIncrements('id');
-			$table->unsignedTinyInteger('type')->default(1)->comment('服务类型:1-Shadowsocks(R)、2-V2ray、3-Trojan、4-VNet');
+		Schema::create('ss_node', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('服务类型:1-Shadowsocks(R)、2-V2ray、3-Trojan、4-VNet');
 			$table->string('name', 128)->comment('名称');
 			$table->char('country_code', 5)->default('un')->comment('国家代码');
 			$table->string('server')->nullable()->comment('服务器域名地址');
-			$table->char('ip', 15)->nullable()->comment('服务器IPV4地址');
+			$table->ipAddress('ip')->nullable()->comment('服务器IPV4地址');
 			$table->ipAddress('ipv6')->nullable()->comment('服务器IPV6地址');
-			$table->string('relay_server')->nullable()->comment('中转地址');
-			$table->unsignedSmallInteger('relay_port')->nullable()->default(0)->comment('中转端口');
 			$table->unsignedTinyInteger('level')->default(0)->comment('等级:0-无等级,全部可见');
 			$table->unsignedBigInteger('speed_limit')->default(0)->comment('节点限速,为0表示不限速,单位Byte');
 			$table->unsignedSmallInteger('client_limit')->default(0)->comment('设备数限制');
+			$table->string('relay_server')->nullable()->comment('中转地址');
+			$table->unsignedSmallInteger('relay_port')->nullable()->comment('中转端口');
 			$table->string('description')->nullable()->comment('节点简单描述');
+			$table->string('geo')->nullable()->comment('节点地理位置');
 			$table->string('method', 32)->default('aes-256-cfb')->comment('加密方式');
 			$table->string('protocol', 64)->default('origin')->comment('协议');
 			$table->string('protocol_param', 128)->nullable()->comment('协议参数');
 			$table->string('obfs', 64)->default('plain')->comment('混淆');
 			$table->string('obfs_param')->nullable()->comment('混淆参数');
-			$table->unsignedDecimal('traffic_rate', 6)->default(1.00)->comment('流量比率');
-			$table->boolean('is_subscribe')->default(1)->comment('是否允许用户订阅该节点:0-否、1-是');
+			$table->float('traffic_rate', 6)->unsigned()->default(1.00)->comment('流量比率');
+			$table->boolean('is_subscribe')->default(1)->index()->comment('是否允许用户订阅该节点:0-否、1-是');
 			$table->boolean('is_ddns')->default(0)->comment('是否使用DDNS:0-否、1-是');
 			$table->boolean('is_relay')->default(0)->comment('是否中转节点:0-否、1-是');
 			$table->boolean('is_udp')->default(1)->comment('是否启用UDP:0-不启用、1-启用');
-			$table->unsignedSmallInteger('push_port')->default(0)->comment('消息推送端口');
+			$table->unsignedSmallInteger('push_port')->default(1000)->comment('消息推送端口');
 			$table->boolean('detection_type')->default(1)->comment('节点检测: 0-关闭、1-只检测TCP、2-只检测ICMP、3-检测全部');
 			$table->boolean('compatible')->default(0)->comment('兼容SS');
 			$table->boolean('single')->default(0)->comment('启用单端口功能:0-否、1-是');
@@ -48,18 +49,13 @@ class CreateNodeTable extends Migration {
 			$table->string('v2_method', 32)->default('aes-128-gcm')->comment('V2Ray加密方式');
 			$table->string('v2_net', 16)->default('tcp')->comment('V2Ray传输协议');
 			$table->string('v2_type', 32)->default('none')->comment('V2Ray伪装类型');
-			$table->string('v2_host')->comment('V2Ray伪装的域名');
-			$table->string('v2_path')->comment('V2Ray的WS/H2路径');
-			$table->boolean('v2_tls')->default(0)->comment('V2Ray后端TLS:0-未开启、1-开启');
+			$table->string('v2_host')->nullable()->comment('V2Ray伪装的域名');
+			$table->string('v2_path')->nullable()->comment('V2Ray的WS/H2路径');
+			$table->boolean('v2_tls')->default(0)->comment('V2Ray连接TLS:0-未开启、1-开启');
 			$table->text('tls_provider')->nullable()->comment('V2Ray节点的TLS提供商授权信息');
-			$table->timestamps();
-			$table->index('is_subscribe', 'idx_sub');
-			$table->engine = 'InnoDB';
-			$table->charset = 'utf8mb4';
-			$table->collation = 'utf8mb4_unicode_ci';
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
 		});
-
-		DB::statement("ALTER TABLE `node` comment '节点信息表'");
 	}
 
 	/**
@@ -68,6 +64,6 @@ class CreateNodeTable extends Migration {
 	 * @return void
 	 */
 	public function down() {
-		Schema::dropIfExists('node');
+		Schema::dropIfExists('ss_node');
 	}
 }

+ 33 - 0
database/migrations/2020_08_21_145711_create_ticket_reply_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTicketReplyTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ticket_reply', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('ticket_id')->comment('工单ID');
+			$table->unsignedInteger('user_id')->default(0)->comment('回复用户ID');
+			$table->unsignedInteger('admin_id')->default(0)->comment('管理员ID');
+			$table->text('content')->comment('回复内容');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ticket_reply');
+	}
+}

+ 34 - 0
database/migrations/2020_08_21_145711_create_ticket_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateTicketTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('ticket', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->unsignedInteger('admin_id')->default(0)->comment('管理员ID');
+			$table->string('title')->comment('标题');
+			$table->text('content')->comment('内容');
+			$table->boolean('status')->default(0)->comment('状态:0-待处理、1-已处理未关闭、2-已关闭');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('ticket');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_user_baned_log_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserBanedLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_baned_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->comment('用户ID');
+			$table->unsignedInteger('time')->default(0)->comment('封禁账号时长,单位分钟');
+			$table->string('description')->nullable()->comment('操作描述');
+			$table->boolean('status')->default(0)->comment('状态:0-未处理、1-已处理');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_baned_log');
+	}
+}

+ 34 - 0
database/migrations/2020_08_21_145711_create_user_credit_log_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserCreditLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_credit_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('账号ID');
+			$table->unsignedInteger('order_id')->default(0)->comment('订单ID');
+			$table->unsignedInteger('before')->default(0)->comment('发生前余额,单位分');
+			$table->unsignedInteger('after')->default(0)->comment('发生后金额,单位分');
+			$table->integer('amount')->default(0)->comment('发生金额,单位分');
+			$table->string('description')->nullable()->comment('操作描述');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_credit_log');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_user_daily_data_flow_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserDailyDataFlowTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_daily_data_flow', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->unsignedInteger('node_id')->default(0)->comment('节点ID,0表示统计全部节点');
+			$table->unsignedBigInteger('u')->default(0)->comment('上传流量');
+			$table->unsignedBigInteger('d')->default(0)->comment('下载流量');
+			$table->unsignedBigInteger('total')->default(0)->comment('总流量');
+			$table->string('traffic')->nullable()->comment('总流量(带单位)');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->index(['user_id', 'node_id'], 'idx_user_node');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_daily_data_flow');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_user_data_modify_log_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserDataModifyLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_data_modify_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->unsignedInteger('order_id')->default(0)->comment('发生的订单ID');
+			$table->bigInteger('before')->default(0)->comment('操作前流量');
+			$table->bigInteger('after')->default(0)->comment('操作后流量');
+			$table->string('description')->nullable()->comment('描述');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_data_modify_log');
+	}
+}

+ 29 - 0
database/migrations/2020_08_21_145711_create_user_group_table.php

@@ -0,0 +1,29 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserGroupTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_group', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('name')->comment('分组名称');
+			$table->json('nodes')->nullable()->comment('关联的节点ID,多个用,号分隔');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_group');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_user_hourly_data_flow_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserHourlyDataFlowTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_hourly_data_flow', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->comment('用户ID');
+			$table->unsignedInteger('node_id')->default(0)->comment('节点ID,0表示统计全部节点');
+			$table->unsignedBigInteger('u')->default(0)->comment('上传流量');
+			$table->unsignedBigInteger('d')->default(0)->comment('下载流量');
+			$table->unsignedBigInteger('total')->default(0)->comment('总流量');
+			$table->string('traffic')->nullable()->comment('总流量(带单位)');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->index(['user_id', 'node_id'], 'idx_user_node');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_hourly_data_flow');
+	}
+}

+ 36 - 0
database/migrations/2020_08_21_145711_create_user_login_log_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserLoginLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_login_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->ipAddress('ip')->comment('IP地址');
+			$table->string('country', 128)->comment('国家');
+			$table->string('province', 128)->comment('省份');
+			$table->string('city', 128)->comment('城市');
+			$table->string('county', 128)->comment('郡县');
+			$table->string('isp', 128)->comment('运营商');
+			$table->string('area')->comment('地区');
+			$table->dateTime('created_at')->comment('创建时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_login_log');
+	}
+}

+ 31 - 0
database/migrations/2020_08_21_145711_create_user_subscribe_log_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserSubscribeLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_subscribe_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_subscribe_id')->index()->comment('对应user_subscribe的id');
+			$table->ipAddress('request_ip')->nullable()->comment('请求IP');
+			$table->dateTime('request_time')->comment('请求时间');
+			$table->text('request_header')->nullable()->comment('请求头部信息');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_subscribe_log');
+	}
+}

+ 36 - 0
database/migrations/2020_08_21_145711_create_user_subscribe_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserSubscribeTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_subscribe', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->char('code', 8)->index()->comment('订阅地址唯一识别码');
+			$table->unsignedInteger('times')->default(0)->comment('地址请求次数');
+			$table->boolean('status')->default(1)->comment('状态:0-禁用、1-启用');
+			$table->unsignedInteger('ban_time')->nullable()->comment('封禁时间');
+			$table->string('ban_desc', 50)->nullable()->comment('封禁理由');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->index(['user_id', 'status'], 'user_id');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_subscribe');
+	}
+}

+ 63 - 0
database/migrations/2020_08_21_145711_create_user_table.php

@@ -0,0 +1,63 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('username', 64)->comment('昵称');
+			$table->string('email', 128)->unique()->comment('邮箱');
+			$table->string('password', 64)->comment('密码');
+			$table->unsignedSmallInteger('port')->default(0)->comment('代理端口');
+			$table->string('passwd', 16)->comment('代理密码');
+			$table->uuid('vmess_id');
+			$table->unsignedBigInteger('transfer_enable')->default(1099511627776)->comment('可用流量,单位字节,默认1TiB');
+			$table->unsignedBigInteger('u')->default(0)->comment('已上传流量,单位字节');
+			$table->unsignedBigInteger('d')->default(0)->comment('已下载流量,单位字节');
+			$table->unsignedInteger('t')->nullable()->comment('最后使用时间');
+			$table->ipAddress('ip')->nullable()->comment('最后连接IP');
+			$table->boolean('enable')->default(1)->comment('代理状态');
+			$table->string('method', 30)->default('aes-256-cfb')->comment('加密方式');
+			$table->string('protocol', 30)->default('origin')->comment('协议');
+			$table->string('protocol_param')->nullable()->comment('协议参数');
+			$table->string('obfs', 30)->default('plain')->comment('混淆');
+			$table->unsignedBigInteger('speed_limit')->default(0)->comment('用户限速,为0表示不限速,单位Byte');
+			$table->string('wechat', 30)->nullable()->comment('微信');
+			$table->string('qq', 20)->nullable()->comment('QQ');
+			$table->unsignedInteger('credit')->default(0)->comment('余额,单位分');
+			$table->date('expired_at')->default('2099-01-01')->comment('过期时间');
+			$table->unsignedInteger('ban_time')->nullable()->comment('封禁到期时间');
+			$table->text('remark')->nullable()->comment('备注');
+			$table->unsignedTinyInteger('level')->default(0)->comment('等级,默认0级');
+			$table->unsignedInteger('group_id')->default(0)->comment('所属分组');
+			$table->boolean('is_admin')->default(0)->comment('是否管理员:0-否、1-是');
+			$table->ipAddress('reg_ip')->default('127.0.0.1')->comment('注册IP');
+			$table->unsignedInteger('last_login')->default(0)->comment('最后登录时间');
+			$table->unsignedInteger('inviter_id')->nullable()->comment('邀请人');
+			$table->date('reset_time')->nullable()->comment('流量重置日期');
+			$table->unsignedInteger('invite_num')->default(0)->comment('可生成邀请码数');
+			$table->boolean('status')->default(0)->comment('状态:-1-禁用、0-未激活、1-正常');
+			$table->string('remember_token')->nullable();
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+			$table->index(['enable', 'status', 'port'], 'idx_search');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user');
+	}
+}

+ 35 - 0
database/migrations/2020_08_21_145711_create_user_traffic_log_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserTrafficLogTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('user_traffic_log', function(Blueprint $table) {
+			$table->increments('id');
+			$table->unsignedInteger('user_id')->default(0)->comment('用户ID');
+			$table->unsignedInteger('node_id')->default(0)->comment('节点ID');
+			$table->unsignedInteger('u')->default(0)->comment('上传流量');
+			$table->unsignedInteger('d')->default(0)->comment('下载流量');
+			$table->float('rate', 6)->unsigned()->comment('倍率');
+			$table->string('traffic', 32)->comment('产生流量');
+			$table->unsignedInteger('log_time')->comment('记录时间');
+			$table->index(['user_id', 'node_id', 'log_time'], 'idx_user_node_time');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('user_traffic_log');
+	}
+}

+ 32 - 0
database/migrations/2020_08_21_145711_create_verify_code_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateVerifyCodeTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('verify_code', function(Blueprint $table) {
+			$table->increments('id');
+			$table->string('address', 128)->comment('用户邮箱');
+			$table->char('code', 6)->comment('验证码');
+			$table->boolean('status')->default(0)->comment('状态:0-未使用、1-已使用、2-已失效');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('verify_code');
+	}
+}

+ 33 - 0
database/migrations/2020_08_21_145711_create_verify_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateVerifyTable extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		Schema::create('verify', function(Blueprint $table) {
+			$table->increments('id');
+			$table->boolean('type')->default(1)->comment('激活类型:1-自行激活、2-管理员激活');
+			$table->unsignedInteger('user_id')->comment('用户ID');
+			$table->string('token', 32)->comment('校验token');
+			$table->boolean('status')->default(0)->comment('状态:0-未使用、1-已使用、2-已失效');
+			$table->dateTime('created_at')->comment('创建时间');
+			$table->dateTime('updated_at')->comment('最后更新时间');
+		});
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		Schema::dropIfExists('verify');
+	}
+}

+ 528 - 0
database/migrations/2020_08_21_150711_preset_data.php

@@ -0,0 +1,528 @@
+<?php
+
+use App\Models\Config;
+use App\Models\Country;
+use App\Models\EmailFilter;
+use App\Models\Label;
+use App\Models\Level;
+use App\Models\Rule;
+use App\Models\SsConfig;
+use App\Models\User;
+use Illuminate\Database\Migrations\Migration;
+
+class PresetData extends Migration {
+	/**
+	 * Run the migrations.
+	 *
+	 * @return void
+	 */
+	public function up() {
+		// 生成初始管理账号
+		User::create([
+			'username' => '管理员',
+			'email'    => 'test@test.com',
+			'password' => Hash::make('123456'),
+			'port'     => 10000,
+			'passwd'   => Str::random(),
+			'vmess_id' => Str::uuid(),
+			'is_admin' => 1
+		]);
+
+		// 生成最初的等级
+		Level::insert(['level' => 0, 'name' => 'Free']);
+		for($i = 1; $i < 8; $i++){
+			Level::insert(['level' => $i, 'name' => 'VIP-'.$i]);
+		}
+
+		// ss系列 加密方式
+		SsConfig::insert(['name' => 'none', 'type' => 1, 'is_default' => 1]);
+		SsConfig::insert(['name' => 'rc4-md5']);
+		SsConfig::insert(['name' => 'aes-128-cfb']);
+		SsConfig::insert(['name' => 'aes-192-cfb']);
+		SsConfig::insert(['name' => 'aes-256-cfb']);
+		SsConfig::insert(['name' => 'aes-128-ctr']);
+		SsConfig::insert(['name' => 'aes-192-ctr']);
+		SsConfig::insert(['name' => 'aes-256-ctr']);
+		SsConfig::insert(['name' => 'aes-128-gcm']);
+		SsConfig::insert(['name' => 'aes-192-gcm']);
+		SsConfig::insert(['name' => 'aes-256-gcm']);
+		SsConfig::insert(['name' => 'bf-cfb']);
+		SsConfig::insert(['name' => 'cast5-cfb']);
+		SsConfig::insert(['name' => 'des-cfb']);
+		SsConfig::insert(['name' => 'salsa20']);
+		SsConfig::insert(['name' => 'chacha20']);
+		SsConfig::insert(['name' => 'chacha20-ietf']);
+		SsConfig::insert(['name' => 'chacha20-ietf-poly1305']);
+
+		// ss系列 协议
+		SsConfig::insert(['name' => 'origin', 'type' => 2, 'is_default' => 1]);
+		SsConfig::insert(['name' => 'auth_sha1_v4', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_aes128_md5', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_aes128_sha1', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_a', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_b', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_c', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_d', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_e', 'type' => 2]);
+		SsConfig::insert(['name' => 'auth_chain_f', 'type' => 2]);
+
+		// ss系列 混淆
+		SsConfig::insert(['name' => 'plain', 'type' => 3, 'is_default' => 1]);
+		SsConfig::insert(['name' => 'http_simple', 'type' => 3]);
+		SsConfig::insert(['name' => 'http_post', 'type' => 3]);
+		SsConfig::insert(['name' => 'tls1.2_ticket_auth', 'type' => 3]);
+		SsConfig::insert(['name' => 'tls1.2_ticket_fastauth', 'type' => 3]);
+
+		$configList = [
+			'is_rand_port',
+			'is_user_rand_port',
+			'invite_num',
+			'is_register',
+			'is_invite_register',
+			'website_name',
+			'is_reset_password',
+			'reset_password_times',
+			'website_url',
+			'referral_type',
+			'active_times',
+			'is_checkin',
+			'min_rand_traffic',
+			'max_rand_traffic',
+			'wechat_qrcode',
+			'alipay_qrcode',
+			'traffic_limit_time',
+			'referral_traffic',
+			'referral_percent',
+			'referral_money',
+			'referral_status',
+			'default_traffic',
+			'traffic_warning',
+			'traffic_warning_percent',
+			'expire_warning',
+			'expire_days',
+			'reset_traffic',
+			'default_days',
+			'subscribe_max',
+			'min_port',
+			'max_port',
+			'is_captcha',
+			'is_traffic_ban',
+			'traffic_ban_value',
+			'traffic_ban_time',
+			'is_clear_log',
+			'is_node_offline',
+			'webmaster_email',
+			'is_notification',
+			'server_chan_key',
+			'is_subscribe_ban',
+			'subscribe_ban_times',
+			'codepay_url',
+			'codepay_id',
+			'codepay_key',
+			'is_free_code',
+			'is_forbid_robot',
+			'subscribe_domain',
+			'auto_release_port',
+			'website_callback_url',
+			'web_api_url',
+			'v2ray_license',
+			'trojan_license',
+			'v2ray_tls_provider',
+			'website_analytics',
+			'website_customer_service',
+			'register_ip_limit',
+			'is_email_filtering',
+			'is_push_bear',
+			'push_bear_send_key',
+			'push_bear_qrcode',
+			'is_ban_status',
+			'is_namesilo',
+			'namesilo_key',
+			'website_logo',
+			'website_home_logo',
+			'nodes_detection',
+			'detection_check_times',
+			'is_forbid_china',
+			'is_forbid_oversea',
+			'AppStore_id',
+			'AppStore_password',
+			'is_activate_account',
+			'node_daily_report',
+			'mix_subscribe',
+			'rand_subscribe',
+			'is_custom_subscribe',
+			'is_AliPay',
+			'is_QQPay',
+			'is_WeChatPay',
+			'is_otherPay',
+			'alipay_private_key',
+			'alipay_public_key',
+			'alipay_transport',
+			'alipay_currency',
+			'bitpay_secret',
+			'f2fpay_app_id',
+			'f2fpay_private_key',
+			'f2fpay_public_key',
+			'website_security_code',
+			'subject_name',
+			'geetest_id',
+			'geetest_key',
+			'google_captcha_sitekey',
+			'google_captcha_secret',
+			'user_invite_days',
+			'admin_invite_days',
+			'offline_check_times',
+			'payjs_mch_id',
+			'payjs_key',
+			'maintenance_mode',
+			'maintenance_time',
+			'maintenance_content',
+			'bark_key',
+			'hcaptcha_secret',
+			'hcaptcha_sitekey',
+			'paypal_username',
+			'paypal_password',
+			'paypal_secret',
+			'paypal_certificate',
+			'paypal_app_id',
+			'redirect_url',
+			'epay_url',
+			'epay_mch_id',
+			'epay_key'
+		];
+
+		foreach($configList as $config){
+			Config::insert(['name' => $config]);
+		}
+
+		Config::whereName('invite_num')->update(['value' => 3]);
+		Config::whereName('is_register')->update(['value' => 1]);
+		Config::whereName('is_invite_register')->update(['value' => 2]);
+		Config::whereName('website_name')->update(['value' => 'ProxyPanel']);
+		Config::whereName('is_reset_password')->update(['value' => 1]);
+		Config::whereName('reset_password_times')->update(['value' => 3]);
+		Config::whereName('website_url')->update(['value' => 'https://demo.proxypanel.ml']);
+		Config::whereName('active_times')->update(['value' => 3]);
+		Config::whereName('is_checkin')->update(['value' => 1]);
+		Config::whereName('min_rand_traffic')->update(['value' => 10]);
+		Config::whereName('max_rand_traffic')->update(['value' => 500]);
+		Config::whereName('traffic_limit_time')->update(['value' => 1440]);
+		Config::whereName('referral_traffic')->update(['value' => 1024]);
+		Config::whereName('referral_percent')->update(['value' => 0.2]);
+		Config::whereName('referral_money')->update(['value' => 100]);
+		Config::whereName('referral_status')->update(['value' => 1]);
+		Config::whereName('default_traffic')->update(['value' => 1024]);
+		Config::whereName('traffic_warning_percent')->update(['value' => 80]);
+		Config::whereName('expire_days')->update(['value' => 15]);
+		Config::whereName('reset_traffic')->update(['value' => 1]);
+		Config::whereName('default_days')->update(['value' => 7]);
+		Config::whereName('subscribe_max')->update(['value' => 3]);
+		Config::whereName('min_port')->update(['value' => 10000]);
+		Config::whereName('max_port')->update(['value' => 65535]);
+		Config::whereName('is_traffic_ban')->update(['value' => 1]);
+		Config::whereName('traffic_ban_value')->update(['value' => 10]);
+		Config::whereName('traffic_ban_time')->update(['value' => 60]);
+		Config::whereName('is_clear_log')->update(['value' => 1]);
+		Config::whereName('is_subscribe_ban')->update(['value' => 1]);
+		Config::whereName('subscribe_ban_times')->update(['value' => 20]);
+		Config::whereName('auto_release_port')->update(['value' => 1]);
+		Config::whereName('register_ip_limit')->update(['value' => 5]);
+		Config::whereName('detection_check_times')->update(['value' => 3]);
+		Config::whereName('alipay_transport')->update(['value' => 'http']);
+		Config::whereName('alipay_currency')->update(['value' => 'USD']);
+		Config::whereName('user_invite_days')->update(['value' => 7]);
+		Config::whereName('admin_invite_days')->update(['value' => 7]);
+
+		// 节点用标签
+		$labelList = [
+			'Netflix',
+			'Hulu',
+			'HBO',
+			'Amazon Video',
+			'DisneyNow',
+			'BBC',
+			'Channel 4',
+			'Fox+',
+			'Happyon',
+			'AbemeTV',
+			'DMM',
+			'NicoNico',
+			'Pixiv',
+			'TVer',
+			'TVB',
+			'HBO Go',
+			'BiliBili港澳台',
+			'動畫瘋',
+			'四季線上影視',
+			'LINE TV',
+			'Youtube Premium',
+			'中国视频网站',
+			'网易云音乐',
+			'QQ音乐',
+			'DisneyPlus',
+			'Pandora',
+			'SoundCloud',
+			'Spotify',
+			'TIDAL',
+			'TikTok',
+			'Pornhub',
+			'Twitch'
+		];
+
+		foreach($labelList as $label){
+			Label::insert(['name' => $label]);
+		}
+
+		// 黑名单邮箱 过滤列表
+		$blackEmailSuffixList = [
+			'chacuo.com',
+			'1766258.com',
+			'3202.com',
+			'4057.com',
+			'4059.com',
+			'a7996.com',
+			'bccto.me',
+			'bnuis.com',
+			'chaichuang.com',
+			'cr219.com',
+			'cuirushi.org',
+			'dawin.com',
+			'jiaxin8736.com',
+			'lakqs.com',
+			'urltc.com',
+			'027168.com',
+			'10minutemail.net',
+			'11163.com',
+			'1shivom.com',
+			'auoie.com',
+			'bareed.ws',
+			'bit-degree.com',
+			'cjpeg.com',
+			'cool.fr.nf',
+			'courriel.fr.nf',
+			'disbox.net',
+			'disbox.org',
+			'fidelium10.com',
+			'get365.pw',
+			'ggr.la',
+			'grr.la',
+			'guerrillamail.biz',
+			'guerrillamail.com',
+			'guerrillamail.de',
+			'guerrillamail.net',
+			'guerrillamail.org',
+			'guerrillamailblock.com',
+			'hubii-network.com',
+			'hurify1.com',
+			'itoup.com',
+			'jetable.fr.nf',
+			'jnpayy.com',
+			'juyouxi.com',
+			'mail.bccto.me',
+			'www.bccto.me',
+			'mega.zik.dj',
+			'moakt.co',
+			'moakt.ws',
+			'molms.com',
+			'moncourrier.fr.nf',
+			'monemail.fr.nf',
+			'monmail.fr.nf',
+			'nomail.xl.cx',
+			'nospam.ze.tc',
+			'pay-mon.com',
+			'poly-swarm.com',
+			'sgmh.online',
+			'sharklasers.com',
+			'shiftrpg.com',
+			'spam4.me',
+			'speed.1s.fr',
+			'tmail.ws',
+			'tmails.net',
+			'tmpmail.net',
+			'tmpmail.org',
+			'travala10.com',
+			'yopmail.com',
+			'yopmail.fr',
+			'yopmail.net',
+			'yuoia.com',
+			'zep-hyr.com',
+			'zippiex.com',
+			'lrc8.com',
+			'1otc.com',
+			'emailna.co',
+			'mailinator.com',
+			'nbzmr.com',
+			'awsoo.com',
+			'zhcne.com',
+			'0box.eu',
+			'contbay.com',
+			'damnthespam.com',
+			'kurzepost.de',
+			'objectmail.com',
+			'proxymail.eu',
+			'rcpt.at',
+			'trash-mail.at',
+			'trashmail.at',
+			'trashmail.com',
+			'trashmail.io',
+			'trashmail.me',
+			'trashmail.net',
+			'wegwerfmail.de',
+			'wegwerfmail.net',
+			'wegwerfmail.org',
+			'nwytg.net',
+			'despam.it',
+			'spambox.us',
+			'spam.la',
+			'mytrashmail.com',
+			'mt2014.com',
+			'mt2015.com',
+			'thankyou2010.com',
+			'trash2009.com',
+			'mt2009.com',
+			'trashymail.com',
+			'tempemail.net',
+			'slopsbox.com',
+			'mailnesia.com',
+			'ezehe.com',
+			'tempail.com',
+			'newairmail.com',
+			'temp-mail.org',
+			'linshiyouxiang.net',
+			'zwoho.com',
+			'mailboxy.fun',
+			'crypto-net.club',
+			'guerrillamail.info',
+			'pokemail.net',
+			'odmail.cn',
+			'hlooy.com',
+			'ozlaq.com',
+			'666email.com',
+			'linshiyou.com',
+			'linshiyou.pl',
+			'woyao.pl',
+			'yaowo.pl'
+		];
+
+		foreach($blackEmailSuffixList as $emailSuffix){
+			EmailFilter::insert(['type' => 1, 'words' => $emailSuffix]);
+		}
+
+		// 白名单邮箱 过滤列表
+		$whiteEmailSuffixList = [
+			'qq.com',
+			'163.com',
+			'126.com',
+			'189.com',
+			'sohu.com',
+			'gmail.com',
+			'outlook.com',
+			'icloud.com'
+		];
+
+		foreach($whiteEmailSuffixList as $emailSuffix){
+			EmailFilter::insert(['type' => 2, 'words' => $emailSuffix]);
+		}
+
+		$countryList = [
+			'au' => '澳大利亚',
+			'br' => '巴西',
+			'ca' => '加拿大',
+			'ch' => '瑞士',
+			'cn' => '中国',
+			'de' => '德国',
+			'dk' => '丹麦',
+			'eg' => '埃及',
+			'fr' => '法国',
+			'gr' => '希腊',
+			'hk' => '香港',
+			'id' => '印度尼西亚',
+			'ie' => '爱尔兰',
+			'il' => '以色列',
+			'in' => '印度',
+			'iq' => '伊拉克',
+			'ir' => '伊朗',
+			'it' => '意大利',
+			'jp' => '日本',
+			'kr' => '韩国',
+			'mx' => '墨西哥',
+			'my' => '马来西亚',
+			'nl' => '荷兰',
+			'no' => '挪威',
+			'nz' => '纽西兰',
+			'ph' => '菲律宾',
+			'ru' => '俄罗斯',
+			'se' => '瑞典',
+			'sg' => '新加坡',
+			'th' => '泰国',
+			'tr' => '土耳其',
+			'tw' => '台湾',
+			'uk' => '英国',
+			'us' => '美国',
+			'vn' => '越南',
+			'pl' => '波兰',
+			'kz' => '哈萨克斯坦',
+			'ua' => '乌克兰',
+			'ro' => '罗马尼亚',
+			'ae' => '阿联酋',
+			'za' => '南非',
+			'mm' => '缅甸',
+			'is' => '冰岛',
+			'fi' => '芬兰',
+			'lu' => '卢森堡',
+			'be' => '比利时',
+			'bg' => '保加利亚',
+			'lt' => '立陶宛',
+			'co' => '哥伦比亚',
+			'mo' => '澳门',
+			'ke' => '肯尼亚',
+			'cz' => '捷克',
+			'md' => '摩尔多瓦',
+			'es' => '西班牙',
+			'pk' => '巴基斯坦',
+			'pt' => '葡萄牙',
+			'hu' => '匈牙利',
+			'ar' => '阿根廷'
+		];
+
+		foreach($countryList as $code => $name){
+			Country::insert(['code' => $code, 'name' => $name]);
+		}
+
+		// 审核规则
+		$ruleList = [
+			'360'     => '(.*.||)(^360|0360|1360|3600|360safe|^so|qhimg|qhmsg|^yunpan|qihoo|qhcdn|qhupdate|360totalsecurity|360shouji|qihucdn|360kan|secmp).(cn|com|net)',
+			'腾讯管家'    => '(.guanjia.qq.com|qqpcmgr|QQPCMGR)',
+			'金山毒霸'    => '(.*.||)(rising|kingsoft|duba|xindubawukong|jinshanduba).(com|net|org)',
+			'暗网相关'    => '(.*.||)(netvigator|torproject).(cn|com|net|org)',
+			'百度定位'    => '(api|ps|sv|offnavi|newvector|ulog.imap|newloc|tracknavi)(.map|).(baidu|n.shifen).com',
+			'法轮功类'    => '(.*.||)(dafahao|minghui|dongtaiwang|dajiyuan|falundata|shenyun|tuidang|epochweekly|epochtimes|ntdtv|falundafa|wujieliulan|zhengjian).(org|com|net)',
+			'BT扩展名'   => '(torrent|.torrent|peer_id=|info_hash|get_peers|find_node|BitTorrent|announce_peer|announce.php?passkey=)',
+			'邮件滥发'    => '((^.*@)(guerrillamail|guerrillamailblock|sharklasers|grr|pokemail|spam4|bccto|chacuo|027168).(info|biz|com|de|net|org|me|la)|Subject|HELO|SMTP)',
+			'迅雷下载'    => '(.?)(xunlei|sandai|Thunder|XLLiveUD)(.)',
+			'大陆应用'    => '(.*.||)(baidu|qq|163|189|10000|10010|10086|sohu|sogoucdn|sogou|uc|58|taobao|qpic|bilibili|hdslb|acgvideo|sina|douban|doubanio|xiaohongshu|sinaimg|weibo|xiaomi|youzanyun|meituan|dianping|biliapi|huawei|pinduoduo|cnzz).(org|com|net|cn)',
+			'大陆银行'    => '(.*.||)(icbc|ccb|boc|bankcomm|abchina|cmbchina|psbc|cebbank|cmbc|pingan|spdb|citicbank|cib|hxb|bankofbeijing|hsbank|tccb|4001961200|bosc|hkbchina|njcb|nbcb|lj-bank|bjrcb|jsbchina|gzcb|cqcbank|czbank|hzbank|srcb|cbhb|cqrcb|grcbank|qdccb|bocd|hrbcb|jlbank|bankofdl|qlbchina|dongguanbank|cscb|hebbank|drcbank|zzbank|bsb|xmccb|hljrcc|jxnxs|gsrcu|fjnx|sxnxs|gx966888|gx966888|zj96596|hnnxs|ahrcu|shanxinj|hainanbank|scrcu|gdrcu|hbxh|ynrcc|lnrcc|nmgnxs|hebnx|jlnls|js96008|hnnx|sdnxs).(org|com|net|cn)',
+			'台湾银行'    => '(.*.||)(firstbank|bot|cotabank|megabank|tcb-bank|landbank|hncb|bankchb|tbb|ktb|tcbbank|scsb|bop|sunnybank|kgibank|fubon|ctbcbank|cathaybk|eximbank|bok|ubot|feib|yuantabank|sinopac|esunbank|taishinbank|jihsunbank|entiebank|hwataibank|csc|skbank).(org|com|net|tw)',
+			'大陆第三方支付' => '(.*.||)(alipay|baifubao|yeepay|99bill|95516|51credit|cmpay|tenpay|lakala|jdpay).(org|com|net|cn)',
+			'台湾特供'    => '(.*.||)(visa|mycard|mastercard|gov|gash|beanfun|bank|line).(org|com|net|cn|tw|jp|kr)',
+			'涉政治类'    => '(.*.||)(shenzhoufilm|secretchina|renminbao|aboluowang|mhradio|guangming|zhengwunet|soundofhope|yuanming|zhuichaguoji|fgmtv|xinsheng|shenyunperformingarts|epochweekly|tuidang|shenyun|falundata|bannedbook|pincong|rfi|mingjingnews|boxun|rfa|scmp|ogate|voachinese).(org|com|net|rocks|fr)',
+			'流媒体'     => '(.*.||)(youtube|googlevideo|hulu|netflix|nflxvideo|akamai|nflximg|hbo|mtv|bbc|tvb).(org|club|com|net|tv)',
+			'测速类'     => '(.*.||)(fast|speedtest).(org|com|net|cn)',
+			'外汇交易类'   => '(.*.||)(metatrader4|metatrader5|mql5).(org|com|net)'
+		];
+
+		foreach($ruleList as $name => $pattern){
+			Rule::insert(['type' => 1, 'name' => $name, 'pattern' => $pattern]);
+		}
+	}
+
+	/**
+	 * Reverse the migrations.
+	 *
+	 * @return void
+	 */
+	public function down() {
+		echo 'plz run php artisan migrate:fresh'.PHP_EOL;
+		echo '请运行 php artisan migrate:fresh'.PHP_EOL;
+	}
+}

+ 1 - 1
resources/views/admin/subscribe/subscribeList.blade.php

@@ -61,7 +61,7 @@
 										target="_blank">{{$subscribe->times}}</a>
 							</td>
 							<td> {{$subscribe->updated_at}} </td>
-							<td> {{$subscribe->ban_time > 0 ? date('Y-m-d H:i', $subscribe->ban_time): ''}} </td>
+							<td> {{$subscribe->ban_time ? date('Y-m-d H:i', $subscribe->ban_time): ''}} </td>
 							<td> {{$subscribe->ban_desc}} </td>
 							<td>
 								@if($subscribe->status == 0)

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 674 - 670
sql/db.sql


+ 92 - 0
sql/mod/20200823.sql

@@ -0,0 +1,92 @@
+ALTER TABLE `coupon`
+    CHANGE `logo` `logo` VARCHAR(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '优惠券LOGO';
+
+ALTER TABLE `coupon_log`
+    CHANGE `description` `description` VARCHAR(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注';
+
+ALTER TABLE `goods`
+    CHANGE `renew` `renew`           INT(10) UNSIGNED DEFAULT NULL COMMENT '流量重置价格,单位分',
+    CHANGE `period` `period`         INT(10) UNSIGNED DEFAULT NULL COMMENT '流量自动重置周期',
+    CHANGE `invite_num` `invite_num` INT(10) UNSIGNED DEFAULT NULL COMMENT '赠送邀请码数',
+    CHANGE `limit_num` `limit_num`   INT(10) UNSIGNED DEFAULT NULL COMMENT '限购数量,默认为null不限购';
+
+ALTER TABLE `invite`
+    CHANGE `code` `code` CHAR(12) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邀请码';
+
+ALTER TABLE `order`
+    CHANGE `goods_id` `goods_id`   INT(10) UNSIGNED DEFAULT NULL COMMENT '商品ID',
+    CHANGE `coupon_id` `coupon_id` INT(10) UNSIGNED DEFAULT NULL COMMENT '优惠券ID';
+
+ALTER TABLE `rule_log`
+    CHANGE `reason` `reason` VARCHAR(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '触发原因';
+
+ALTER TABLE `ss_node`
+    CHANGE `v2_host` `v2_host` VARCHAR(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'V2Ray伪装的域名',
+    CHANGE `v2_path` `v2_path` VARCHAR(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'V2Ray的WS/H2路径';
+
+ALTER TABLE `user_credit_log`
+    CHANGE `order_id` `order_id` INT(10) UNSIGNED DEFAULT NULL COMMENT '订单ID';
+
+DROP TABLE IF EXISTS `migrations`;
+
+CREATE TABLE `migrations`
+(
+    `id`        INT(10) UNSIGNED                        NOT NULL AUTO_INCREMENT,
+    `migration` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL,
+    `batch`     INT(11)                                 NOT NULL,
+    PRIMARY KEY (`id`)
+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
+INSERT INTO `migrations` (`id`, `migration`, `batch`)
+
+VALUES (1, '2020_08_21_145711_create_article_table', 1),
+       (2, '2020_08_21_145711_create_config_table', 1),
+       (3, '2020_08_21_145711_create_country_table', 1),
+       (4, '2020_08_21_145711_create_coupon_log_table', 1),
+       (5, '2020_08_21_145711_create_coupon_table', 1),
+       (6, '2020_08_21_145711_create_email_filter_table', 1),
+       (7, '2020_08_21_145711_create_failed_jobs_table', 1),
+       (8, '2020_08_21_145711_create_goods_table', 1),
+       (9, '2020_08_21_145711_create_invite_table', 1),
+       (10, '2020_08_21_145711_create_jobs_table', 1),
+       (11, '2020_08_21_145711_create_label_table', 1),
+       (12, '2020_08_21_145711_create_level_table', 1),
+       (13, '2020_08_21_145711_create_marketing_table', 1),
+       (14, '2020_08_21_145711_create_node_auth_table', 1),
+       (15, '2020_08_21_145711_create_node_certificate_table', 1),
+       (16, '2020_08_21_145711_create_node_daily_data_flow_table', 1),
+       (17, '2020_08_21_145711_create_node_hourly_data_flow_table', 1),
+       (18, '2020_08_21_145711_create_node_label_table', 1),
+       (19, '2020_08_21_145711_create_node_ping_table', 1),
+       (20, '2020_08_21_145711_create_node_rule_table', 1),
+       (21, '2020_08_21_145711_create_notification_log_table', 1),
+       (22, '2020_08_21_145711_create_order_table', 1),
+       (23, '2020_08_21_145711_create_payment_callback_table', 1),
+       (24, '2020_08_21_145711_create_payment_table', 1),
+       (25, '2020_08_21_145711_create_products_pool_table', 1),
+       (26, '2020_08_21_145711_create_referral_apply_table', 1),
+       (27, '2020_08_21_145711_create_referral_log_table', 1),
+       (28, '2020_08_21_145711_create_rule_group_node_table', 1),
+       (29, '2020_08_21_145711_create_rule_group_table', 1),
+       (30, '2020_08_21_145711_create_rule_log_table', 1),
+       (31, '2020_08_21_145711_create_rule_table', 1),
+       (32, '2020_08_21_145711_create_ss_config_table', 1),
+       (33, '2020_08_21_145711_create_ss_node_info_table', 1),
+       (34, '2020_08_21_145711_create_ss_node_ip_table', 1),
+       (35, '2020_08_21_145711_create_ss_node_online_log_table', 1),
+       (36, '2020_08_21_145711_create_ss_node_table', 1),
+       (37, '2020_08_21_145711_create_ticket_reply_table', 1),
+       (38, '2020_08_21_145711_create_ticket_table', 1),
+       (39, '2020_08_21_145711_create_user_baned_log_table', 1),
+       (40, '2020_08_21_145711_create_user_credit_log_table', 1),
+       (41, '2020_08_21_145711_create_user_daily_data_flow_table', 1),
+       (42, '2020_08_21_145711_create_user_data_modify_log_table', 1),
+       (43, '2020_08_21_145711_create_user_group_table', 1),
+       (44, '2020_08_21_145711_create_user_hourly_data_flow_table', 1),
+       (45, '2020_08_21_145711_create_user_login_log_table', 1),
+       (46, '2020_08_21_145711_create_user_subscribe_log_table', 1),
+       (47, '2020_08_21_145711_create_user_subscribe_table', 1),
+       (48, '2020_08_21_145711_create_user_table', 1),
+       (49, '2020_08_21_145711_create_user_traffic_log_table', 1),
+       (50, '2020_08_21_145711_create_verify_code_table', 1),
+       (51, '2020_08_21_145711_create_verify_table', 1),
+       (52, '2020_08_21_150711_preset_data', 1);

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio