Эх сурвалжийг харах

2.1 版本

1. 框架更新至5.8,并且其涉及代码进行修改;
2.  对支付的alipay组件针对php7.2/3进行修改;
3. 重构了节点信息获取逻辑;现在为实时请求;
4. 代码小细节和命名规范
Bretton 5 жил өмнө
parent
commit
7fa56ada16
100 өөрчлөгдсөн 2688 нэмэгдсэн , 1578 устгасан
  1. 232 127
      _ide_helper.php
  2. 74 77
      app/Components/AlipayNotify.php
  3. 98 101
      app/Components/AlipaySubmit.php
  4. 7 9
      app/Components/Callback.php
  5. 64 64
      app/Components/Helpers.php
  6. 1 3
      app/Components/IPIP.php
  7. 32 32
      app/Components/Namesilo.php
  8. 2 0
      app/Components/ServerChan.php
  9. 5 5
      app/Console/Commands/AutoClearLog.php
  10. 19 19
      app/Console/Commands/AutoJob.php
  11. 2 2
      app/Console/Commands/AutoReportNode.php
  12. 1 1
      app/Console/Commands/AutoStatisticsNodeDailyTraffic.php
  13. 1 1
      app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php
  14. 1 1
      app/Console/Commands/AutoStatisticsUserDailyTraffic.php
  15. 1 1
      app/Console/Commands/AutoStatisticsUserHourlyTraffic.php
  16. 19 20
      app/Console/Commands/DailyJob.php
  17. 24 22
      app/Console/Commands/NodeBlockedDetection.php
  18. 2 2
      app/Console/Commands/ServiceTimer.php
  19. 2 2
      app/Console/Commands/UserExpireAutoWarning.php
  20. 2 2
      app/Console/Commands/UserTrafficAbnormalAutoWarning.php
  21. 2 2
      app/Console/Commands/UserTrafficAutoWarning.php
  22. 1 1
      app/Console/Commands/upgradeUserResetTime.php
  23. 8 8
      app/Exceptions/Handler.php
  24. 96 138
      app/Http/Controllers/AdminController.php
  25. 0 7
      app/Http/Controllers/Api/AlipayController.php
  26. 1 7
      app/Http/Controllers/Api/F2fpayController.php
  27. 1 13
      app/Http/Controllers/Api/LoginController.php
  28. 241 240
      app/Http/Controllers/AuthController.php
  29. 101 4
      app/Http/Controllers/Controller.php
  30. 13 11
      app/Http/Controllers/CouponController.php
  31. 3 2
      app/Http/Controllers/PaymentController.php
  32. 4 4
      app/Http/Controllers/SensitiveWordsController.php
  33. 21 16
      app/Http/Controllers/ShopController.php
  34. 2 56
      app/Http/Controllers/SubscribeController.php
  35. 35 92
      app/Http/Controllers/UserController.php
  36. 1 1
      app/Http/Middleware/Affiliate.php
  37. 3 3
      app/Http/Middleware/RedirectIfAuthenticated.php
  38. 1 1
      app/Http/Middleware/SetLocale.php
  39. 1 1
      app/Http/Middleware/isAdmin.php
  40. 2 2
      app/Http/Middleware/isForbidden.php
  41. 1 1
      app/Http/Middleware/isLogin.php
  42. 2 2
      app/Http/Middleware/isSecurity.php
  43. 33 0
      app/Http/Models/Article.php
  44. 11 1
      app/Http/Models/Config.php
  45. 11 1
      app/Http/Models/Country.php
  46. 41 0
      app/Http/Models/Coupon.php
  47. 19 0
      app/Http/Models/CouponLog.php
  48. 19 1
      app/Http/Models/Device.php
  49. 23 0
      app/Http/Models/EmailLog.php
  50. 58 3
      app/Http/Models/Goods.php
  51. 12 1
      app/Http/Models/GoodsLabel.php
  52. 32 1
      app/Http/Models/Invite.php
  53. 11 1
      app/Http/Models/Label.php
  54. 11 1
      app/Http/Models/Level.php
  55. 24 0
      app/Http/Models/Marketing.php
  56. 39 1
      app/Http/Models/Order.php
  57. 29 0
      app/Http/Models/OrderGoods.php
  58. 38 0
      app/Http/Models/Payment.php
  59. 36 0
      app/Http/Models/PaymentCallback.php
  60. 25 0
      app/Http/Models/ReferralApply.php
  61. 27 0
      app/Http/Models/ReferralLog.php
  62. 11 1
      app/Http/Models/SensitiveWords.php
  63. 18 1
      app/Http/Models/SsConfig.php
  64. 15 0
      app/Http/Models/SsGroup.php
  65. 11 1
      app/Http/Models/SsGroupNode.php
  66. 90 0
      app/Http/Models/SsNode.php
  67. 15 1
      app/Http/Models/SsNodeInfo.php
  68. 21 0
      app/Http/Models/SsNodeIp.php
  69. 11 1
      app/Http/Models/SsNodeLabel.php
  70. 13 1
      app/Http/Models/SsNodeOnlineLog.php
  71. 22 0
      app/Http/Models/SsNodeTrafficDaily.php
  72. 22 0
      app/Http/Models/SsNodeTrafficHourly.php
  73. 22 1
      app/Http/Models/Ticket.php
  74. 18 0
      app/Http/Models/TicketReply.php
  75. 96 0
      app/Http/Models/User.php
  76. 22 1
      app/Http/Models/UserBalanceLog.php
  77. 20 0
      app/Http/Models/UserBanLog.php
  78. 13 1
      app/Http/Models/UserLabel.php
  79. 28 0
      app/Http/Models/UserLoginLog.php
  80. 25 0
      app/Http/Models/UserSubscribe.php
  81. 18 1
      app/Http/Models/UserSubscribeLog.php
  82. 24 0
      app/Http/Models/UserTrafficDaily.php
  83. 24 0
      app/Http/Models/UserTrafficHourly.php
  84. 24 1
      app/Http/Models/UserTrafficLog.php
  85. 23 0
      app/Http/Models/UserTrafficModifyLog.php
  86. 21 0
      app/Http/Models/Verify.php
  87. 17 0
      app/Http/Models/VerifyCode.php
  88. 0 39
      app/Mail/closeOrder.php
  89. 0 39
      app/Mail/sendCustomMessage.php
  90. 0 38
      app/Mail/userTrafficAbnormalWarning.php
  91. 11 11
      app/Providers/RouteServiceProvider.php
  92. 30 21
      composer.json
  93. 360 294
      composer.lock
  94. BIN
      composer.phar
  95. 4 3
      config/app.php
  96. 1 1
      config/version.php
  97. 2 0
      public/assets/custom/jump-tab.js
  98. 4 4
      resources/lang/en/auth.php
  99. 1 0
      resources/lang/en/error.php
  100. 3 3
      resources/lang/ja/auth.php

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 232 - 127
_ide_helper.php


+ 74 - 77
app/Components/AlipayNotify.php

@@ -43,9 +43,7 @@ class AlipayNotify
 			return FALSE;
 		}else{
 			// 生成签名结果
-			$isSign = $this->getSignVeryfy($_POST, $_POST["sign"]);
-
-			$converted_res = ($isSign)? 'true' : 'false';
+			$isSign = $this->getSignVerify($_POST, $_POST["sign"]);
 
 			// 获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
 			$responseTxt = 'false';
@@ -54,7 +52,7 @@ class AlipayNotify
 			}
 
 			// 验证
-			// $responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
+			// $responseTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
 			// isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
 			if(preg_match("/true$/i", $responseTxt) && $isSign){
 				return TRUE;
@@ -72,7 +70,7 @@ class AlipayNotify
 	 *
 	 * @return bool 签名验证结果
 	 */
-	function getSignVeryfy($para_temp, $sign)
+	function getSignVerify($para_temp, $sign)
 	{
 		// 除去待签名参数数组中的空值和签名参数
 		$para_filter = $this->paraFilter($para_temp);
@@ -81,43 +79,78 @@ class AlipayNotify
 		$para_sort = $this->argSort($para_filter);
 
 		// 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
-		$prestr = $this->createLinkString($para_sort);
+		$preStr = $this->createLinkString($para_sort);
 
 		switch(strtoupper(trim($this->sign_type))){
 			case "RSA" :
-				$isSgin = $this->rsaVerify($prestr, trim($this->alipay_public_key), $sign);
+				$isSign = $this->rsaVerify($preStr, trim($this->alipay_public_key), $sign);
 				break;
 			case "MD5" :
-				$isSgin = $this->md5Verify($prestr, $sign, trim($this->md5_key));
+				$isSign = $this->md5Verify($preStr, $sign, trim($this->md5_key));
 				break;
 			default :
-				$isSgin = FALSE;
+				$isSign = FALSE;
 		}
 
-		return $isSgin;
+		return $isSign;
 	}
 
 	/**
-	 * 获取远程服务器ATN结果,验证返回URL
+	 * 除去数组中的空值和签名参数
 	 *
-	 * @param integer $notify_id 通知校验ID
+	 * @param array $para 签名参数组
 	 *
-	 * @return string 服务器ATN结果
-	 * 验证结果集:
-	 * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空
-	 * true 返回正确信息
-	 * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟
+	 * @return array 去掉空值与签名参数后的新签名参数组
 	 */
-	function getResponse($notify_id)
+	function paraFilter($para)
 	{
-		$transport = strtolower(trim($this->transport));
-		$partner = trim($this->partner);
+		$para_filter = [];
+		foreach($para as $key => $val){
+			if($key == "sign" || $key == "sign_type" || $val == "") continue;
+			else    $para_filter[$key] = $para[$key];
+		}
 
-		$verify_url = $transport == 'https'? $this->https_verify_url : $this->http_verify_url;
-		$verify_url = $verify_url."partner=".$partner."&notify_id=".$notify_id;
-		$responseTxt = $this->getHttpResponseGET($verify_url, base_path('ca/cacert_alipay.pem'));
+		return $para_filter;
+	}
+
+	/**
+	 * 对数组排序
+	 *
+	 * @param array $para 排序前的数组
+	 *
+	 * @return array 排序后的数组
+	 */
+	function argSort($para)
+	{
+		ksort($para);
+		reset($para);
+
+		return $para;
+	}
+
+	/**
+	 * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
+	 *
+	 * @param array $para 需要拼接的数组
+	 *
+	 * @return string
+	 */
+	function createLinkString($para)
+	{
+		$arg = '';
+		foreach($para as $key => $val){
+			$arg .= "&".$key."=".$val;
+		}
 
-		return $responseTxt;
+		// 去掉开头的&字符
+		$arg = substr($arg, 1);
+
+		// 如果存在转义字符,那么去掉转义
+		if(get_magic_quotes_gpc()){
+			$arg = stripslashes($arg);
+		}
+
+		return $arg;
 	}
 
 	/**
@@ -152,42 +185,39 @@ class AlipayNotify
 	/**
 	 * 验证签名
 	 *
-	 * @param string $prestr 需要签名的字符串pre-sign
+	 * @param string $preStr 需要签名的字符串pre-sign
 	 * @param string $sign   签名结果
 	 * @param string $key    私钥
 	 *
 	 * @return bool
 	 */
-	function md5Verify($prestr, $sign, $key)
+	function md5Verify($preStr, $sign, $key)
 	{
-		$mysgin = md5($prestr.$key);
+		$mySign = md5($preStr.$key);
 
-		return $mysgin == $sign? TRUE : FALSE;
+		return $mySign == $sign? TRUE : FALSE;
 	}
 
 	/**
-	 * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
+	 * 获取远程服务器ATN结果,验证返回URL
 	 *
-	 * @param array $para 需要拼接的数组
+	 * @param integer $notify_id 通知校验ID
 	 *
-	 * @return string
+	 * @return string 服务器ATN结果
+	 * 验证结果集:
+	 * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空
+	 * true 返回正确信息
+	 * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟
 	 */
-	function createLinkString($para)
+	function getResponse($notify_id)
 	{
-		$arg = "";
-		while(list ($key, $val) = each($para)){
-			$arg .= $key."=".$val."&";
-		}
-
-		// 去掉最后一个&字符
-		$arg = substr($arg, 0, count($arg)-2);
+		$transport = strtolower(trim($this->transport));
+		$partner = trim($this->partner);
 
-		// 如果存在转义字符,那么去掉转义
-		if(get_magic_quotes_gpc()){
-			$arg = stripslashes($arg);
-		}
+		$verify_url = $transport == 'https'? $this->https_verify_url : $this->http_verify_url;
+		$verify_url = $verify_url."partner=".$partner."&notify_id=".$notify_id;
 
-		return $arg;
+		return $this->getHttpResponseGET($verify_url, base_path('ca/cacert_alipay.pem'));
 	}
 
 	/**
@@ -213,39 +243,6 @@ class AlipayNotify
 
 		return $responseText;
 	}
-
-	/**
-	 * 除去数组中的空值和签名参数
-	 *
-	 * @param array $para 签名参数组
-	 *
-	 * @return array 去掉空值与签名参数后的新签名参数组
-	 */
-	function paraFilter($para)
-	{
-		$para_filter = [];
-		while(list ($key, $val) = each($para)){
-			if($key == "sign" || $key == "sign_type" || $val == "") continue;
-			else    $para_filter[$key] = $para[$key];
-		}
-
-		return $para_filter;
-	}
-
-	/**
-	 * 对数组排序
-	 *
-	 * @param array $para 排序前的数组
-	 *
-	 * @return array 排序后的数组
-	 */
-	function argSort($para)
-	{
-		ksort($para);
-		reset($para);
-
-		return $para;
-	}
 }
 
 ?>

+ 98 - 101
app/Components/AlipaySubmit.php

@@ -29,29 +29,19 @@ class AlipaySubmit
 	}
 
 	/**
-	 * 生成签名结果
+	 * 生成要请求给支付宝的参数数组
 	 *
-	 * @param array $para_sort 已排序要签名的数组
+	 * @param array $para_temp 请求前的参数数组
 	 *
 	 * @return string
 	 */
-	function buildRequestMysign($para_sort)
+	function buildRequestParaToString($para_temp)
 	{
-		// 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
-		$prestr = $this->createLinkString($para_sort);
-
-		switch(strtoupper(trim($this->sign_type))){
-			case "MD5" :
-				$mysign = $this->md5Sign($prestr, $this->md5_key);
-				break;
-			case "RSA" :
-				$mysign = $this->rsaSign($prestr, $this->private_key);
-				break;
-			default :
-				$mysign = "";
-		}
+		// 待请求参数数组
+		$para = $this->buildRequestPara($para_temp);
 
-		return $mysign;
+		// 把参数组中所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
+		return $this->createLinkStringUrlEncode($para);
 	}
 
 	/**
@@ -70,74 +60,72 @@ class AlipaySubmit
 		$para_sort = $this->argSort($para_filter);
 
 		// 生成签名结果
-		$mysign = $this->buildRequestMysign($para_sort);
+		$mySign = $this->buildRequestMySign($para_sort);
 
 		// 签名结果与签名方式加入请求提交参数组中
-		$para_sort['sign'] = $mysign;
+		$para_sort['sign'] = $mySign;
 		$para_sort['sign_type'] = strtoupper(trim($this->sign_type));
 
 		return $para_sort;
 	}
 
 	/**
-	 * 生成要请求给支付宝的参数数组
+	 * 除去数组中的空值和签名参数
 	 *
-	 * @param array $para_temp 请求前的参数数组
+	 * @param array $para 签名参数组
 	 *
-	 * @return string
+	 * @return array
 	 */
-	function buildRequestParaToString($para_temp)
+	function paraFilter($para)
 	{
-		// 待请求参数数组
-		$para = $this->buildRequestPara($para_temp);
-
-		// 把参数组中所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
-		$request_data = $this->createLinkStringUrlEncode($para);
+		$para_filter = [];
+		foreach($para as $key => $val){
+			if($key == "sign" || $key == "sign_type" || $val == "") continue;
+			else    $para_filter[$key] = $para[$key];
+		}
 
-		return $request_data;
+		return $para_filter;
 	}
 
 	/**
-	 * 建立请求,以表单HTML形式构造(默认)
+	 * 对数组排序
 	 *
-	 * @param array  $para_temp   请求参数数组
-	 * @param string $method      提交方式。两个值可选:post、get
-	 * @param string $button_name 确认按钮显示文字
+	 * @param array $para 排序前的数组
 	 *
-	 * @return string
+	 * @return mixed
 	 */
-	public function buildRequestForm($para_temp, $method, $button_name)
+	function argSort($para)
 	{
-		// 待请求参数数组
-		$para = $this->buildRequestPara($para_temp);
-
-		$sHtml = "<form id='alipaysubmit' name='alipaysubmit' action='".$this->alipay_gateway_new."_input_charset=utf-8' method='".$method."'>";
-		while(list ($key, $val) = each($para)){
-			$sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
-		}
-
-		// submit按钮控件请不要含有name属性
-		$sHtml = $sHtml."<input type='submit'  value='".$button_name."' style='display:none;'></form>";
-		$sHtml = $sHtml."<script>document.forms['alipaysubmit'].submit();</script>";
+		ksort($para);
+		reset($para);
 
-		return $sHtml;
+		return $para;
 	}
 
 	/**
-	 * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数
+	 * 生成签名结果
+	 *
+	 * @param array $para_sort 已排序要签名的数组
 	 *
 	 * @return string
 	 */
-	function query_timestamp()
+	function buildRequestMySign($para_sort)
 	{
-		$url = $this->alipay_gateway_new."service=query_timestamp&partner=".trim(strtolower($this->partner))."&_input_charset=utf-8";
+		// 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
+		$preStr = $this->createLinkString($para_sort);
 
-		$doc = new DOMDocument();
-		$doc->load($url);
-		$itemEncrypt_key = $doc->getElementsByTagName("encrypt_key");
-		$encrypt_key = $itemEncrypt_key->item(0)->nodeValue;
+		switch(strtoupper(trim($this->sign_type))){
+			case "MD5" :
+				$mySign = $this->md5Sign($preStr, $this->md5_key);
+				break;
+			case "RSA" :
+				$mySign = $this->rsaSign($preStr, $this->private_key);
+				break;
+			default :
+				$mySign = "";
+		}
 
-		return $encrypt_key;
+		return $mySign;
 	}
 
 	/**
@@ -149,13 +137,13 @@ class AlipaySubmit
 	 */
 	function createLinkString($para)
 	{
-		$arg = "";
-		while(list ($key, $val) = each($para)){
-			$arg .= $key."=".$val."&";
+		$arg = '';
+		foreach($para as $key => $val){
+			$arg .= "&".$key."=".$val;
 		}
 
-		// 去掉最后一个&字符
-		$arg = substr($arg, 0, count($arg)-2);
+		// 去掉开头的&字符
+		$arg = substr($arg, 1);
 
 		// 如果存在转义字符,那么去掉转义
 		if(get_magic_quotes_gpc()){
@@ -166,28 +154,16 @@ class AlipaySubmit
 	}
 
 	/**
-	 * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
+	 * 签名字符串
 	 *
-	 * @param array $para 需要拼接的数组
+	 * @param string $preStr 需要签名的字符串
+	 * @param string $key    私钥
 	 *
-	 * @return bool|string
+	 * @return string
 	 */
-	function createLinkStringUrlEncode($para)
+	function md5Sign($preStr, $key)
 	{
-		$arg = "";
-		while(list ($key, $val) = each($para)){
-			$arg .= $key."=".urlencode($val)."&";
-		}
-
-		// 去掉最后一个&字符
-		$arg = substr($arg, 0, count($arg)-2);
-
-		// 如果存在转义字符,那么去掉转义
-		if(get_magic_quotes_gpc()){
-			$arg = stripslashes($arg);
-		}
-
-		return $arg;
+		return md5($preStr.$key);
 	}
 
 	/**
@@ -221,48 +197,69 @@ class AlipaySubmit
 	}
 
 	/**
-	 * 签名字符串
+	 * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
 	 *
-	 * @param string $prestr 需要签名的字符串
-	 * @param string $key    私钥
+	 * @param array $para 需要拼接的数组
 	 *
-	 * @return string
+	 * @return bool|string
 	 */
-	function md5Sign($prestr, $key)
+	function createLinkStringUrlEncode($para)
 	{
-		return md5($prestr.$key);
+		$arg = '';
+		foreach($para as $key => $val){
+			$arg .= "&".$key."=".urlencode($val);
+		}
+
+		// 去掉开头的&字符
+		$arg = substr($arg, 1);
+
+		// 如果存在转义字符,那么去掉转义
+		if(get_magic_quotes_gpc()){
+			$arg = stripslashes($arg);
+		}
+
+		return $arg;
 	}
 
 	/**
-	 * 除去数组中的空值和签名参数
+	 * 建立请求,以表单HTML形式构造(默认)
 	 *
-	 * @param array $para 签名参数组
+	 * @param array  $para_temp   请求参数数组
+	 * @param string $method      提交方式。两个值可选:post|get
+	 * @param string $button_name 确认按钮显示文字
 	 *
-	 * @return array
+	 * @return string
 	 */
-	function paraFilter($para)
+	public function buildRequestForm($para_temp, $method, $button_name)
 	{
-		$para_filter = [];
-		while(list ($key, $val) = each($para)){
-			if($key == "sign" || $key == "sign_type" || $val == "") continue;
-			else    $para_filter[$key] = $para[$key];
+		// 待请求参数数组
+		$para = $this->buildRequestPara($para_temp);
+
+		$sHtml = "<form id='alipaySubmit' name='alipaySubmit' action='".$this->alipay_gateway_new."_input_charset=utf-8' method='".$method."'>";
+		foreach($para as $key => $val){
+			$sHtml .= "<input type='hidden' name='".$key."' value='".$val."'/>";
 		}
 
-		return $para_filter;
+		// submit按钮控件请不要含有name属性
+		$sHtml = $sHtml."<input type='submit'  value='".$button_name."' style='display:none;'></form>";
+		$sHtml = $sHtml."<script>document.forms['alipaySubmit'].submit();</script>";
+
+		return $sHtml;
 	}
 
 	/**
-	 * 对数组排序
-	 *
-	 * @param array $para 排序前的数组
+	 * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数
 	 *
-	 * @return mixed
+	 * @return string
 	 */
-	function argSort($para)
+	function query_timestamp()
 	{
-		ksort($para);
-		reset($para);
+		$url = $this->alipay_gateway_new."service=query_timestamp&partner=".trim(strtolower($this->partner))."&_input_charset=utf-8";
 
-		return $para;
+		$doc = new DOMDocument();
+		$doc->load($url);
+		$itemEncrypt_key = $doc->getElementsByTagName("encrypt_key");
+
+		return $itemEncrypt_key->item(0)->nodeValue;
 	}
 }

+ 7 - 9
app/Components/Callback.php

@@ -14,10 +14,8 @@ use App\Mail\sendUserInfo;
 use DB;
 use Exception;
 use Hash;
-use Illuminate\Http\Request;
 use Log;
 use Mail;
-use Response;
 
 trait Callback
 {
@@ -28,6 +26,11 @@ trait Callback
 		self::$systemConfig = Helpers::systemConfig();
 	}
 
+	public function show()
+	{
+		exit('show');
+	}
+
 	// 交易支付
 	private function tradePaid($msg, $pay_type)
 	{
@@ -195,6 +198,7 @@ trait Callback
 			DB::rollBack();
 			Log::info('【'.$pay_type_name.'】回调更新支付单和订单异常:'.$e->getMessage());
 		}
+
 		return FALSE;
 	}
 
@@ -239,12 +243,6 @@ trait Callback
 			$obj->save();
 		}
 		Helpers::addUserTrafficModifyLog($prepaidOrder->user_id, $prepaidOrder->oid, $user->transfer_enable, $userTraffic, '[预支付订单激活]加上用户购买的套餐流量');
-
-		User::query()->where('id', $prepaidOrder->user_id)->increment('invite_num', $prepaidOrder->invite_num? : 0, ['transfer_enable' => $userTraffic, 'expire_time' => $expire_time, 'reset_time' => $nextResetTime]);
-	}
-
-	public function show(Request $request)
-	{
-		exit('show');
+		User::query()->where('id', $prepaidOrder->user_id)->increment('invite_num', $prepaidOrder->invite_num? : 0, ['u' => 0, 'd' => 0, 'transfer_enable' => $userTraffic, 'expire_time' => $expire_time, 'reset_time' => $nextResetTime]);
 	}
 }

+ 64 - 64
app/Components/Helpers.php

@@ -22,70 +22,6 @@ class Helpers
 		60177, 60179
 	];
 
-	// 获取系统配置
-	public static function systemConfig()
-	{
-		$config = Config::query()->get();
-		$data = [];
-		foreach($config as $vo){
-			$data[$vo->name] = $vo->value;
-		}
-
-		return $data;
-	}
-
-	// 获取默认加密方式
-	public static function getDefaultMethod()
-	{
-		$config = SsConfig::default()->type(1)->first();
-
-		return $config? $config->name : 'aes-256-cfb';
-	}
-
-	// 获取默认协议
-	public static function getDefaultProtocol()
-	{
-		$config = SsConfig::default()->type(2)->first();
-
-		return $config? $config->name : 'origin';
-	}
-
-	// 获取默认混淆
-	public static function getDefaultObfs()
-	{
-		$config = SsConfig::default()->type(3)->first();
-
-		return $config? $config->name : 'plain';
-	}
-
-	// 获取一个随机端口
-	public static function getRandPort()
-	{
-		$config = self::systemConfig();
-		$port = mt_rand($config['min_port'], $config['max_port']);
-
-		$exists_port = User::query()->pluck('port')->toArray();
-		if(in_array($port, $exists_port) || in_array($port, self::$denyPorts)){
-			$port = self::getRandPort();
-		}
-
-		return $port;
-	}
-
-	// 获取一个端口
-	public static function getOnlyPort()
-	{
-		$config = self::systemConfig();
-		$port = $config['min_port'];
-
-		$exists_port = User::query()->where('port', '>=', $port)->pluck('port')->toArray();
-		while(in_array($port, $exists_port) || in_array($port, self::$denyPorts)){
-			$port = $port+1;
-		}
-
-		return $port;
-	}
-
 	// 加密方式
 	public static function methodList()
 	{
@@ -159,6 +95,70 @@ class Helpers
 		return $user->id;
 	}
 
+	// 获取系统配置
+	public static function systemConfig()
+	{
+		$config = Config::query()->get();
+		$data = [];
+		foreach($config as $vo){
+			$data[$vo->name] = $vo->value;
+		}
+
+		return $data;
+	}
+
+	// 获取一个随机端口
+	public static function getRandPort()
+	{
+		$config = self::systemConfig();
+		$port = mt_rand($config['min_port'], $config['max_port']);
+
+		$exists_port = User::query()->pluck('port')->toArray();
+		if(in_array($port, $exists_port) || in_array($port, self::$denyPorts)){
+			$port = self::getRandPort();
+		}
+
+		return $port;
+	}
+
+	// 获取一个随机端口
+	public static function getOnlyPort()
+	{
+		$config = self::systemConfig();
+		$port = $config['min_port'];
+
+		$exists_port = User::query()->where('port', '>=', $port)->pluck('port')->toArray();
+		while(in_array($port, $exists_port) || in_array($port, self::$denyPorts)){
+			$port = $port+1;
+		}
+
+		return $port;
+	}
+
+	// 获取默认加密方式
+	public static function getDefaultMethod()
+	{
+		$config = SsConfig::default()->type(1)->first();
+
+		return $config? $config->name : 'aes-256-cfb';
+	}
+
+	// 获取默认协议
+	public static function getDefaultProtocol()
+	{
+		$config = SsConfig::default()->type(2)->first();
+
+		return $config? $config->name : 'origin';
+	}
+
+	// 获取默认混淆
+	public static function getDefaultObfs()
+	{
+		$config = SsConfig::default()->type(3)->first();
+
+		return $config? $config->name : 'plain';
+	}
+
 	/**
 	 * 添加邮件投递日志
 	 *

+ 1 - 3
app/Components/IPIP.php

@@ -16,10 +16,8 @@ class IPIP
 	public static function ip($ip)
 	{
 		$filePath = public_path('ipip.ipdb');
-
 		$loc = new City($filePath);
-		$result = $loc->findMap($ip, 'CN');
 
-		return $result;
+		return $loc->findMap($ip, 'CN');
 	}
 }

+ 32 - 32
app/Components/Namesilo.php

@@ -23,6 +23,38 @@ class Namesilo
 		return $this->send('listDomains');
 	}
 
+	// 发送请求
+	private function send($operation, $data = [])
+	{
+		$params = [
+			'version' => 1,
+			'type'    => 'xml',
+			'key'     => self::$systemConfig['namesilo_key']
+		];
+		$query = array_merge($params, $data);
+
+		$content = '请求操作:['.$operation.'] --- 请求数据:['.http_build_query($query).']';
+
+		try{
+			$result = Curl::send(self::$host.$operation.'?'.http_build_query($query));
+			$result = XML2Array::createArray($result);
+
+			// 出错
+			if(empty($result['namesilo']) || $result['namesilo']['reply']['code'] != 300 || $result['namesilo']['reply']['detail'] != 'success'){
+				Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 0, $result['namesilo']['reply']['detail']);
+			}else{
+				Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 1, $result['namesilo']['reply']['detail']);
+			}
+
+			return $result['namesilo']['reply'];
+		} catch(Exception $e){
+			Log::error('CURL请求失败:'.$e->getMessage().' --- '.$e->getLine());
+			Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 0, $e->getMessage());
+
+			return FALSE;
+		}
+	}
+
 	// 列出指定域名的所有DNS记录
 	public function dnsListRecords($domain)
 	{
@@ -71,36 +103,4 @@ class Namesilo
 
 		return $this->send('dnsDeleteRecord', $data);
 	}
-
-	// 发送请求
-	private function send($operation, $data = [])
-	{
-		$params = [
-			'version' => 1,
-			'type'    => 'xml',
-			'key'     => self::$systemConfig['namesilo_key']
-		];
-		$query = array_merge($params, $data);
-
-		$content = '请求操作:['.$operation.'] --- 请求数据:['.http_build_query($query).']';
-
-		try{
-			$result = Curl::send(self::$host.$operation.'?'.http_build_query($query));
-			$result = XML2Array::createArray($result);
-
-			// 出错
-			if(empty($result['namesilo']) || $result['namesilo']['reply']['code'] != 300 || $result['namesilo']['reply']['detail'] != 'success'){
-				Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 0, $result['namesilo']['reply']['detail']);
-			}else{
-				Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 1, $result['namesilo']['reply']['detail']);
-			}
-
-			return $result['namesilo']['reply'];
-		} catch(Exception $e){
-			Log::error('CURL请求失败:'.$e->getMessage().' --- '.$e->getLine());
-			Helpers::addEmailLog(self::$systemConfig['webmaster_email'], '[Namesilo API] - ['.$operation.']', $content, 0, $e->getMessage());
-
-			return FALSE;
-		}
-	}
 }

+ 2 - 0
app/Components/ServerChan.php

@@ -35,6 +35,8 @@ class ServerChan
 		}else{
 			Log::error('消息推送失败:未启用或未正确配置ServerChan');
 		}
+
+		return;
 	}
 
 	/**

+ 5 - 5
app/Console/Commands/AutoClearLog.php

@@ -19,9 +19,9 @@ use Log;
 
 class AutoClearLog extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'autoClearLog';
 	protected $description = '自动清除日志';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -41,7 +41,7 @@ class AutoClearLog extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	// 清除日志
@@ -60,7 +60,7 @@ class AutoClearLog extends Command
 		UserTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 days')))->delete();
 
 		// 自动清除1个月以前的用户每天流量数据日志
-		UserTrafficDaily::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-1 month')))->delete();
+		UserTrafficDaily::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-1 month 5 days')))->delete();
 
 		// 自动清除2个月以前的节点每小时流量数据日志
 		SsNodeTrafficHourly::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-2 month')))->delete();
@@ -71,8 +71,8 @@ class AutoClearLog extends Command
 		// 自动清除30天以前用户封禁日志
 		UserBanLog::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-1 month")))->delete();
 
-		// 自动清除1前用户连接IP
-		SsNodeIp::query()->where('created_at', '<=', strtotime("-1 day"))->delete();
+		// 自动清除1前用户连接IP
+		SsNodeIp::query()->where('created_at', '<=', strtotime("-1 month"))->delete();
 
 		// 自动清除3个月以前用户登陆日志
 		UserLoginLog::query()->where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-3 month")))->delete();

+ 19 - 19
app/Console/Commands/AutoJob.php

@@ -23,9 +23,9 @@ use Log;
 
 class AutoJob extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'autoJob';
 	protected $description = '自动化任务';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -64,7 +64,7 @@ class AutoJob extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('【'.$this->description.'】执行定时任务,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	// 关闭超时未支付订单
@@ -121,7 +121,7 @@ class AutoJob extends Command
 				$subscribe = UserSubscribe::query()->where('user_id', $user->id)->first();
 				if($subscribe){
 					// 24小时内不同IP的请求次数
-					$request_times = UserSubscribeLog::query()->where('sid', $subscribe->id)->where('request_time', '>=', date("Y-m-d H:i:s", strtotime("-24 hours")))->distinct()->count('request_ip');
+					$request_times = UserSubscribeLog::query()->where('sid', $subscribe->id)->where('request_time', '>=', date("Y-m-d H:i:s", strtotime("-24 hours")))->distinct('request_ip')->count('request_ip');
 					if($request_times >= self::$systemConfig['subscribe_ban_times']){
 						UserSubscribe::query()->where('id', $subscribe->id)->update(['status' => 0, 'ban_time' => time(), 'ban_desc' => '存在异常,自动封禁']);
 
@@ -133,6 +133,22 @@ class AutoJob extends Command
 		}
 	}
 
+	/**
+	 * 添加用户封禁日志
+	 *
+	 * @param int    $userId  用户ID
+	 * @param int    $minutes 封禁时长,单位分钟
+	 * @param string $desc    封禁理由
+	 */
+	private function addUserBanLog($userId, $minutes, $desc)
+	{
+		$log = new UserBanLog();
+		$log->user_id = $userId;
+		$log->minutes = $minutes;
+		$log->desc = $desc;
+		$log->save();
+	}
+
 	// 封禁账号
 	private function blockUsers()
 	{
@@ -224,20 +240,4 @@ class AutoJob extends Command
 			}
 		}
 	}
-
-	/**
-	 * 添加用户封禁日志
-	 *
-	 * @param int    $userId  用户ID
-	 * @param int    $minutes 封禁时长,单位分钟
-	 * @param string $desc    封禁理由
-	 */
-	private function addUserBanLog($userId, $minutes, $desc)
-	{
-		$log = new UserBanLog();
-		$log->user_id = $userId;
-		$log->minutes = $minutes;
-		$log->desc = $desc;
-		$log->save();
-	}
 }

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

@@ -11,9 +11,9 @@ use Log;
 
 class AutoReportNode extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'autoReportNode';
 	protected $description = '自动报告节点昨日使用情况';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -50,6 +50,6 @@ class AutoReportNode extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 }

+ 1 - 1
app/Console/Commands/AutoStatisticsNodeDailyTraffic.php

@@ -30,7 +30,7 @@ class AutoStatisticsNodeDailyTraffic extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function statisticsByNode($node_id)

+ 1 - 1
app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php

@@ -30,7 +30,7 @@ class AutoStatisticsNodeHourlyTraffic extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function statisticsByNode($node_id)

+ 1 - 1
app/Console/Commands/AutoStatisticsUserDailyTraffic.php

@@ -38,7 +38,7 @@ class AutoStatisticsUserDailyTraffic extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function statisticsByNode($user_id, $node_id = 0)

+ 1 - 1
app/Console/Commands/AutoStatisticsUserHourlyTraffic.php

@@ -38,7 +38,7 @@ class AutoStatisticsUserHourlyTraffic extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function statisticsByNode($user_id, $node_id = 0)

+ 19 - 20
app/Console/Commands/DailyJob.php

@@ -15,9 +15,9 @@ use Log;
 
 class DailyJob extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'dailyJob';
 	protected $description = '每日任务';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -40,11 +40,10 @@ class DailyJob extends Command
 			$this->resetUserTraffic();
 		}
 
-
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('【'.$this->description.'】执行定时任务,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function expireUser()
@@ -91,6 +90,22 @@ class DailyJob extends Command
 		}
 	}
 
+	/**
+	 * 添加用户封禁日志
+	 *
+	 * @param int    $userId  用户ID
+	 * @param int    $minutes 封禁时长,单位分钟
+	 * @param string $desc    封禁理由
+	 */
+	private function addUserBanLog($userId, $minutes, $desc)
+	{
+		$log = new UserBanLog();
+		$log->user_id = $userId;
+		$log->minutes = $minutes;
+		$log->desc = $desc;
+		$log->save();
+	}
+
 	// 关闭超过72小时未处理的工单
 	private function closeTickets()
 	{
@@ -150,23 +165,7 @@ class DailyJob extends Command
 			}
 			// 重置流量
 			User::query()->where('id', $user->id)->update(['u' => 0, 'd' => 0, 'transfer_enable' => $order->goods->traffic*1048576, 'reset_time' => $nextResetTime]);
-			Log::info('用户[ID:'.$user->id.'  邮箱: '.$user->username.'] 流量重置为 '.($order->goods->traffic*1048576).'. 重置日期为 '.$nextResetTime? : '【无】');
+			Log::info('用户[ID:'.$user->id.'  邮箱: '.$user->username.'] 流量重置为 '.($order->goods->traffic*1048576).'. 重置日期为 '.($nextResetTime? : '【无】'));
 		}
 	}
-
-	/**
-	 * 添加用户封禁日志
-	 *
-	 * @param int    $userId  用户ID
-	 * @param int    $minutes 封禁时长,单位分钟
-	 * @param string $desc    封禁理由
-	 */
-	private function addUserBanLog($userId, $minutes, $desc)
-	{
-		$log = new UserBanLog();
-		$log->user_id = $userId;
-		$log->minutes = $minutes;
-		$log->desc = $desc;
-		$log->save();
-	}
 }

+ 24 - 22
app/Console/Commands/NodeBlockedDetection.php

@@ -15,9 +15,9 @@ use Mail;
 
 class NodeBlockedDetection extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'nodeBlockedDetection';
 	protected $description = '节点阻断检测';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -41,7 +41,7 @@ class NodeBlockedDetection extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info("执行定时任务【{$this->description}】,耗时 {$jobUsedTime} 秒");
+		Log::info("---【{$this->description}】完成---,耗时 {$jobUsedTime} 秒");
 	}
 
 	// 监测节点状态
@@ -74,6 +74,7 @@ class NodeBlockedDetection extends Command
 					}
 				}
 			}
+			sleep(3);
 			if($node->detectionType != 2){
 				$tcpCheck = $this->networkCheck($node->ip, FALSE, $node->single? $node->port : FALSE);
 				if($tcpCheck != FALSE){
@@ -92,7 +93,7 @@ class NodeBlockedDetection extends Command
 					if(Cache::has($cacheKey)){
 						$times = Cache::get($cacheKey);
 					}else{
-						Cache::put($cacheKey, 1, 725); // 最多设置提醒12次,12*60=720分钟缓存时效,多5分钟防止异常
+						Cache::put($cacheKey, 1, 43200); // 最多设置提醒12次,每次1小时间隔
 						$times = 1;
 					}
 
@@ -107,11 +108,30 @@ class NodeBlockedDetection extends Command
 				$this->notifyMaster($title, "**{$node->name} - 【{$node->ip}】**: \r\n\r\n".$text, $node->name, $node->server);
 				Log::info("【节点阻断检测】{$node->name} - 【{$node->ip}】: \r\n".$text);
 			}
+			sleep(3);
 		}
 
 		// 随机生成下次检测时间
 		$nextCheckTime = time()+3600;
-		Cache::put('LastCheckTime', $nextCheckTime, 60);
+		Cache::put('LastCheckTime', $nextCheckTime, 3600);
+	}
+
+	/**
+	 * 通知管理员
+	 *
+	 * @param string $title      消息标题
+	 * @param string $content    消息内容
+	 * @param string $nodeName   节点名称
+	 * @param string $nodeServer 节点域名
+	 *
+	 */
+	private function notifyMaster($title, $content, $nodeName, $nodeServer)
+	{
+		if(self::$systemConfig['webmaster_email']){
+			$logId = Helpers::addEmailLog(self::$systemConfig['webmaster_email'], $title, $content);
+			Mail::to(self::$systemConfig['webmaster_email'])->send(new nodeCrashWarning($logId, $nodeName, $nodeServer));
+		}
+		ServerChan::send($title, $content);
 	}
 
 	/**
@@ -155,22 +175,4 @@ class NodeBlockedDetection extends Command
 			return '机器宕机'; // 服务器宕机
 		}
 	}
-
-	/**
-	 * 通知管理员
-	 *
-	 * @param string $title      消息标题
-	 * @param string $content    消息内容
-	 * @param string $nodeName   节点名称
-	 * @param string $nodeServer 节点域名
-	 *
-	 */
-	private function notifyMaster($title, $content, $nodeName, $nodeServer)
-	{
-		if(self::$systemConfig['webmaster_email']){
-			$logId = Helpers::addEmailLog(self::$systemConfig['webmaster_email'], $title, $content);
-			Mail::to(self::$systemConfig['webmaster_email'])->send(new nodeCrashWarning($logId, $nodeName, $nodeServer));
-		}
-		ServerChan::send($title, $content);
-	}
 }

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

@@ -15,9 +15,9 @@ use Log;
 class ServiceTimer extends Command
 {
 	use Callback;
+	protected static $systemConfig;
 	protected $signature = 'serviceTimer';
 	protected $description = '服务计时器';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -35,7 +35,7 @@ class ServiceTimer extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	// 扣减用户到期商品的流量

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

@@ -12,9 +12,9 @@ use Mail;
 
 class UserExpireAutoWarning extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'userExpireAutoWarning';
 	protected $description = '用户临近到期自动发邮件提醒';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -34,7 +34,7 @@ class UserExpireAutoWarning extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	private function userExpireWarning()

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

@@ -11,9 +11,9 @@ use Log;
 
 class UserTrafficAbnormalAutoWarning extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'userTrafficAbnormalAutoWarning';
 	protected $description = '用户流量异常警告';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -31,7 +31,7 @@ class UserTrafficAbnormalAutoWarning extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	// 用户流量异常警告

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

@@ -11,9 +11,9 @@ use Mail;
 
 class UserTrafficAutoWarning extends Command
 {
+	protected static $systemConfig;
 	protected $signature = 'userTrafficAutoWarning';
 	protected $description = '用户流量超过警告阈值自动发邮件提醒';
-	protected static $systemConfig;
 
 	public function __construct()
 	{
@@ -33,7 +33,7 @@ class UserTrafficAutoWarning extends Command
 		$jobEndTime = microtime(TRUE);
 		$jobUsedTime = round(($jobEndTime-$jobStartTime), 4);
 
-		Log::info('执行定时任务【'.$this->description.'】,耗时'.$jobUsedTime.'秒');
+		Log::info('---【'.$this->description.'】完成---,耗时'.$jobUsedTime.'秒');
 	}
 
 	// 用户流量超过警告阈值自动发邮件提醒

+ 1 - 1
app/Console/Commands/upgradeUserResetTime.php

@@ -56,7 +56,7 @@ class upgradeUserResetTime extends Command
 				User::query()->where('id', $user->id)->update(['reset_time' => $reset_time]);
 			}
 
-			Log::info('---用户[ID:'.$user->id.' - '.$user->username.']的新重置日期为'.($reset_time != NULL? '【'.$reset_time.'】': '【无】').'---');
+			Log::info('---用户[ID:'.$user->id.' - '.$user->username.']的新重置日期为'.($reset_time != NULL? '【'.$reset_time.'】' : '【无】').'---');
 		}
 
 		Log::info('----------------------------【升级用户重置日期】结束----------------------------');

+ 8 - 8
app/Exceptions/Handler.php

@@ -58,8 +58,8 @@ class Handler extends ExceptionHandler
 	/**
 	 * Render an exception into an HTTP response.
 	 *
-	 * @param Request $request
-	 * @param Exception                $exception
+	 * @param Request   $request
+	 * @param Exception $exception
 	 *
 	 * @return Response
 	 */
@@ -75,7 +75,7 @@ class Handler extends ExceptionHandler
 			Log::info("异常请求:".$request->fullUrl().",IP:".getClientIp());
 
 			if($request->ajax()){
-				return response()->json(['status' => 'fail', 'data' => '', 'message' => 'Page Not Found']);
+				return response()->json(['status' => 'fail', 'data' => '', 'message' => trans('error.MissingPage')]);
 			}else{
 				return response()->view('auth.error', ['message' => trans('error.MissingPage')]);
 			}
@@ -84,7 +84,7 @@ class Handler extends ExceptionHandler
 		// 捕获身份校验异常
 		if($exception instanceof AuthenticationException){
 			if($request->ajax()){
-				return response()->json(['status' => 'fail', 'data' => '', 'message' => 'Unauthorized']);
+				return response()->json(['status' => 'fail', 'data' => '', 'message' => trans('error.Unauthorized')]);
 			}else{
 				return response()->view('auth.error', ['message' => trans('error.Unauthorized')]);
 			}
@@ -93,16 +93,16 @@ class Handler extends ExceptionHandler
 		// 捕获CSRF异常
 		if($exception instanceof TokenMismatchException){
 			if($request->ajax()){
-				return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error, Please Refresh Page, Try One More Time']);
+				return response()->json(['status' => 'fail', 'data' => '', 'message' => trans('error.RefreshPage').'<a href="/login" target="_blank">'.trans('error.Refresh').'</a>']);
 			}else{
-				return response()->view('auth.error', ['message' => trans('error.RefreshPage')]);
+				return response()->view('auth.error', ['message' => trans('error.RefreshPage').'<a href="/login" target="_blank">'.trans('error.Refresh').'</a>']);
 			}
 		}
 
 		// 捕获反射异常
 		if($exception instanceof ReflectionException){
 			if($request->ajax()){
-				return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error']);
+				return response()->json(['status' => 'fail', 'data' => '', 'message' => trans('error.SystemError')]);
 			}else{
 				return response()->view('auth.error', ['message' => trans('error.SystemError')]);
 			}
@@ -111,7 +111,7 @@ class Handler extends ExceptionHandler
 		// 捕获系统错误异常
 		if($exception instanceof ErrorException){
 			if($request->ajax()){
-				return response()->json(['status' => 'fail', 'data' => '', 'message' => 'System Error']);
+				return response()->json(['status' => 'fail', 'data' => '', 'message' => trans('error.SystemError').', '.trans('error.Visit').'<a href="/logs" target="_blank">'.trans('error.log').'</a>']);
 			}else{
 				return response()->view('auth.error', ['message' => trans('error.SystemError').', '.trans('error.Visit').'<a href="/logs" target="_blank">'.trans('error.log').'</a>']);
 			}

+ 96 - 138
app/Http/Controllers/AdminController.php

@@ -64,7 +64,7 @@ class AdminController extends Controller
 		self::$systemConfig = Helpers::systemConfig();
 	}
 
-	public function index(Request $request)
+	public function index()
 	{
 		$past = strtotime(date('Y-m-d', strtotime("-".self::$systemConfig['expire_days']." days")));
 
@@ -294,6 +294,22 @@ class AdminController extends Controller
 		}
 	}
 
+	// 生成用户标签
+	private function makeUserLabels($userId, $labels)
+	{
+		// 先删除该用户所有的标签
+		UserLabel::query()->where('user_id', $userId)->delete();
+
+		if(!empty($labels) && is_array($labels)){
+			foreach($labels as $label){
+				$userLabel = new UserLabel();
+				$userLabel->user_id = $userId;
+				$userLabel->label_id = $label;
+				$userLabel->save();
+			}
+		}
+	}
+
 	// 批量生成账号
 	public function batchAddUsers(Request $request)
 	{
@@ -771,6 +787,22 @@ class AdminController extends Controller
 		}
 	}
 
+	// 生成节点标签
+	private function makeNodeLabels($nodeId, $labels)
+	{
+		// 先删除所有该节点的标签
+		SsNodeLabel::query()->where('node_id', $nodeId)->delete();
+
+		if(!empty($labels) && is_array($labels)){
+			foreach($labels as $label){
+				$ssNodeLabel = new SsNodeLabel();
+				$ssNodeLabel->node_id = $nodeId;
+				$ssNodeLabel->label_id = $label;
+				$ssNodeLabel->save();
+			}
+		}
+	}
+
 	// 删除节点
 	public function delNode(Request $request)
 	{
@@ -807,7 +839,7 @@ class AdminController extends Controller
 	}
 
 	// 节点流量监控
-	public function nodeMonitor(Request $request, $node_id)
+	public function nodeMonitor($node_id)
 	{
 		$node = SsNode::query()->where('id', $node_id)->orderBy('sort', 'desc')->first();
 		if(!$node){
@@ -1075,6 +1107,8 @@ class AdminController extends Controller
 		$user_id = $request->input('user_id');
 		$username = $request->input('username');
 		$nodeId = $request->input('nodeId');
+		$startTime = $request->input('startTime');
+		$endTime = $request->input('endTime');
 
 		$query = UserTrafficLog::query()->with(['user', 'node']);
 
@@ -1098,6 +1132,14 @@ class AdminController extends Controller
 			$query->where('node_id', $nodeId);
 		}
 
+		if(isset($startTime)){
+			$query->where('log_time', '>=', strtotime($startTime));
+		}
+
+		if(isset($endTime)){
+			$query->where('log_time', '<=', strtotime($endTime));
+		}
+
 		// 已使用流量
 		$view['totalTraffic'] = flowAutoShow($query->sum('u')+$query->sum('d'));
 
@@ -1252,8 +1294,8 @@ class AdminController extends Controller
 				return Redirect::back();
 			}
 
-			DB::beginTransaction();
 			try{
+				DB::beginTransaction();
 				foreach($data as $user){
 					$obj = new User();
 					$obj->username = $user->user;
@@ -1317,88 +1359,26 @@ class AdminController extends Controller
 			return Redirect::to('admin/userList');
 		}
 
-		$nodeList = SsNode::query()->where('status', 1)->orderBy('sort', 'desc')->orderBy('id', 'asc')->paginate(15)->appends($request->except('page'));
-		foreach($nodeList as $node){
-			// 获取分组名称
-			$group = SsGroup::query()->where('id', $node->group_id)->first();
-			$host = $node->server? : $node->ip;
-			if($node->type == 1){
-				$obfs_param = $user->obfs_param? : $node->obfs_param;
-				$group = empty($group)? Helpers::systemConfig()['website_name'] : $group->name;
-				if($node->single){
-					$port = $node->port;
-					$protocol = $node->protocol;
-					$method = $node->method;
-					$obfs = $node->obfs;
-					$passwd = $node->passwd;
-					$protocol_param = $user->port.':'.$user->passwd;
-				}else{
-					$port = $user->port;
-					$protocol = $user->protocol;
-					$method = $user->method;
-					$obfs = $user->obfs;
-					$passwd = $user->passwd;
-					$protocol_param = $user->protocol_param;
-				}
+		if($request->isMethod('POST')){
+			$node_id = $request->input('id');
+			$infoType = $request->input('type');
 
-				// 生成ssr scheme
-				$node->ssr_scheme = 'ssr://'.base64url_encode($host.':'.$port.':'.$protocol.':'.$method.':'.$obfs.':'.base64url_encode($passwd).'/?obfsparam='.base64url_encode($obfs_param).'&protoparam='.base64url_encode($protocol_param).'&remarks='.base64url_encode($node->name).'&group='.base64url_encode($group).'&udpport=0&uot=0');
-
-				// 生成ss scheme
-				$node->ss_scheme = $node->compatible? 'ss://'.base64url_encode($user->method.':'.$user->passwd.'@'.$host.':'.$user->port).'#'.$group : '';
-
-				// 生成文本配置信息
-				$node->txt = "服务器:".$host."\r\n".
-				$node->ipv6? "IPv6:".$node->ipv6."\r\n" : ''.
-					"远程端口:".$port."\r\n".
-					"密码:".$passwd."\r\n".
-					"加密方法:".$method."\r\n".
-					"路由:绕过局域网及中国大陆地址"."\r\n".
-					"协议:".$protocol."\r\n".
-					"协议参数:".$protocol_param."\r\n".
-					"混淆方式:".$obfs."\r\n".
-					"混淆参数:".$obfs_param."\r\n".
-					"本地端口:1080"."\r\n";
-			}else{
-				// 生成v2ray scheme
-				$node->v2_scheme = 'vmess://'.base64url_encode(json_encode([
-						"v"    => "2",
-						"ps"   => $node->name,
-						"add"  => $node->server? : $node->ip,
-						"port" => $node->v2_port,
-						"id"   => $user->vmess_id,
-						"aid"  => $node->v2_alter_id,
-						"net"  => $node->v2_net,
-						"type" => $node->v2_type,
-						"host" => $node->v2_host,
-						"path" => $node->v2_path,
-						"tls"  => $node->v2_tls? "tls" : ""
-					], JSON_PRETTY_PRINT));
-
-				// 生成文本配置信息
-				$node->txt =
-					"服务器:".$node->server? : $node->ip."\r\n".
-					$node->ipv6? "IPv6:".$node->ipv6."\r\n" : ''.
-						"端口:".$node->v2_port."\r\n".
-						"加密方式:".$node->v2_method."\r\n".
-						"用户ID:".$user->vmess_id."\r\n".
-						"额外ID:".$node->v2_alter_id."\r\n".
-						"传输协议:".$node->v2_net."\r\n".
-						"伪装类型:".$node->v2_type."\r\n".
-						($node->v2_host? "伪装域名:".$node->v2_host."\r\n" : "").
-						($node->v2_path? "路径:".$node->v2_path."\r\n" : "").
-						($node->v2_tls == 1? "TLS:tls\r\n" : "");
-			}
-		}
+			$node = SsNode::query()->whereKey($node_id)->first();
+			$proxyType = $node->type == 1? ($node->compatible? 'SS' : 'SSR') : 'V2Ray';
+			$data = $this->getNodeInfo($id, $node->id, $infoType != 'text'? 0 : 1);
 
-		$view['nodeList'] = $nodeList;
-		$view['user'] = $user;
+			return Response::json(['status' => 'success', 'data' => $data, 'title' => $proxyType]);
+
+		}else{
+			$view['nodeList'] = SsNode::query()->whereStatus(1)->orderBy('sort', 'desc')->orderBy('id', 'asc')->paginate(15)->appends($request->except('page'));
+			$view['user'] = $user;
+		}
 
 		return Response::view('admin.export', $view);
 	}
 
 	// 导出原版SS用户配置信息
-	public function exportSSJson(Request $request)
+	public function exportSSJson()
 	{
 		$userList = User::query()->where('port', '>', 0)->get();
 		$defaultMethod = Helpers::getDefaultMethod();
@@ -1463,7 +1443,7 @@ EOF;
 	}
 
 	// 用户流量监控
-	public function userMonitor(Request $request, $id)
+	public function userMonitor($id)
 	{
 		if(empty($id)){
 			return Redirect::to('admin/userList');
@@ -1490,7 +1470,7 @@ EOF;
 		}
 
 		// 节点一天内的流量
-		$userTrafficHourly = UserTrafficHourly::query()->where('user_id', $user->id)->where('node_id', 0)->where('created_at', '>=', date('Y-m-d', time()))->orderBy('created_at', 'asc')->pluck('total')->toArray();
+		$userTrafficHourly = UserTrafficHourly::query()->whereUserId($user->id)->whereNodeId(0)->where('created_at', '>=', date('Y-m-d', time()))->orderBy('created_at', 'asc')->pluck('total')->toArray();
 		$hourlyTotal = date('H');
 		$hourlyCount = count($userTrafficHourly);
 		for($x = 0; $x < $hourlyTotal-$hourlyCount; $x++){
@@ -1521,11 +1501,9 @@ EOF;
 	}
 
 	// 生成端口
-	public function makePort(Request $request)
+	public function makePort()
 	{
-		$new_port = self::$systemConfig['is_rand_port']? Helpers::getRandPort() : Helpers::getOnlyPort();
-		echo $new_port;
-		exit;
+		return self::$systemConfig['is_rand_port']? Helpers::getRandPort() : Helpers::getOnlyPort();
 	}
 
 	// 加密方式、混淆、协议、等级、国家地区
@@ -1666,7 +1644,7 @@ EOF;
 	}
 
 	// 日志分析
-	public function analysis(Request $request)
+	public function analysis()
 	{
 		$file = storage_path('app/ssserver.log');
 		if(!file_exists($file)){
@@ -1799,8 +1777,12 @@ EOF;
 		if(!$existUsers->isEmpty()){
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => '该等级下存在关联账号,请先取消关联']);
 		}
-
-		$ret = Level::query()->where('id', $id)->delete();
+		$ret = FALSE;
+		try{
+			$ret = Level::query()->where('id', $id)->delete();
+		} catch(Exception $e){
+			Log::error('删除等级时报错:'.$e);
+		}
 		if($ret){
 			return Response::json(['status' => 'success', 'data' => '', 'message' => '操作成功']);
 		}else{
@@ -1896,8 +1878,12 @@ EOF;
 		if(!$existNode->isEmpty()){
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => '该国家/地区下存在关联节点,请先取消关联']);
 		}
-
-		$ret = Country::query()->where('id', $id)->delete();
+		$ret = FALSE;
+		try{
+			$ret = Country::query()->where('id', $id)->delete();
+		} catch(Exception $e){
+			Log::error('删除国家/地区时报错:'.$e);
+		}
 		if($ret){
 			return Response::json(['status' => 'success', 'data' => '', 'message' => '操作成功']);
 		}else{
@@ -1906,7 +1892,7 @@ EOF;
 	}
 
 	// 系统设置
-	public function system(Request $request)
+	public function system()
 	{
 		$view = Helpers::systemConfig();
 		$view['label_list'] = Label::query()->orderBy('sort', 'desc')->orderBy('id', 'asc')->get();
@@ -1917,7 +1903,7 @@ EOF;
 	// 设置某个配置项
 	public function setConfig(Request $request)
 	{
-		$name = trim($request->input('name'));
+		$name = $request->input('name');
 		$value = trim($request->input('value'));
 
 		if(!$name){
@@ -1987,7 +1973,7 @@ EOF;
 	}
 
 	// 生成邀请码
-	public function makeInvite(Request $request)
+	public function makeInvite()
 	{
 		for($i = 0; $i < 10; $i++){
 			$obj = new Invite();
@@ -2003,7 +1989,7 @@ EOF;
 	}
 
 	// 导出邀请码
-	public function exportInvite(Request $request)
+	public function exportInvite()
 	{
 		$inviteList = Invite::query()->where('status', 0)->orderBy('id', 'asc')->get();
 
@@ -2012,21 +1998,25 @@ EOF;
 		$spreadsheet = new Spreadsheet();
 		$spreadsheet->getProperties()->setCreator('SSRPanel')->setLastModifiedBy('SSRPanel')->setTitle('邀请码')->setSubject('邀请码')->setDescription('')->setKeywords('')->setCategory('');
 
-		$spreadsheet->setActiveSheetIndex(0);
-		$sheet = $spreadsheet->getActiveSheet();
-		$sheet->setTitle('邀请码');
-		$sheet->fromArray(['邀请码', '有效期'], NULL);
+		try{
+			$spreadsheet->setActiveSheetIndex(0);
+			$sheet = $spreadsheet->getActiveSheet();
+			$sheet->setTitle('邀请码');
+			$sheet->fromArray(['邀请码', '有效期'], NULL);
 
-		foreach($inviteList as $k => $vo){
-			$sheet->fromArray([$vo->code, $vo->dateline], NULL, 'A'.($k+2));
-		}
+			foreach($inviteList as $k => $vo){
+				$sheet->fromArray([$vo->code, $vo->dateline], NULL, 'A'.($k+2));
+			}
 
-		header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // 输出07Excel文件
-		//header('Content-Type:application/vnd.ms-excel'); // 输出Excel03版本文件
-		header('Content-Disposition: attachment;filename="'.$filename.'"');
-		header('Cache-Control: max-age=0');
-		$writer = new Xlsx($spreadsheet);
-		$writer->save('php://output');
+			header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // 输出07Excel文件
+			//header('Content-Type:application/vnd.ms-excel'); // 输出Excel03版本文件
+			header('Content-Disposition: attachment;filename="'.$filename.'"');
+			header('Cache-Control: max-age=0');
+			$writer = new Xlsx($spreadsheet);
+			$writer->save('php://output');
+		} catch(\PhpOffice\PhpSpreadsheet\Exception $e){
+			Log::error('导出优惠券时报错'.$e);
+		}
 	}
 
 	// 提现申请列表
@@ -2497,36 +2487,4 @@ EOF;
 
 		return Response::view('admin.onlineIPMonitor', $view);
 	}
-
-	// 生成用户标签
-	private function makeUserLabels($userId, $labels)
-	{
-		// 先删除该用户所有的标签
-		UserLabel::query()->where('user_id', $userId)->delete();
-
-		if(!empty($labels) && is_array($labels)){
-			foreach($labels as $label){
-				$userLabel = new UserLabel();
-				$userLabel->user_id = $userId;
-				$userLabel->label_id = $label;
-				$userLabel->save();
-			}
-		}
-	}
-
-	// 生成节点标签
-	private function makeNodeLabels($nodeId, $labels)
-	{
-		// 先删除所有该节点的标签
-		SsNodeLabel::query()->where('node_id', $nodeId)->delete();
-
-		if(!empty($labels) && is_array($labels)){
-			foreach($labels as $label){
-				$ssNodeLabel = new SsNodeLabel();
-				$ssNodeLabel->node_id = $nodeId;
-				$ssNodeLabel->label_id = $label;
-				$ssNodeLabel->save();
-			}
-		}
-	}
 }

+ 0 - 7
app/Http/Controllers/Api/AlipayController.php

@@ -8,13 +8,6 @@ use App\Http\Controllers\Controller;
 use Illuminate\Http\Request;
 use Log;
 
-/**
- * Class AlipayController
- *
- * @author  wz812180
- *
- * @package App\Http\Controllers\Api
- */
 class AlipayController extends Controller
 {
 	use Callback;

+ 1 - 7
app/Http/Controllers/Api/F2fpayController.php

@@ -9,16 +9,10 @@ use Log;
 use Payment\Client\Query;
 use Payment\Common\PayException;
 
-/**
- * Class F2fpayController
- *
- * @author  heron
- *
- * @package App\Http\Controllers\Api
- */
 class F2fpayController extends Controller
 {
 	use Callback;
+
 	// 接收GET请求
 	public function index(Request $request)
 	{

+ 1 - 13
app/Http/Controllers/Api/LoginController.php

@@ -7,7 +7,6 @@ use App\Http\Controllers\Controller;
 use App\Http\Models\User;
 use App\Http\Models\UserLabel;
 use App\Http\Models\UserSubscribe;
-use App\Http\Models\UserSubscribeLog;
 use Cache;
 use DB;
 use Exception;
@@ -50,7 +49,7 @@ class LoginController extends Controller
 				return Response::json(['status' => 'fail', 'data' => [], 'message' => '请求失败超限,禁止访问1小时']);
 			}
 		}else{
-			Cache::put($cacheKey, 1, 60);
+			Cache::put($cacheKey, 1, 3600);
 		}
 
 		$user = User::query()->where('username', $username)->where('status', '>=', 0)->first();
@@ -137,15 +136,4 @@ class LoginController extends Controller
 			return Response::json(['status' => 'success', 'data' => [], 'message' => '登录失败']);
 		}
 	}
-
-	// 写入订阅访问日志
-	private function log($subscribeId, $ip, $headers)
-	{
-		$log = new UserSubscribeLog();
-		$log->sid = $subscribeId;
-		$log->request_ip = $ip;
-		$log->request_time = date('Y-m-d H:i:s');
-		$log->request_header = $headers;
-		$log->save();
-	}
 }

+ 241 - 240
app/Http/Controllers/AuthController.php

@@ -57,10 +57,15 @@ class AuthController extends Controller
 				'password.required' => trans('auth.password_null')
 			]);
 
+			$username = $request->input('username');
+			$captcha = $request->input('captcha');
+			$password = $request->input('password');
+			$remember = $request->input('remember');
+
 			// 是否校验验证码
 			switch(self::$systemConfig['is_captcha']){
 				case 1: // 默认图形验证码
-					if(!Captcha::check($request->captcha)){
+					if(!Captcha::check($captcha)){
 						return Redirect::back()->withInput()->withErrors(trans('auth.captcha_error'));
 					}
 					break;
@@ -89,7 +94,7 @@ class AuthController extends Controller
 			}
 
 			// 验证账号并创建会话
-			if(!Auth::attempt(['username' => $request->username, 'password' => $request->password], $request->remember)){
+			if(!Auth::attempt(['username' => $username, 'password' => $password], $remember)){
 				return Redirect::back()->withInput()->withErrors(trans('auth.login_error'));
 			}
 
@@ -98,13 +103,11 @@ class AuthController extends Controller
 				if(Auth::user()->status < 0){
 					Auth::logout(); // 强制销毁会话,因为Auth::attempt的时候会产生会话
 
-					return Redirect::back()->withInput()->withErrors(trans('auth.login_ban', ['email' => self::$systemConfig['admin_email']]));
-				}
-
-				if(Auth::user()->status == 0 && self::$systemConfig['is_active_register']){
+					return Redirect::back()->withInput()->withErrors(trans('auth.login_ban', ['email' => self::$systemConfig['webmaster_email']]));
+				}elseif(Auth::user()->status == 0 && (self::$systemConfig['is_active_register'] || self::$systemConfig['is_verify_register'])){
 					Auth::logout(); // 强制销毁会话,因为Auth::attempt的时候会产生会话
 
-					return Redirect::back()->withInput()->withErrors(trans('auth.active_tip').'<a href="/activeUser?username='.$request->username.'" target="_blank"><span style="color:#000">【'.trans('auth.active_account').'】</span></a>');
+					return Redirect::back()->withInput()->withErrors(trans('auth.active_tip').'<a href="/activeUser?username='.$username.'" target="_blank"><span style="color:#000">【'.trans('auth.active_account').'】</span></a>');
 				}
 			}
 
@@ -133,8 +136,56 @@ class AuthController extends Controller
 		}
 	}
 
+	/**
+	 * 添加用户登录日志
+	 *
+	 * @param string $userId 用户ID
+	 * @param string $ip     IP地址
+	 */
+	private function addUserLoginLog($userId, $ip)
+	{
+		if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)){
+			Log::info('识别到IPv6,尝试解析:'.$ip);
+			$ipInfo = getIPv6($ip);
+		}else{
+			$ipInfo = QQWry::ip($ip); // 通过纯真IP库解析IPv4信息
+			if(isset($ipInfo['error'])){
+				Log::info('无法识别IPv4,尝试使用IPIP的IP库解析:'.$ip);
+				$ipip = IPIP::ip($ip);
+				$ipInfo = [
+					'country'  => $ipip['country_name'],
+					'province' => $ipip['region_name'],
+					'city'     => $ipip['city_name']
+				];
+			}else{
+				// 判断纯真IP库获取的国家信息是否与IPIP的IP库获取的信息一致,不一致则用IPIP的(因为纯真IP库的非大陆IP准确率较低)
+				$ipip = IPIP::ip($ip);
+				if($ipInfo['country'] != $ipip['country_name']){
+					$ipInfo['country'] = $ipip['country_name'];
+					$ipInfo['province'] = $ipip['region_name'];
+					$ipInfo['city'] = $ipip['city_name'];
+				}
+			}
+		}
+
+		if(empty($ipInfo) || empty($ipInfo['country'])){
+			Log::warning("获取IP信息异常:".$ip);
+		}
+
+		$log = new UserLoginLog();
+		$log->user_id = $userId;
+		$log->ip = $ip;
+		$log->country = $ipInfo['country'] ?? '';
+		$log->province = $ipInfo['province'] ?? '';
+		$log->city = $ipInfo['city'] ?? '';
+		$log->county = $ipInfo['county'] ?? '';
+		$log->isp = $ipInfo['isp'] ?? ($ipInfo['organization'] ?? '');
+		$log->area = $ipInfo['area'] ?? '';
+		$log->save();
+	}
+
 	// 退出
-	public function logout(Request $request)
+	public function logout()
 	{
 		Auth::logout();
 
@@ -148,23 +199,31 @@ class AuthController extends Controller
 
 		if($request->isMethod('POST')){
 			$this->validate($request, [
-				'username'   => 'required|email|unique:user',
-				'password'   => 'required|min:6',
-				'repassword' => 'required|same:password',
-				'term'       => 'accepted'
+				'username'        => 'required|email|unique:user',
+				'password'        => 'required|min:6',
+				'confirmPassword' => 'required|same:password',
+				'term'            => 'accepted'
 			], [
-				'username.required'   => trans('auth.email_null'),
-				'username.email'      => trans('auth.email_legitimate'),
-				'username.unique'     => trans('auth.email_exist'),
-				'password.required'   => trans('auth.password_null'),
-				'password.min'        => trans('auth.password_limit'),
-				'repassword.required' => trans('auth.retype_password'),
-				'repassword.same'     => trans('auth.password_same'),
-				'term.accepted'       => trans('auth.unaccepted')
+				'username.required'        => trans('auth.email_null'),
+				'username.email'           => trans('auth.email_legitimate'),
+				'username.unique'          => trans('auth.email_exist'),
+				'password.required'        => trans('auth.password_null'),
+				'password.min'             => trans('auth.password_limit'),
+				'confirmPassword.required' => trans('auth.confirm_password'),
+				'confirmPassword.same'     => trans('auth.password_same'),
+				'term.accepted'            => trans('auth.unaccepted')
 			]);
 
+			$username = $request->input('username');
+			$password = $request->input('password');
+			$register_token = $request->input('register_token');
+			$code = $request->input('code');
+			$verify_code = $request->input('verify_code');
+			$captcha = $request->input('captcha');
+			$aff = intval($request->input('aff'));
+
 			// 防止重复提交
-			if($request->register_token != Session::get('register_token')){
+			if($register_token != Session::get('register_token')){
 				return Redirect::back()->withInput()->withErrors(trans('auth.repeat_request'));
 			}else{
 				Session::forget('register_token');
@@ -179,13 +238,13 @@ class AuthController extends Controller
 			if(self::$systemConfig['sensitiveType']){
 				// 校验域名邮箱是否在黑名单中
 				$sensitiveWords = $this->sensitiveWords(1);
-				$usernameSuffix = explode('@', $request->username); // 提取邮箱后缀
+				$usernameSuffix = explode('@', $username); // 提取邮箱后缀
 				if(in_array(strtolower($usernameSuffix[1]), $sensitiveWords)){
 					return Redirect::back()->withInput()->withErrors(trans('auth.email_banned'));
 				}
 			}else{
 				$sensitiveWords = $this->sensitiveWords(2);
-				$usernameSuffix = explode('@', $request->username); // 提取邮箱后缀
+				$usernameSuffix = explode('@', $username); // 提取邮箱后缀
 				if(!in_array(strtolower($usernameSuffix[1]), $sensitiveWords)){
 					return Redirect::back()->withInput()->withErrors(trans('auth.email_invalid'));
 				}
@@ -194,14 +253,14 @@ class AuthController extends Controller
 			// 如果需要邀请注册
 			if(self::$systemConfig['is_invite_register']){
 				// 必须使用邀请码
-				if(self::$systemConfig['is_invite_register'] == 2 && !$request->code){
+				if(self::$systemConfig['is_invite_register'] == 2 && !$code){
 					return Redirect::back()->withInput()->withErrors(trans('auth.code_null'));
 				}
 
 				// 校验邀请码合法性
-				if($request->code){
-					$codeEnable = Invite::query()->where('code', $request->code)->where('status', 0)->first();
-					if(!$codeEnable){
+				if($code){
+					$codeEnable = Invite::query()->where('code', $code)->where('status', 0)->doesntExist();
+					if($codeEnable){
 						return Redirect::back()->withInput($request->except(['code']))->withErrors(trans('auth.code_error'));
 					}
 				}
@@ -209,10 +268,10 @@ class AuthController extends Controller
 
 			// 如果开启注册发送验证码
 			if(self::$systemConfig['is_verify_register']){
-				if(!$request->verify_code){
+				if(!$verify_code){
 					return Redirect::back()->withInput($request->except(['verify_code']))->withErrors(trans('auth.captcha_null'));
 				}else{
-					$verifyCode = VerifyCode::query()->where('username', $request->username)->where('code', $request->verify_code)->where('status', 0)->first();
+					$verifyCode = VerifyCode::query()->where('username', $username)->where('code', $verify_code)->where('status', 0)->first();
 					if(!$verifyCode){
 						return Redirect::back()->withInput($request->except(['verify_code']))->withErrors(trans('auth.captcha_overtime'));
 					}
@@ -220,36 +279,37 @@ class AuthController extends Controller
 					$verifyCode->status = 1;
 					$verifyCode->save();
 				}
-			}elseif(self::$systemConfig['is_captcha']){ // 是否校验验证码
-				switch(self::$systemConfig['is_captcha']){
-					case 1: // 默认图形验证码
-						if(!Captcha::check($request->captcha)){
-							return Redirect::back()->withInput()->withErrors(trans('auth.captcha_error'));
-						}
-						break;
-					case 2: // Geetest
-						$result = $this->validate($request, [
-							'geetest_challenge' => 'required|geetest'
-						], [
-							'geetest' => trans('auth.captcha_fail')
-						]);
-
-						if(!$result){
-							return Redirect::back()->withInput()->withErrors(trans('auth.captcha_fail'));
-						}
-						break;
-					case 3: // Google reCAPTCHA
-						$result = $this->validate($request, [
-							'g-recaptcha-response' => 'required|NoCaptcha'
-						]);
-
-						if(!$result){
-							return Redirect::back()->withInput()->withErrors(trans('auth.captcha_fail'));
-						}
-						break;
-					default: // 不启用验证码
-						break;
-				}
+			}
+
+			// 是否校验验证码
+			switch(self::$systemConfig['is_captcha']){
+				case 1: // 默认图形验证码
+					if(!Captcha::check($captcha)){
+						return Redirect::back()->withInput()->withErrors(trans('auth.captcha_error'));
+					}
+					break;
+				case 2: // Geetest
+					$result = $this->validate($request, [
+						'geetest_challenge' => 'required|geetest'
+					], [
+						'geetest' => trans('auth.captcha_fail')
+					]);
+
+					if(!$result){
+						return Redirect::back()->withInput()->withErrors(trans('auth.captcha_fail'));
+					}
+					break;
+				case 3: // Google reCAPTCHA
+					$result = $this->validate($request, [
+						'g-recaptcha-response' => 'required|NoCaptcha'
+					]);
+
+					if(!$result){
+						return Redirect::back()->withInput()->withErrors(trans('auth.captcha_fail'));
+					}
+					break;
+				default: // 不启用验证码
+					break;
 			}
 
 			// 24小时内同IP注册限制
@@ -269,13 +329,13 @@ class AuthController extends Controller
 			}
 
 			// 获取aff
-			$affArr = $this->getAff($request->code, intval($request->aff));
+			$affArr = $this->getAff($code, $aff);
 			$referral_uid = $affArr['referral_uid'];
 
-			$transfer_enable = $referral_uid? (self::$systemConfig['default_traffic']+self::$systemConfig['referral_traffic'])*1048576 : self::$systemConfig['default_traffic']*1048576;
+			$transfer_enable = 1048576*(self::$systemConfig['default_traffic']+($referral_uid? self::$systemConfig['referral_traffic'] : 0));
 
 			// 创建新用户
-			$uid = Helpers::addUser($request->username, Hash::make($request->password), $transfer_enable, self::$systemConfig['default_days'], $referral_uid);
+			$uid = Helpers::addUser($username, Hash::make($password), $transfer_enable, self::$systemConfig['default_days'], $referral_uid);
 
 			// 注册失败,抛出异常
 			if(!$uid){
@@ -293,7 +353,7 @@ class AuthController extends Controller
 			if(Cache::has($cacheKey)){
 				Cache::increment($cacheKey);
 			}else{
-				Cache::put($cacheKey, 1, 1440); // 24小时
+				Cache::put($cacheKey, 1, 86400); // 24小时
 			}
 
 			// 初始化默认标签
@@ -315,30 +375,26 @@ class AuthController extends Controller
 			// 清除邀请人Cookie
 			Cookie::unqueue('register_aff');
 
-
-			// 发送激活邮件
+			// 邮箱验证码关闭情况下,发送激活邮件
 			if(!self::$systemConfig['is_verify_register'] && self::$systemConfig['is_active_register']){
 				// 生成激活账号的地址
-				$token = md5(self::$systemConfig['website_name'].$request->username.microtime());
+				$token = $this->addVerifyUrl($uid, $username);
 				$activeUserUrl = self::$systemConfig['website_url'].'/active/'.$token;
-				$this->addVerify($uid, $token);
 
-				$logId = Helpers::addEmailLog($request->username, '注册激活', '请求地址:'.$activeUserUrl);
-				Mail::to($request->username)->send(new activeUser($logId, $activeUserUrl));
+				$logId = Helpers::addEmailLog($username, '注册激活', '请求地址:'.$activeUserUrl);
+				Mail::to($username)->send(new activeUser($logId, $activeUserUrl));
 
-				Session::flash('regSuccessMsg', trans('auth.register_success_tip'));
+				Session::flash('regSuccessMsg', trans('auth.register_active_tip'));
 			}else{
 				// 则直接给推荐人加流量
 				if($referral_uid){
-					$transfer_enable = self::$systemConfig['referral_traffic']*1048576;
 					$referralUser = User::query()->where('id', $referral_uid)->first();
 					if($referralUser){
 						if($referralUser->expire_time >= date('Y-m-d')){
-							User::query()->where('id', $referral_uid)->increment('transfer_enable', $transfer_enable);
+							User::query()->where('id', $referral_uid)->increment('transfer_enable', self::$systemConfig['referral_traffic']*1048576);
 						}
 					}
 				}
-
 				User::query()->where('id', $uid)->update(['status' => 1, 'enable' => 1]);
 
 				Session::flash('regSuccessMsg', trans('auth.register_success'));
@@ -353,6 +409,64 @@ class AuthController extends Controller
 		}
 	}
 
+	/**
+	 * 获取AFF
+	 *
+	 * @param string $code 邀请码
+	 * @param int    $aff  URL中的aff参数
+	 *
+	 * @return array
+	 */
+	private function getAff($code = '', $aff = NULL)
+	{
+		// 邀请人ID
+		$referral_uid = 0;
+
+		// 邀请码ID
+		$code_id = 0;
+
+		// 有邀请码先用邀请码,用谁的邀请码就给谁返利
+		if($code){
+			$inviteCode = Invite::query()->where('code', $code)->where('status', 0)->first();
+			if($inviteCode){
+				$referral_uid = $inviteCode->uid;
+				$code_id = $inviteCode->id;
+			}
+		}
+
+		// 没有用邀请码或者邀请码是管理员生成的,则检查cookie或者url链接
+		if(!$referral_uid){
+			// 检查一下cookie里有没有aff
+			$cookieAff = \Request::hasCookie('register_aff')? \Request::cookie('register_aff') : 0;
+			if($cookieAff){
+				$affUser = User::query()->where('id', $cookieAff)->exists();
+				$referral_uid = $affUser? $cookieAff : 0;
+			}elseif($aff){ // 如果cookie里没有aff,就再检查一下请求的url里有没有aff,因为有些人的浏览器会禁用了cookie,比如chrome开了隐私模式
+				$affUser = User::query()->where('id', $aff)->exists();
+				$referral_uid = $affUser? $aff : 0;
+			}
+		}
+
+		return [
+			'referral_uid' => $referral_uid,
+			'code_id'      => $code_id
+		];
+	}
+
+	// 生成申请的请求地址
+	private function addVerifyUrl($uid, $username)
+	{
+		$token = md5(self::$systemConfig['website_name'].$username.microtime());
+		$verify = new Verify();
+		$verify->type = 1;
+		$verify->user_id = $uid;
+		$verify->token = $token;
+		$verify->status = 0;
+		$verify->save();
+
+		return $token;
+	}
+
 	// 重设密码页
 	public function resetPassword(Request $request)
 	{
@@ -365,36 +479,38 @@ class AuthController extends Controller
 				'username.email'    => trans('auth.email_legitimate')
 			]);
 
+			$username = $request->input('username');
+
 			// 是否开启重设密码
 			if(!self::$systemConfig['is_reset_password']){
-				return Redirect::back()->withErrors(trans('auth.reset_password_close', ['email' => self::$systemConfig['admin_email']]));
+				return Redirect::back()->withErrors(trans('auth.reset_password_close', ['email' => self::$systemConfig['webmaster_email']]));
 			}
 
 			// 查找账号
-			$user = User::query()->where('username', $request->username)->first();
+			$user = User::query()->where('username', $username)->first();
 			if(!$user){
 				return Redirect::back()->withErrors(trans('auth.email_notExist'));
 			}
 
 			// 24小时内重设密码次数限制
 			$resetTimes = 0;
-			if(Cache::has('resetPassword_'.md5($request->username))){
-				$resetTimes = Cache::get('resetPassword_'.md5($request->username));
+			if(Cache::has('resetPassword_'.md5($username))){
+				$resetTimes = Cache::get('resetPassword_'.md5($username));
 				if($resetTimes >= self::$systemConfig['reset_password_times']){
 					return Redirect::back()->withErrors(trans('auth.reset_password_limit', ['time' => self::$systemConfig['reset_password_times']]));
 				}
 			}
 
 			// 生成取回密码的地址
-			$token = $this->addVerifyUrl($user->id, $request->username);
+			$token = $this->addVerifyUrl($user->id, $username);
 
 			// 发送邮件
 			$resetPasswordUrl = self::$systemConfig['website_url'].'/reset/'.$token;
 
-			$logId = Helpers::addEmailLog($request->username, '重置密码', '请求地址:'.$resetPasswordUrl);
-			Mail::to($request->username)->send(new resetPassword($logId, $resetPasswordUrl));
+			$logId = Helpers::addEmailLog($username, '重置密码', '请求地址:'.$resetPasswordUrl);
+			Mail::to($username)->send(new resetPassword($logId, $resetPasswordUrl));
 
-			Cache::put('resetPassword_'.md5($request->username), $resetTimes+1, 1440);
+			Cache::put('resetPassword_'.md5($username), $resetTimes+1, 86400);
 
 			return Redirect::back()->with('successMsg', trans('auth.reset_password_success_tip'));
 		}else{
@@ -411,16 +527,16 @@ class AuthController extends Controller
 
 		if($request->isMethod('POST')){
 			$this->validate($request, [
-				'password'   => 'required|min:6',
-				'repassword' => 'required|same:password'
+				'password'        => 'required|min:6',
+				'confirmPassword' => 'required|same:password'
 			], [
-				'password.required'   => trans('auth.password_null'),
-				'password.min'        => trans('auth.password_limit'),
-				'repassword.required' => trans('auth.password_null'),
-				'repassword.min'      => trans('auth.password_limit'),
-				'repassword.same'     => trans('auth.password_same'),
+				'password.required'        => trans('auth.password_null'),
+				'password.min'             => trans('auth.password_limit'),
+				'confirmPassword.required' => trans('auth.password_null'),
+				'confirmPassword.min'      => trans('auth.password_limit'),
+				'confirmPassword.same'     => trans('auth.password_same'),
 			]);
-
+			$password = $request->input('password');
 			// 校验账号
 			$verify = Verify::type(1)->with('user')->where('token', $token)->first();
 			if(!$verify){
@@ -429,12 +545,12 @@ class AuthController extends Controller
 				return Redirect::back()->withErrors(trans('auth.overtime'));
 			}elseif($verify->user->status < 0){
 				return Redirect::back()->withErrors(trans('auth.email_banned'));
-			}elseif(Hash::check($request->password, $verify->user->password)){
+			}elseif(Hash::check($password, $verify->user->password)){
 				return Redirect::back()->withErrors(trans('auth.reset_password_same_fail'));
 			}
 
 			// 更新密码
-			$ret = User::query()->where('id', $verify->user_id)->update(['password' => Hash::make($request->password)]);
+			$ret = User::query()->where('id', $verify->user_id)->update(['password' => Hash::make($password)]);
 			if(!$ret){
 				return Redirect::back()->withErrors(trans('auth.reset_password_fail'));
 			}
@@ -472,48 +588,49 @@ class AuthController extends Controller
 				'username.email'    => trans('auth.email_legitimate'),
 				'username.exists'   => trans('auth.email_notExist')
 			]);
+			$username = $request->input('username');
 
 			// 是否开启账号激活
 			if(!self::$systemConfig['is_active_register']){
-				return Redirect::back()->withInput()->withErrors(trans('auth.active_close', ['email' => self::$systemConfig['admin_email']]));
+				return Redirect::back()->withInput()->withErrors(trans('auth.active_close', ['email' => self::$systemConfig['webmaster_email']]));
 			}
 
 			// 查找账号
-			$user = User::query()->where('username', $request->username)->first();
+			$user = User::query()->where('username', $username)->first();
 			if($user->status < 0){
-				return Redirect::back()->withErrors(trans('auth.login_ban', ['email' => self::$systemConfig['admin_email']]));
+				return Redirect::back()->withErrors(trans('auth.login_ban', ['email' => self::$systemConfig['webmaster_email']]));
 			}elseif($user->status > 0){
 				return Redirect::back()->withErrors(trans('auth.email_normal'));
 			}
 
 			// 24小时内激活次数限制
 			$activeTimes = 0;
-			if(Cache::has('activeUser_'.md5($request->username))){
-				$activeTimes = Cache::get('activeUser_'.md5($request->username));
+			if(Cache::has('activeUser_'.md5($username))){
+				$activeTimes = Cache::get('activeUser_'.md5($username));
 				if($activeTimes >= self::$systemConfig['active_times']){
-					return Redirect::back()->withErrors(trans('auth.active_limit', ['time' => self::$systemConfig['admin_email']]));
+					return Redirect::back()->withErrors(trans('auth.active_limit', ['time' => self::$systemConfig['webmaster_email']]));
 				}
 			}
 
 			// 生成激活账号的地址
-			$token = $this->addVerifyUrl($user->id, $request->username);
+			$token = $this->addVerifyUrl($user->id, $username);
 
 			// 发送邮件
 			$activeUserUrl = self::$systemConfig['website_url'].'/active/'.$token;
 
-			$logId = Helpers::addEmailLog($request->username, '激活账号', '请求地址:'.$activeUserUrl);
-			Mail::to($request->username)->send(new activeUser($logId, $activeUserUrl));
+			$logId = Helpers::addEmailLog($username, '激活账号', '请求地址:'.$activeUserUrl);
+			Mail::to($username)->send(new activeUser($logId, $activeUserUrl));
 
-			Cache::put('activeUser_'.md5($request->username), $activeTimes+1, 1440);
+			Cache::put('activeUser_'.md5($username), $activeTimes+1, 86400);
 
-			return Redirect::back()->with('successMsg', trans('auth.register_success_tip'));
+			return Redirect::back()->with('successMsg', trans('auth.register_active_tip'));
 		}else{
 			return Response::view('auth.activeUser');
 		}
 	}
 
 	// 激活账号
-	public function active(Request $request, $token)
+	public function active($token)
 	{
 		if(!$token){
 			return Redirect::to('login');
@@ -560,8 +677,7 @@ class AuthController extends Controller
 		if($verify->user->referral_uid){
 			$transfer_enable = self::$systemConfig['referral_traffic']*1048576;
 
-			User::query()->where('id', $verify->user->referral_uid)->increment('transfer_enable', $transfer_enable);
-			User::query()->where('id', $verify->user->referral_uid)->update(['enable' => 1]);
+			User::query()->where('id', $verify->user->referral_uid)->increment('transfer_enable', $transfer_enable, ['enable' => 1]);
 		}
 
 		Session::flash('successMsg', trans('auth.active_success'));
@@ -580,6 +696,8 @@ class AuthController extends Controller
 			'username.unique'   => trans('auth.email_exist')
 		]);
 
+		$username = $request->input('username');
+
 		if($validator->fails()){
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => $validator->getMessageBag()->first()]);
 		}
@@ -588,13 +706,13 @@ class AuthController extends Controller
 		if(self::$systemConfig['sensitiveType']){
 			// 校验域名邮箱是否在黑名单中
 			$sensitiveWords = $this->sensitiveWords(1);
-			$usernameSuffix = explode('@', $request->username); // 提取邮箱后缀
+			$usernameSuffix = explode('@', $username); // 提取邮箱后缀
 			if(in_array(strtolower($usernameSuffix[1]), $sensitiveWords)){
 				return Response::json(['status' => 'fail', 'data' => '', 'message' => trans('auth.email_banned')]);
 			}
 		}else{
 			$sensitiveWords = $this->sensitiveWords(2);
-			$usernameSuffix = explode('@', $request->username); // 提取邮箱后缀
+			$usernameSuffix = explode('@', $username); // 提取邮箱后缀
 			if(!in_array(strtolower($usernameSuffix[1]), $sensitiveWords)){
 				return Response::json(['status' => 'fail', 'data' => '', 'message' => trans('auth.email_invalid')]);
 			}
@@ -612,135 +730,16 @@ class AuthController extends Controller
 
 		// 发送邮件
 		$code = makeRandStr(6, TRUE);
-		$logId = Helpers::addEmailLog($request->username, '发送注册验证码', '验证码:'.$code);
-		Mail::to($request->username)->send(new sendVerifyCode($logId, $code));
+		$logId = Helpers::addEmailLog($username, '发送注册验证码', '验证码:'.$code);
+		Mail::to($username)->send(new sendVerifyCode($logId, $code));
 
-		$this->addVerifyCode($request->username, $code);
+		$this->addVerifyCode($username, $code);
 
-		Cache::put('send_verify_code_'.md5(getClientIP()), getClientIP(), 1);
+		Cache::put('send_verify_code_'.md5(getClientIP()), getClientIP(), 60);
 
 		return Response::json(['status' => 'success', 'data' => '', 'message' => trans('auth.captcha_send')]);
 	}
 
-	// 公开的邀请码列表
-	public function free(Request $request)
-	{
-		$view['inviteList'] = Invite::query()->where('uid', 0)->where('status', 0)->paginate();
-
-		return Response::view('auth.free', $view);
-	}
-
-	// 切换语言
-	public function switchLang(Request $request, $locale)
-	{
-		Session::put("locale", $locale);
-
-		return Redirect::back();
-	}
-
-	/**
-	 * 添加用户登录日志
-	 *
-	 * @param string $userId 用户ID
-	 * @param string $ip     IP地址
-	 */
-	private function addUserLoginLog($userId, $ip)
-	{
-		if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)){
-			Log::info('识别到IPv6,尝试解析:'.$ip);
-			$ipInfo = getIPv6($ip);
-		}else{
-			$ipInfo = QQWry::ip($ip); // 通过纯真IP库解析IPv4信息
-			if(isset($ipInfo['error'])){
-				Log::info('无法识别IPv4,尝试使用IPIP的IP库解析:'.$ip);
-				$ipip = IPIP::ip($ip);
-				$ipInfo = [
-					'country'  => $ipip['country_name'],
-					'province' => $ipip['region_name'],
-					'city'     => $ipip['city_name']
-				];
-			}else{
-				// 判断纯真IP库获取的国家信息是否与IPIP的IP库获取的信息一致,不一致则用IPIP的(因为纯真IP库的非大陆IP准确率较低)
-				$ipip = IPIP::ip($ip);
-				if($ipInfo['country'] != $ipip['country_name']){
-					$ipInfo['country'] = $ipip['country_name'];
-					$ipInfo['province'] = $ipip['region_name'];
-					$ipInfo['city'] = $ipip['city_name'];
-				}
-			}
-		}
-
-		if(empty($ipInfo) || empty($ipInfo['country'])){
-			Log::warning("获取IP信息异常:".$ip);
-		}
-
-		$log = new UserLoginLog();
-		$log->user_id = $userId;
-		$log->ip = $ip;
-		$log->country = $ipInfo['country'] ?? '';
-		$log->province = $ipInfo['province'] ?? '';
-		$log->city = $ipInfo['city'] ?? '';
-		$log->county = $ipInfo['county'] ?? '';
-		$log->isp = $ipInfo['isp'] ?? ($ipInfo['organization'] ?? '');
-		$log->area = $ipInfo['area'] ?? '';
-		$log->save();
-	}
-
-	/**
-	 * 获取AFF
-	 *
-	 * @param string $code 邀请码
-	 * @param int    $aff  URL中的aff参数
-	 *
-	 * @return array
-	 */
-	private function getAff($code = '', $aff = '')
-	{
-		// 邀请人ID
-		$referral_uid = 0;
-
-		// 邀请码ID
-		$code_id = 0;
-
-		// 有邀请码先用邀请码,用谁的邀请码就给谁返利
-		if($code){
-			$inviteCode = Invite::query()->where('code', $code)->where('status', 0)->first();
-			if($inviteCode){
-				$referral_uid = $inviteCode->uid;
-				$code_id = $inviteCode->id;
-			}
-		}
-
-		// 没有用邀请码或者邀请码是管理员生成的,则检查cookie或者url链接
-		if(!$referral_uid){
-			// 检查一下cookie里有没有aff
-			$cookieAff = \Request::hasCookie('register_aff')? \Request::cookie('register_aff') : 0;
-			if($cookieAff){
-				$affUser = User::query()->where('id', $cookieAff)->exists();
-				$referral_uid = $affUser? $cookieAff : 0;
-			}elseif($aff){ // 如果cookie里没有aff,就再检查一下请求的url里有没有aff,因为有些人的浏览器会禁用了cookie,比如chrome开了隐私模式
-				$affUser = User::query()->where('id', $aff)->exists();
-				$referral_uid = $affUser? $aff : 0;
-			}
-		}
-
-		return [
-			'referral_uid' => $referral_uid,
-			'code_id'      => $code_id
-		];
-	}
-
-	// 写入生成激活账号验证记录
-	private function addVerify($userId, $token)
-	{
-		$verify = new Verify();
-		$verify->type = 1;
-		$verify->user_id = $userId;
-		$verify->token = $token;
-		$verify->status = 0;
-		$verify->save();
-	}
-
 	// 生成注册验证码
 	private function addVerifyCode($username, $code)
 	{
@@ -751,17 +750,19 @@ class AuthController extends Controller
 		$verify->save();
 	}
 
-	// 生成激活账号的地址
-	private function addVerifyUrl($uid, $username)
+	// 公开的邀请码列表
+	public function free()
 	{
-		$token = md5(self::$systemConfig['website_name'].$username.microtime());
-		$verify = new Verify();
-		$verify->type = 1;
-		$verify->user_id = $uid;
-		$verify->token = $token;
-		$verify->status = 0;
-		$verify->save();
+		$view['inviteList'] = Invite::query()->where('uid', 0)->where('status', 0)->paginate();
 
-		return $token;
+		return Response::view('auth.free', $view);
+	}
+
+	// 切换语言
+	public function switchLang($locale)
+	{
+		Session::put("locale", $locale);
+
+		return Redirect::back();
 	}
 }

+ 101 - 4
app/Http/Controllers/Controller.php

@@ -2,9 +2,14 @@
 
 namespace App\Http\Controllers;
 
+use App\Components\Helpers;
 use App\Http\Models\ReferralLog;
 use App\Http\Models\SensitiveWords;
+use App\Http\Models\SsGroup;
+use App\Http\Models\SsNode;
+use App\Http\Models\User;
 use App\Http\Models\UserBalanceLog;
+use App\Http\Models\UserSubscribeLog;
 use Exception;
 use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
 use Illuminate\Foundation\Bus\DispatchesJobs;
@@ -18,19 +23,19 @@ class Controller extends BaseController
 	// 生成随机密码
 	public function makePasswd()
 	{
-		exit(makeRandStr());
+		return makeRandStr();
 	}
 
 	// 生成VmessId
 	public function makeVmessId()
 	{
-		exit(createGuid());
+		return createGuid();
 	}
 
 	// 生成网站安全码
 	public function makeSecurityCode()
 	{
-		exit(strtolower(makeRandStr(8)));
+		return strtolower(makeRandStr(8));
 	}
 
 	// 类似Linux中的tail命令
@@ -64,6 +69,8 @@ class Controller extends BaseController
 
 	/**
 	 * 计算文件行数
+	 * @param $file
+	 * @return int
 	 */
 	public function countLine($file)
 	{
@@ -136,7 +143,7 @@ class Controller extends BaseController
 	// 获取敏感词
 	public function sensitiveWords($type)
 	{
-		return SensitiveWords::query()->where('type',$type)->get()->pluck('words')->toArray();
+		return SensitiveWords::query()->where('type', $type)->get()->pluck('words')->toArray();
 	}
 
 	// 将Base64图片转换为本地图片并保存
@@ -164,4 +171,94 @@ class Controller extends BaseController
 			return '';
 		}
 	}
+
+	/**
+	 * 节点信息
+	 *
+	 * @param int $uid      用户ID
+	 * @param int $nodeId   节点ID
+	 * @param int $infoType 信息类型:0为链接,1为文字
+	 * @return string
+	 */
+	function getNodeInfo($uid, $nodeId, $infoType)
+	{
+		$user = User::whereKey($uid)->first();
+		$node = SsNode::whereKey($nodeId)->first();
+		$scheme = NULL;
+		// 获取分组名称
+		$group = SsGroup::query()->whereKey($node->group_id)->first();
+		$host = $node->server? : $node->ip;
+
+		if($node->type == 1){
+			$group = $group? $group->name : Helpers::systemConfig()['website_name'];
+			$obfs_param = $user->obfs_param? : $node->obfs_param;
+			if($node->single){
+				$port = $node->port;
+				$protocol = $node->protocol;
+				$method = $node->method;
+				$obfs = $node->obfs;
+				$passwd = $node->passwd;
+				$protocol_param = $user->port.':'.$user->passwd;
+			}else{
+				$port = $user->port;
+				$protocol = $user->protocol;
+				$method = $user->method;
+				$obfs = $user->obfs;
+				$passwd = $user->passwd;
+				$protocol_param = $user->protocol_param;
+			}
+			if($infoType != 1){
+				// 生成ss/ssr scheme
+				if($node->compatible){
+					$data = 'ss://'.base64url_encode($method.':'.$passwd.'@'.$host.':'.$port).'#'.$group;
+				}else{
+					$data = 'ssr://'.base64url_encode($host.':'.$port.':'.$protocol.':'.$method.':'.$obfs.':'.base64url_encode($passwd).'/?obfsparam='.base64url_encode($obfs_param).'&protoparam='.base64url_encode($protocol_param).'&remarks='.base64url_encode($node->name).'&group='.base64url_encode($group).'&udpport=0&uot=0');
+				}
+			}else{
+				// 生成文本配置信息
+				$data = "服务器:".$host.PHP_EOL.
+					"IPv6:".($node->ipv6? : '').PHP_EOL.
+					"远程端口:".$port.PHP_EOL.
+					"密码:".$passwd.PHP_EOL.
+					"加密方法:".$method.PHP_EOL.
+					"路由:绕过局域网及中国大陆地址".PHP_EOL.
+					"协议:".$protocol.PHP_EOL.
+					"协议参数:".$protocol_param.PHP_EOL.
+					"混淆方式:".$obfs.PHP_EOL.
+					"混淆参数:".$obfs_param.PHP_EOL.
+					"本地端口:1080".PHP_EOL;
+			}
+		}else{
+			// 生成v2ray scheme
+			if($infoType != 1){
+				// 生成v2ray scheme
+				$data = 'vmess://'.base64_encode(json_encode(["v" => "2", "ps" => $node->name, "add" => $host, "port" => $node->v2_port, "id" => $user->vmess_id, "aid" => $node->v2_alter_id, "net" => $node->v2_net, "type" => $node->v2_type, "host" => $node->v2_host, "path" => $node->v2_path, "tls" => $node->v2_tls? "tls" : ""], JSON_PRETTY_PRINT));
+			}else{
+				$data = "服务器:".$host.PHP_EOL.
+					"IPv6:".($node->ipv6? : "").PHP_EOL.
+					"端口:".$node->v2_port.PHP_EOL.
+					"加密方式:".$node->v2_method.PHP_EOL.
+					"用户ID:".$user->vmess_id.PHP_EOL.
+					"额外ID:".$node->v2_alter_id.PHP_EOL.
+					"传输协议:".$node->v2_net.PHP_EOL.
+					"伪装类型:".$node->v2_type.PHP_EOL.
+					"伪装域名:".($node->v2_host? : "").PHP_EOL.
+					"路径:".($node->v2_path? : "").PHP_EOL.
+					"TLS:".($node->v2_tls? "tls" : "").PHP_EOL;
+			}
+		}
+
+		return $data;
+	}
+
+	// 写入订阅访问日志
+	public function log($subscribeId, $ip, $headers)
+	{
+		$log = new UserSubscribeLog();
+		$log->sid = $subscribeId;
+		$log->request_ip = $ip;
+		$log->request_time = date('Y-m-d H:i:s');
+		$log->request_header = $headers;
+		$log->save();
+	}
 }

+ 13 - 11
app/Http/Controllers/CouponController.php

@@ -53,6 +53,8 @@ class CouponController extends Controller
 		if($request->isMethod('POST')){
 			$this->validate($request, ['name' => 'required', 'type' => 'required|integer|between:1,3', 'usage' => 'required|integer|between:1,2', 'num' => 'required|integer|min:1', 'amount' => 'required_unless:type,2|numeric|min:0.01|nullable', 'discount' => 'required_if:type,2|numeric|between:1,9.9|nullable', 'available_start' => 'required|date|before_or_equal:available_end', 'available_end' => 'required|date|after_or_equal:available_start',], ['name.required' => '请填入卡券名称', 'type.required' => '请选择卡券类型', 'type.integer' => '卡券类型不合法,请重选', 'type.between' => '卡券类型不合法,请重选', 'usage.required' => '请选择卡券用途', 'usage.integer' => '卡券用途不合法,请重选', 'usage.between' => '卡券用途不合法,请重选', 'num.required' => '请填写卡券数量', 'num.integer' => '卡券数量不合法', 'num.min' => '卡券数量不合法,最小1', 'amount.required_unless' => '请填入卡券面值', 'amount.numeric' => '卡券金额不合法', 'amount.min' => '卡券金额不合法,最小0.01', 'discount.required_if' => '请填入卡券折扣', 'discount.numeric' => '卡券折扣不合法', 'discount.between' => '卡券折扣不合法,有效范围:1 ~ 9.9', 'available_start.required' => '请填入有效期', 'available_start.date' => '有效期不合法', 'available_start.before_or_equal' => '有效期不合法', 'available_end.required' => '请填入有效期', 'available_end.date' => '有效期不合法', 'available_end.after_or_equal' => '有效期不合法']);
 
+			$type = $request->input('type');
+
 			// 优惠卷LOGO
 			if($request->hasFile('logo')){
 				$file = $request->file('logo');
@@ -72,18 +74,18 @@ class CouponController extends Controller
 
 			DB::beginTransaction();
 			try{
-				for($i = 0; $i < $request->num; $i++){
+				for($i = 0; $i < $request->input('num'); $i++){
 					$obj = new Coupon();
-					$obj->name = $request->name;
-					$obj->sn = empty($request->sn)? strtoupper(makeRandStr(8)) : $request->sn;
+					$obj->name = $request->input('name');
+					$obj->sn = $request->input('sn')? : strtoupper(makeRandStr(8));
 					$obj->logo = $logo;
-					$obj->type = $request->type;
-					$obj->usage = $request->usage;
-					$obj->amount = $request->type == 2? 0 : $request->amount;
-					$obj->discount = $request->type != 2? 0 : $request->discount;
-					$obj->rule = $request->rule;
-					$obj->available_start = strtotime(date('Y-m-d 00:00:00', strtotime($request->available_start)));
-					$obj->available_end = strtotime(date('Y-m-d 23:59:59', strtotime($request->available_end)));
+					$obj->type = $type;
+					$obj->usage = $request->input('usage');
+					$obj->amount = $type == 2? 0 : $request->input('amount');
+					$obj->discount = $type != 2? 0 : $request->input('discount');
+					$obj->rule = $request->input('rule');
+					$obj->available_start = strtotime(date('Y-m-d 00:00:00', strtotime($request->input('available_start'))));
+					$obj->available_end = strtotime(date('Y-m-d 23:59:59', strtotime($request->input('available_end'))));
 					$obj->status = 0;
 					$obj->save();
 				}
@@ -112,7 +114,7 @@ class CouponController extends Controller
 	}
 
 	// 导出卡券
-	public function exportCoupon(Request $request)
+	public function exportCoupon()
 	{
 		$voucherList = Coupon::type(1)->where('status', 0)->get();
 		$discountCouponList = Coupon::type(2)->where('status', 0)->get();

+ 3 - 2
app/Http/Controllers/PaymentController.php

@@ -215,11 +215,12 @@ class PaymentController extends Controller
 
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => '创建订单失败:'.$e->getMessage()]);
 		}
+
 		return Response::json(['status' => 'fail', 'data' => '', 'message' => '未知错误']);
 	}
 
 	// 支付单详情
-	public function detail(Request $request, $sn)
+	public function detail($sn)
 	{
 		$view['payment'] = Payment::uid()->with(['order', 'order.goods'])->where('sn', $sn)->firstOrFail();
 
@@ -235,7 +236,7 @@ class PaymentController extends Controller
 			return Response::json(['status' => 'error', 'data' => '', 'message' => $validator->getMessageBag()->first()]);
 		}
 
-		$payment = Payment::uid()->where('sn', $request->sn)->first();
+		$payment = Payment::uid()->where('sn', $request->input('sn'))->first();
 		if($payment->status > 0){
 			return Response::json(['status' => 'success', 'data' => '', 'message' => '支付成功']);
 		}elseif($payment->status < 0){

+ 4 - 4
app/Http/Controllers/SensitiveWordsController.php

@@ -17,7 +17,7 @@ use Validator;
 class SensitiveWordsController extends Controller
 {
 	// 敏感词列表
-	public function sensitiveWordsList(Request $request)
+	public function sensitiveWordsList()
 	{
 		$view['list'] = SensitiveWords::query()->orderBy('id', 'desc')->paginate(15);
 
@@ -39,8 +39,8 @@ class SensitiveWordsController extends Controller
 		}
 
 		$obj = new SensitiveWords();
-		$obj->type = $request->type;
-		$obj->words = strtolower($request->words);
+		$obj->type = $request->input('type');
+		$obj->words = strtolower($request->input('words'));
 		$obj->save();
 		if($obj->id){
 			return Response::json(['status' => 'success', 'data' => '', 'message' => '添加成功']);
@@ -52,7 +52,7 @@ class SensitiveWordsController extends Controller
 	// 删除敏感词
 	public function delSensitiveWords(Request $request)
 	{
-		$result = SensitiveWords::query()->where('id', $request->id)->delete();
+		$result = SensitiveWords::query()->where('id', $request->input('id'))->delete();
 		if($result){
 			return Response::json(['status' => 'success', 'data' => '', 'message' => '删除成功']);
 		}else{

+ 21 - 16
app/Http/Controllers/ShopController.php

@@ -49,16 +49,21 @@ class ShopController extends Controller
 		if($request->isMethod('POST')){
 			$this->validate($request, ['name' => 'required', 'traffic' => 'required_unless:type,3|integer|min:1024|max:10240000|nullable', 'price' => 'required|numeric|min:0', 'type' => 'required', 'days' => 'required|integer',], ['name.required' => '请填入名称', 'traffic.required_unless' => '请填入流量', 'traffic.integer' => '内含流量必须是整数值', 'traffic.min' => '内含流量不能低于1MB', 'traffic.max' => '内含流量不能超过10TB', 'price.required' => '请填入价格', 'price.numeric' => '价格不合法', 'price.min' => '价格最低0', 'type.required' => '请选择类型', 'days.required' => '请填入有效期', 'days.integer' => '有效期不合法',]);
 
+			$type = $request->input('type');
+			$price = $request->input('price');
+			$renew = $request->input('renew');
+			$days = $request->input('days');
+
 			// 套餐必须有价格
-			if($request->type == 2 && $request->price <= 0){
+			if($type == 2 && $price <= 0){
 				return Redirect::back()->withInput()->withErrors('套餐价格必须大于0');
 			}
 
-			if($request->renew < 0){
+			if($renew < 0){
 				return Redirect::back()->withInput()->withErrors('流量重置价格必须大于0');
 			}
 			// 套餐有效天数必须大于30天
-			if($request->type == 2 && $request->days < 1){
+			if($type == 2 && $days < 1){
 				return Redirect::back()->withInput()->withErrors('套餐有效天数必须不能少于1天');
 			}
 
@@ -82,20 +87,20 @@ class ShopController extends Controller
 			DB::beginTransaction();
 			try{
 				$goods = new Goods();
-				$goods->name = $request->name;
-				$goods->info = $request->info;
-				$goods->desc = $request->desc;
+				$goods->name = $request->input('name');
+				$goods->info = $request->input('info');
+				$goods->desc = $request->input('desc');
 				$goods->logo = $logo;
-				$goods->traffic = $request->traffic;
-				$goods->price = round($request->price, 2);
-				$goods->renew = round($request->renew, 2);
-				$goods->type = $request->type;
-				$goods->days = $request->days;
-				$goods->color = $request->color;
-				$goods->sort = $request->sort;
-				$goods->is_hot = $request->is_hot;
-				$goods->limit_num = $request->limit_num;
-				$goods->status = $request->status;
+				$goods->traffic = $request->input('traffic');
+				$goods->price = round($price, 2);
+				$goods->renew = round($renew, 2);
+				$goods->type = $type;
+				$goods->days = $days;
+				$goods->color = $request->input('color');
+				$goods->sort = $request->input('sort');
+				$goods->is_hot = $request->input('is_hot');
+				$goods->limit_num = $request->input('limit_num');
+				$goods->status = $request->input('status');
 				$goods->save();
 
 				// 生成SKU

+ 2 - 56
app/Http/Controllers/SubscribeController.php

@@ -4,7 +4,6 @@ namespace App\Http\Controllers;
 
 use App\Components\Helpers;
 use App\Http\Models\Device;
-use App\Http\Models\SsGroup;
 use App\Http\Models\SsNode;
 use App\Http\Models\User;
 use App\Http\Models\UserLabel;
@@ -185,7 +184,7 @@ class SubscribeController extends Controller
 			shuffle($nodeList);
 		}
 
-		$scheme = '';
+		$scheme = NULL;
 
 		// 展示到期时间和剩余流量
 		if(self::$systemConfig['is_custom_subscribe']){
@@ -198,49 +197,7 @@ class SubscribeController extends Controller
 			if(self::$systemConfig['subscribe_max'] && $key >= self::$systemConfig['subscribe_max']){
 				break;
 			}
-			// 获取分组名称
-			$host = $node['server']? : $node['ip'];
-			if($node['type'] == 1){
-				$group = SsGroup::query()->where('id', $node['group_id'])->first();
-				$group = empty($group)? Helpers::systemConfig()['website_name'] : $group->name;
-				$obfs_param = $user->obfs_param? : $node['obfs_param'];
-
-				if($node['single']){
-					$port = $node['port'];
-					$protocol = $node['protocol'];
-					$method = $node['method'];
-					$obfs = $node['obfs'];
-					$passwd = $node['passwd'];
-					$protocol_param = $user->port.':'.$user->passwd;
-				}else{
-					$port = $user->port;
-					$protocol = $user->protocol;
-					$method = $user->method;
-					$obfs = $user->obfs;
-					$passwd = $user->passwd;
-					$protocol_param = $user->protocol_param;
-				}
-
-				// 生成ssr scheme
-				$scheme .= 'ssr://'.base64url_encode($host.':'.$port.':'.$protocol.':'.$method.':'.$obfs.':'.base64url_encode($passwd).'/?obfsparam='.base64url_encode($obfs_param).'&protoparam='.base64url_encode($protocol_param).'&remarks='.base64url_encode($node['name']).'&group='.base64url_encode($group).'&udpport=0&uot=0')."\n";
-			}else{
-				// 生成v2ray scheme
-				$v2_json = [
-					"v"    => "2",
-					"ps"   => $node['name'],
-					"add"  => $host,
-					"port" => $node['v2_port'],
-					"id"   => $user->vmess_id,
-					"aid"  => $node['v2_alter_id'],
-					"net"  => $node['v2_net'],
-					"type" => $node['v2_type'],
-					"host" => $node['v2_host'],
-					"path" => $node['v2_path'],
-					"tls"  => $node['v2_tls']? "tls" : ""
-				];
-
-				$scheme .= 'vmess://'.base64url_encode(json_encode($v2_json, JSON_PRETTY_PRINT))."\n";
-			}
+			$scheme .= $this->getNodeInfo($user->id, $node['id'], 0).PHP_EOL;
 		}
 
 		// 适配Quantumult的自定义订阅头
@@ -257,17 +214,6 @@ class SubscribeController extends Controller
 		}
 	}
 
-	// 写入订阅访问日志
-	private function log($subscribeId, $ip, $headers)
-	{
-		$log = new UserSubscribeLog();
-		$log->sid = $subscribeId;
-		$log->request_ip = $ip;
-		$log->request_time = date('Y-m-d H:i:s');
-		$log->request_header = $headers;
-		$log->save();
-	}
-
 	// 抛出无可用的节点信息,用于兼容防止客户端订阅失败
 	private function noneNode()
 	{

+ 35 - 92
app/Http/Controllers/UserController.php

@@ -12,7 +12,7 @@ use App\Http\Models\Invite;
 use App\Http\Models\Order;
 use App\Http\Models\ReferralApply;
 use App\Http\Models\ReferralLog;
-use App\Http\Models\SsGroup;
+use App\Http\Models\SsNode;
 use App\Http\Models\SsNodeInfo;
 use App\Http\Models\SsNodeLabel;
 use App\Http\Models\Ticket;
@@ -56,7 +56,7 @@ class UserController extends Controller
 		self::$systemConfig = Helpers::systemConfig();
 	}
 
-	public function index(Request $request)
+	public function index()
 	{
 		$totalTransfer = Auth::user()->transfer_enable;
 		$usedTransfer = Auth::user()->u+Auth::user()->d;
@@ -123,7 +123,7 @@ class UserController extends Controller
 	}
 
 	// 签到
-	public function checkIn(Request $request)
+	public function checkIn()
 	{
 		// 系统开启登录加积分功能才可以签到
 		if(!self::$systemConfig['is_checkin']){
@@ -145,7 +145,7 @@ class UserController extends Controller
 		Helpers::addUserTrafficModifyLog(Auth::user()->id, 0, Auth::user()->transfer_enable, Auth::user()->transfer_enable+$traffic*1048576, '[签到]');
 
 		// 多久后可以再签到
-		$ttl = self::$systemConfig['traffic_limit_time']? self::$systemConfig['traffic_limit_time'] : 1440;
+		$ttl = self::$systemConfig['traffic_limit_time']? self::$systemConfig['traffic_limit_time']*60 : 86400;
 		Cache::put('userCheckIn_'.Auth::user()->id, '1', $ttl);
 
 		return Response::json(['status' => 'success', 'message' => '签到成功,系统送您 '.$traffic.'M 流量']);
@@ -154,88 +154,31 @@ class UserController extends Controller
 	// 节点列表
 	public function nodeList(Request $request)
 	{
-		// 节点列表
-		$userLabelIds = UserLabel::uid()->pluck('label_id');
-		if(empty($userLabelIds)){
-			$view['nodeList'] = [];
-			$view['allNodes'] = '';
-
-			return Response::view('user.nodeList', $view);
-		}
-
-		// 获取当前用户可用节点
-		$nodeList = DB::table('ss_node')->selectRaw('ss_node.*')->leftJoin('ss_node_label', 'ss_node.id', '=', 'ss_node_label.node_id')->whereIn('ss_node_label.label_id', $userLabelIds)->where('ss_node.status', 1)->groupBy('ss_node.id')->orderBy('ss_node.sort', 'desc')->orderBy('ss_node.id', 'asc')->get();
-
-		$allNodes = ''; // 全部节点SSR链接,用于一键复制所有节点
-		foreach($nodeList as $node){
-			// 获取分组名称
-			$group = SsGroup::query()->where('id', $node->group_id)->first();
-			$host = $node->server? : $node->ip;
-			if($node->type == 1){
-				$obfs_param = Auth::user()->obfs_param? : $node->obfs_param;
-				$group = empty($group)? Helpers::systemConfig()['website_name'] : $group->name;
-				if($node->single){
-					$port = $node->port;
-					$protocol = $node->protocol;
-					$method = $node->method;
-					$obfs = $node->obfs;
-					$passwd = $node->passwd;
-					$protocol_param = Auth::user()->port.':'.Auth::user()->passwd;
-				}else{
-					$port = Auth::user()->port;
-					$protocol = Auth::user()->protocol;
-					$method = Auth::user()->method;
-					$obfs = Auth::user()->obfs;
-					$passwd = Auth::user()->passwd;
-					$protocol_param = Auth::user()->protocol_param;
-				}
-
-				// 生成ssr scheme
-				$node->ssr_scheme = 'ssr://'.base64url_encode($host.':'.$port.':'.$protocol.':'.$method.':'.$obfs.':'.base64url_encode($passwd).'/?obfsparam='.base64url_encode($obfs_param).'&protoparam='.base64url_encode($protocol_param).'&remarks='.base64url_encode($node->name).'&group='.base64url_encode($group).'&udpport=0&uot=0');
-				$allNodes .= $node->ssr_scheme.'|';
-				// 生成ss scheme
-				$node->ss_scheme = $node->compatible? 'ss://'.base64url_encode(Auth::user()->method.':'.Auth::user()->passwd.'@'.$host.':'.Auth::user()->port).'#'.$group : '';
-
-				// 生成文本配置信息
-				$node->txt = "服务器:".$host.PHP_EOL.
-					($node->ipv6? "IPv6:".$node->ipv6.PHP_EOL : '').
-					"远程端口:".$port.PHP_EOL.
-					"密码:".$passwd.PHP_EOL.
-					"加密方法:".$method.PHP_EOL.
-					"路由:绕过局域网及中国大陆地址".PHP_EOL.
-					"协议:".$protocol.PHP_EOL.
-					"协议参数:".$protocol_param.PHP_EOL.
-					"混淆方式:".$obfs.PHP_EOL.
-					"混淆参数:".$obfs_param.PHP_EOL.
-					"本地端口:1080".PHP_EOL;
-			}else{
-				// 生成v2ray scheme
-				$node->v2_scheme = 'vmess://'.base64_encode(json_encode(["v" => "2", "ps" => $node->name, "add" => $node->server? : $node->ip, "port" => $node->v2_port, "id" => Auth::user()->vmess_id, "aid" => $node->v2_alter_id, "net" => $node->v2_net, "type" => $node->v2_type, "host" => $node->v2_host, "path" => $node->v2_path, "tls" => $node->v2_tls == 1? "tls" : ""], JSON_PRETTY_PRINT));
-
-				// 生成文本配置信息
-				$node->txt = "服务器:".$host.PHP_EOL.
-					($node->ipv6? "IPv6:".$node->ipv6.PHP_EOL : '').
-					"端口:".$node->v2_port.PHP_EOL.
-					"加密方式:".$node->v2_method.PHP_EOL.
-					"用户ID:".Auth::user()->vmess_id.PHP_EOL.
-					"额外ID:".$node->v2_alter_id.PHP_EOL.
-					"传输协议:".$node->v2_net.PHP_EOL.
-					"伪装类型:".$node->v2_type.PHP_EOL.
-					($node->v2_host? "伪装域名:".$node->v2_host.PHP_EOL : "").
-					($node->v2_path? "路径:".$node->v2_path.PHP_EOL : "").
-					($node->v2_tls? "TLS:tls".PHP_EOL : "");
-			}
+		if($request->isMethod('POST')){
+			$node_id = $request->input('id');
+			$infoType = $request->input('type');
 
-			// 节点在线状态
-			$nodeInfo = SsNodeInfo::query()->where('node_id', $node->id)->where('log_time', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->first();
-			$node->online_status = $nodeInfo? 1 : 0;
+			$node = SsNode::query()->whereKey($node_id)->first();
+			// 生成节点信息
+			$proxyType = $node->type == 1? ($node->compatible? 'SS' : 'SSR') : 'V2Ray';
+			$data = $this->getNodeInfo(Auth::user()->id, $node->id, $infoType != 'text'? 0 : 1);
 
-			// 节点标签
-			$node->labels = SsNodeLabel::query()->with('labelInfo')->where('node_id', $node->id)->first();
+			return Response::json(['status' => 'success', 'data' => $data, 'title' => $proxyType]);
+		}else{
+			// 获取当前用户标签
+			$userLabelIds = UserLabel::uid()->pluck('label_id');
+			// 获取当前用户可用节点
+			$nodeList = SsNode::query()->selectRaw('ss_node.*')->leftJoin('ss_node_label', 'ss_node.id', '=', 'ss_node_label.node_id')->whereIn('ss_node_label.label_id', $userLabelIds)->where('ss_node.status', 1)->groupBy('ss_node.id')->orderBy('ss_node.sort', 'desc')->orderBy('ss_node.id', 'asc')->get();
+
+			foreach($nodeList as $node){
+				// 节点在线状态
+				$node->offline = SsNodeInfo::query()->where('node_id', $node->id)->where('log_time', '>=', strtotime("-10 minutes"))->orderBy('id', 'desc')->doesntExist();
+				// 节点标签
+				$node->labels = SsNodeLabel::query()->where('node_id', $node->id)->first();
+			}
+			$view['nodeList'] = $nodeList? : [];
 		}
 
-		$view['allNodes'] = rtrim($allNodes, "|");
-		$view['nodeList'] = $nodeList;
 
 		return Response::view('user.nodeList', $view);
 	}
@@ -243,7 +186,7 @@ class UserController extends Controller
 	// 公告详情
 	public function article(Request $request)
 	{
-		$view['info'] = Article::query()->findOrFail($request->id);
+		$view['info'] = Article::query()->findOrFail($request->input('id'));
 
 		return Response::view('user.article', $view);
 	}
@@ -490,7 +433,7 @@ class UserController extends Controller
 	}
 
 	// 邀请码
-	public function invite(Request $request)
+	public function invite()
 	{
 		if(Order::uid()->where('status', 2)->where('is_expire', 0)->where('origin_amount', '>', 0)->doesntExist()){
 			return Response::view('auth.error', ['message' => '本功能对非付费用户禁用!请 <a class="btn btn-sm btn-danger" href="/">返 回</a>']);
@@ -505,7 +448,7 @@ class UserController extends Controller
 	}
 
 	// 生成邀请码
-	public function makeInvite(Request $request)
+	public function makeInvite()
 	{
 		if(Auth::user()->invite_num <= 0){
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => '生成失败:已无邀请码生成名额']);
@@ -558,7 +501,7 @@ class UserController extends Controller
 	}
 
 	// 购买服务
-	public function buy(Request $request, $goods_id)
+	public function buy($goods_id)
 	{
 		$goods = Goods::query()->where('id', $goods_id)->where('status', 1)->first();
 		if(empty($goods)){
@@ -575,7 +518,7 @@ class UserController extends Controller
 	}
 
 	// 推广返利
-	public function referral(Request $request)
+	public function referral()
 	{
 		if(Order::uid()->where('status', 2)->where('is_expire', 0)->where('origin_amount', '>', 0)->doesntExist()){
 			return Response::view('auth.error', ['message' => '本功能对非付费用户禁用!请 <a class="btn btn-sm btn-danger" href="/">返 回</a>']);
@@ -594,7 +537,7 @@ class UserController extends Controller
 	}
 
 	// 申请提现
-	public function extractMoney(Request $request)
+	public function extractMoney()
 	{
 		// 判断账户是否过期
 		if(Auth::user()->expire_time < date('Y-m-d')){
@@ -635,7 +578,7 @@ class UserController extends Controller
 	}
 
 	// 帮助中心
-	public function help(Request $request)
+	public function help()
 	{
 		$view['articleList'] = Article::type(1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->limit(10)->paginate(5);
 
@@ -649,7 +592,7 @@ class UserController extends Controller
 		$view['subscribe_status'] = $subscribe->status;
 		$subscribe_link = (self::$systemConfig['subscribe_domain']? self::$systemConfig['subscribe_domain'] : self::$systemConfig['website_url']).'/s/'.$subscribe->code;
 		$view['link'] = $subscribe_link;
-		$view['Shadowrocket_link'] = 'shadowrocket://add/sub://'.base64url_encode($subscribe_link).'?remarks='.self::$systemConfig['website_name'].'-'.self::$systemConfig['website_url'];
+		$view['Shadowrocket_link'] = 'shadowrocket://add/sub://'.base64url_encode($subscribe_link).'?remarks='.(self::$systemConfig['website_name'].'-'.self::$systemConfig['website_url']);
 		$view['Shadowrocket_linkQrcode'] = 'sub://'.base64url_encode($subscribe_link).'#'.base64url_encode(self::$systemConfig['website_name']);
 		$view['Quantumult_linkOut'] = 'quantumult://configuration?server='.base64url_encode($subscribe_link).'&filter='.base64url_encode('https://raw.githubusercontent.com/ConnersHua/Profiles/master/Quantumult/Pro.conf').'&rejection='.base64url_encode('https://raw.githubusercontent.com/ConnersHua/Profiles/master/Quantumult/Rejection.conf');
 		$view['Quantumult_linkIn'] = 'quantumult://configuration?server='.base64url_encode($subscribe_link).'&filter='.base64url_encode('https://raw.githubusercontent.com/ConnersHua/Profiles/master/Quantumult/BacktoCN.conf').'&rejection='.base64url_encode('https://raw.githubusercontent.com/ConnersHua/Profiles/master/Quantumult/Rejection.conf');
@@ -658,7 +601,7 @@ class UserController extends Controller
 	}
 
 	// 更换订阅地址
-	public function exchangeSubscribe(Request $request)
+	public function exchangeSubscribe()
 	{
 		DB::beginTransaction();
 		try{
@@ -681,7 +624,7 @@ class UserController extends Controller
 	}
 
 	// 转换成管理员的身份
-	public function switchToAdmin(Request $request)
+	public function switchToAdmin()
 	{
 		if(!Session::has('admin')){
 			return Response::json(['status' => 'fail', 'data' => '', 'message' => '非法请求']);

+ 1 - 1
app/Http/Middleware/Affiliate.php

@@ -12,7 +12,7 @@ class Affiliate
 	 * 返利识别
 	 *
 	 * @param Request $request
-	 * @param Closure                  $next
+	 * @param Closure $next
 	 *
 	 * @return mixed
 	 */

+ 3 - 3
app/Http/Middleware/RedirectIfAuthenticated.php

@@ -10,9 +10,9 @@ class RedirectIfAuthenticated
 	/**
 	 * Handle an incoming request.
 	 *
-	 * @param Request $request
-	 * @param Closure                  $next
-	 * @param string|null              $guard
+	 * @param Request     $request
+	 * @param Closure     $next
+	 * @param string|null $guard
 	 *
 	 * @return mixed
 	 */

+ 1 - 1
app/Http/Middleware/SetLocale.php

@@ -12,7 +12,7 @@ class SetLocale
 	 * 变更语言
 	 *
 	 * @param Request $request
-	 * @param Closure                  $next
+	 * @param Closure $next
 	 *
 	 * @return mixed
 	 */

+ 1 - 1
app/Http/Middleware/isAdmin.php

@@ -13,7 +13,7 @@ class isAdmin
 	 * 校验是否为管理员身份
 	 *
 	 * @param Request $request
-	 * @param Closure                  $next
+	 * @param Closure $next
 	 *
 	 * @return mixed
 	 */

+ 2 - 2
app/Http/Middleware/isForbidden.php

@@ -16,7 +16,7 @@ class isForbidden
 	 * 限制机器人、指定IP访问
 	 *
 	 * @param Request $request
-	 * @param Closure                  $next
+	 * @param Closure $next
 	 *
 	 * @return mixed
 	 */
@@ -32,7 +32,7 @@ class isForbidden
 		}
 
 		// 拒绝通过订阅链接域名访问网站,防止网站被探测
-		if(FALSE !== strpos(Helpers::systemConfig()['subscribe_domain'], $request->getHost())){
+		if(TRUE === strpos(Helpers::systemConfig()['subscribe_domain'], $request->getHost()) && FALSE === strpos(Helpers::systemConfig()['subscribe_domain'], Helpers::systemConfig()['website_url'])){
 			Log::info("识别到通过订阅链接访问,强制跳转至百度(".getClientIp().")");
 
 			return redirect('https://www.baidu.com');

+ 1 - 1
app/Http/Middleware/isLogin.php

@@ -12,7 +12,7 @@ class isLogin
 	 * 校验是否已登录
 	 *
 	 * @param Request $request
-	 * @param Closure                  $next
+	 * @param Closure $next
 	 *
 	 * @return mixed
 	 */

+ 2 - 2
app/Http/Middleware/isSecurity.php

@@ -20,7 +20,7 @@ class isSecurity
 	public function handle($request, Closure $next)
 	{
 		$ip = getClientIP();
-		$code = $request->input('securityCode');
+		$code = $request->securityCode;
 		$cacheKey = 'SecurityLogin_'.ip2long($ip);
 		$websiteSecurityCode = Helpers::systemConfig()['website_security_code'];
 
@@ -30,7 +30,7 @@ class isSecurity
 
 				return response()->view('auth.error', ['message' => trans('error.SecurityError').', '.trans('error.Visit').'<a href="/login?securityCode=" target="_self">'.trans('error.SecurityEnter').'</a>']);
 			}else{
-				Cache::put($cacheKey, $ip, 120); // 缓存120分钟,因为每个session默认存活120分钟
+				Cache::put($cacheKey, $ip, 7200); // 2小时之内无需再次输入安全码访问
 			}
 		}
 

+ 33 - 0
app/Http/Models/Article.php

@@ -5,6 +5,8 @@ namespace App\Http\Models;
 use Eloquent;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Database\Query\Builder;
+use Illuminate\Support\Carbon;
 
 /**
  * 文章
@@ -12,6 +14,37 @@ use Illuminate\Database\Eloquent\SoftDeletes;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string      $title      标题
+ * @property string|null $author     作者
+ * @property string|null $summary    简介
+ * @property string|null $logo       LOGO
+ * @property string|null $content    内容
+ * @property int|null    $type       类型:1-文章、2-公告、3-购买说明、4-使用教程
+ * @property int         $sort       排序
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property Carbon|null $deleted_at 删除时间
+ * @method static bool|null forceDelete()
+ * @method static \Illuminate\Database\Eloquent\Builder|Article newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Article newQuery()
+ * @method static Builder|Article onlyTrashed()
+ * @method static \Illuminate\Database\Eloquent\Builder|Article query()
+ * @method static bool|null restore()
+ * @method static \Illuminate\Database\Eloquent\Builder|Article type($type)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereAuthor($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereContent($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereDeletedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereLogo($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereSort($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereSummary($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereTitle($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Article whereUpdatedAt($value)
+ * @method static Builder|Article withTrashed()
+ * @method static Builder|Article withoutTrashed()
  */
 class Article extends Model
 {

+ 11 - 1
app/Http/Models/Config.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,11 +12,20 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string      $name  配置名
+ * @property string|null $value 配置值
+ * @method static Builder|Config newModelQuery()
+ * @method static Builder|Config newQuery()
+ * @method static Builder|Config query()
+ * @method static Builder|Config whereId($value)
+ * @method static Builder|Config whereName($value)
+ * @method static Builder|Config whereValue($value)
  */
 class Config extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'config';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 }

+ 11 - 1
app/Http/Models/Country.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,10 +12,19 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property string $name 名称
+ * @property string $code 代码
+ * @method static Builder|Country newModelQuery()
+ * @method static Builder|Country newQuery()
+ * @method static Builder|Country query()
+ * @method static Builder|Country whereCode($value)
+ * @method static Builder|Country whereId($value)
+ * @method static Builder|Country whereName($value)
  */
 class Country extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'country';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 }

+ 41 - 0
app/Http/Models/Coupon.php

@@ -5,6 +5,8 @@ namespace App\Http\Models;
 use Eloquent;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Database\Query\Builder;
+use Illuminate\Support\Carbon;
 
 /**
  * 优惠券
@@ -12,6 +14,45 @@ use Illuminate\Database\Eloquent\SoftDeletes;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string      $name            优惠券名称
+ * @property string      $logo            优惠券LOGO
+ * @property string      $sn              优惠券码
+ * @property int         $type            类型:1-现金券、2-折扣券、3-充值券
+ * @property int         $usage           用途:1-仅限一次性使用、2-可重复使用
+ * @property int         $amount          金额,单位分
+ * @property float       $discount        折扣
+ * @property int         $rule            使用限制,单位分
+ * @property int         $available_start 有效期开始
+ * @property int         $available_end   有效期结束
+ * @property int         $status          状态:0-未使用、1-已使用、2-已失效
+ * @property Carbon|null $created_at      创建时间
+ * @property Carbon|null $updated_at      最后更新时间
+ * @property Carbon|null $deleted_at      删除时间
+ * @method static bool|null forceDelete()
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon newQuery()
+ * @method static Builder|Coupon onlyTrashed()
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon query()
+ * @method static bool|null restore()
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon type($type)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereAmount($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereAvailableEnd($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereAvailableStart($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereDeletedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereDiscount($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereLogo($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereRule($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereSn($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereUpdatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Coupon whereUsage($value)
+ * @method static Builder|Coupon withTrashed()
+ * @method static Builder|Coupon withoutTrashed()
  */
 class Coupon extends Model
 {

+ 19 - 0
app/Http/Models/CouponLog.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 优惠券使用日志
@@ -11,6 +13,23 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $coupon_id  优惠券ID
+ * @property int         $goods_id   商品ID
+ * @property int         $order_id   订单ID
+ * @property string      $desc       备注
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @method static Builder|CouponLog newModelQuery()
+ * @method static Builder|CouponLog newQuery()
+ * @method static Builder|CouponLog query()
+ * @method static Builder|CouponLog whereCouponId($value)
+ * @method static Builder|CouponLog whereCreatedAt($value)
+ * @method static Builder|CouponLog whereDesc($value)
+ * @method static Builder|CouponLog whereGoodsId($value)
+ * @method static Builder|CouponLog whereId($value)
+ * @method static Builder|CouponLog whereOrderId($value)
+ * @method static Builder|CouponLog whereUpdatedAt($value)
  */
 class CouponLog extends Model
 {

+ 19 - 1
app/Http/Models/Device.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,12 +12,29 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int        $id
+ * @property int        $type     类型:0-兼容、1-Shadowsocks(R)、2-V2Ray
+ * @property int        $platform 所属平台:0-其他、1-iOS、2-Android、3-Mac、4-Windows、5-Linux
+ * @property string     $name     设备名称
+ * @property int        $status   状态:0-禁止订阅、1-允许订阅
+ * @property string     $header   请求时头部的识别特征码
+ * @property-read mixed $platform_label
+ * @property-read mixed $type_label
+ * @method static Builder|Device newModelQuery()
+ * @method static Builder|Device newQuery()
+ * @method static Builder|Device query()
+ * @method static Builder|Device whereHeader($value)
+ * @method static Builder|Device whereId($value)
+ * @method static Builder|Device whereName($value)
+ * @method static Builder|Device wherePlatform($value)
+ * @method static Builder|Device whereStatus($value)
+ * @method static Builder|Device whereType($value)
  */
 class Device extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'device';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function getTypeLabelAttribute()
 	{

+ 23 - 0
app/Http/Models/EmailLog.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 邮件/ServerChan发送日志
@@ -11,6 +13,27 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $type       类型:1-邮件、2-serverChan
+ * @property string      $address    收信地址
+ * @property string      $title      标题
+ * @property string      $content    内容
+ * @property int         $status     状态:-1发送失败、0-等待发送、1-发送成功
+ * @property string|null $error      发送失败抛出的异常信息
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @method static Builder|EmailLog newModelQuery()
+ * @method static Builder|EmailLog newQuery()
+ * @method static Builder|EmailLog query()
+ * @method static Builder|EmailLog whereAddress($value)
+ * @method static Builder|EmailLog whereContent($value)
+ * @method static Builder|EmailLog whereCreatedAt($value)
+ * @method static Builder|EmailLog whereError($value)
+ * @method static Builder|EmailLog whereId($value)
+ * @method static Builder|EmailLog whereStatus($value)
+ * @method static Builder|EmailLog whereTitle($value)
+ * @method static Builder|EmailLog whereType($value)
+ * @method static Builder|EmailLog whereUpdatedAt($value)
  */
 class EmailLog extends Model
 {

+ 58 - 3
app/Http/Models/Goods.php

@@ -3,8 +3,11 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Database\Query\Builder;
+use Illuminate\Support\Carbon;
 
 /**
  * 商品
@@ -12,6 +15,60 @@ use Illuminate\Database\Eloquent\SoftDeletes;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int                          $id
+ * @property string                       $sku        商品服务SKU
+ * @property string                       $name       商品名称
+ * @property string                       $logo       商品图片地址
+ * @property int                          $traffic    商品内含多少流量,单位MiB
+ * @property int                          $type       商品类型:1-流量包、2-套餐、3-余额充值
+ * @property int                          $price      售价,单位分
+ * @property int                          $renew      流量重置价格,单位分
+ * @property int                          $period     流量自动重置周期
+ * @property string|null                  $info       商品
+ * @property string|null                  $desc       商品描述
+ * @property int                          $days       有效期
+ * @property int                          $invite_num 赠送邀请码数
+ * @property int                          $limit_num  限购数量,默认为0不限购
+ * @property string                       $color      商品颜色
+ * @property int                          $sort       排序
+ * @property int                          $is_hot     是否热销:0-否、1-是
+ * @property int                          $status     状态:0-下架、1-上架
+ * @property Carbon|null                  $created_at 创建时间
+ * @property Carbon|null                  $updated_at 最后更新时间
+ * @property Carbon|null                  $deleted_at 删除时间
+ * @property-read mixed                   $traffic_label
+ * @property-read Collection|GoodsLabel[] $label
+ * @property-read int|null                $label_count
+ * @method static bool|null forceDelete()
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods newQuery()
+ * @method static Builder|Goods onlyTrashed()
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods query()
+ * @method static bool|null restore()
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods type($type)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereColor($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereDays($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereDeletedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereDesc($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereInfo($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereInviteNum($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereIsHot($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereLimitNum($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereLogo($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereName($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods wherePeriod($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods wherePrice($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereRenew($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereSku($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereSort($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereTraffic($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereType($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Goods whereUpdatedAt($value)
+ * @method static Builder|Goods withTrashed()
+ * @method static Builder|Goods withoutTrashed()
  */
 class Goods extends Model
 {
@@ -52,8 +109,6 @@ class Goods extends Model
 
 	function getTrafficLabelAttribute()
 	{
-		$traffic_label = flowAutoShow($this->attributes['traffic']*1048576);
-
-		return $traffic_label;
+		return flowAutoShow($this->attributes['traffic']*1048576);
 	}
 }

+ 12 - 1
app/Http/Models/GoodsLabel.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,12 +12,22 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int        $id
+ * @property int        $goods_id 商品ID
+ * @property int        $label_id 标签ID
+ * @property-read Goods $goods
+ * @method static Builder|GoodsLabel newModelQuery()
+ * @method static Builder|GoodsLabel newQuery()
+ * @method static Builder|GoodsLabel query()
+ * @method static Builder|GoodsLabel whereGoodsId($value)
+ * @method static Builder|GoodsLabel whereId($value)
+ * @method static Builder|GoodsLabel whereLabelId($value)
  */
 class GoodsLabel extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'goods_label';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function goods()
 	{

+ 32 - 1
app/Http/Models/Invite.php

@@ -6,6 +6,8 @@ use Auth;
 use Eloquent;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
+use Illuminate\Database\Query\Builder;
+use Illuminate\Support\Carbon;
 
 /**
  * 邀请码
@@ -13,7 +15,36 @@ use Illuminate\Database\Eloquent\SoftDeletes;
  *
  * @package App\Http\Models
  * @mixin Eloquent
- * @property-read mixed $status_label
+ * @property-read mixed  $status_label
+ * @property int         $id
+ * @property int         $uid        邀请人ID
+ * @property int         $fuid       受邀人ID
+ * @property string      $code       邀请码
+ * @property int         $status     邀请码状态:0-未使用、1-已使用、2-已过期
+ * @property string|null $dateline   有效期至
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at 删除时间
+ * @property-read User   $generator
+ * @property-read User   $user
+ * @method static bool|null forceDelete()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite newModelQuery()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite newQuery()
+ * @method static Builder|Invite onlyTrashed()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite query()
+ * @method static bool|null restore()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite uid()
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereCode($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereCreatedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereDateline($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereDeletedAt($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereFuid($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereId($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereStatus($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereUid($value)
+ * @method static \Illuminate\Database\Eloquent\Builder|Invite whereUpdatedAt($value)
+ * @method static Builder|Invite withTrashed()
+ * @method static Builder|Invite withoutTrashed()
  */
 class Invite extends Model
 {

+ 11 - 1
app/Http/Models/Label.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,10 +12,19 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property string $name 名称
+ * @property int    $sort 排序值
+ * @method static Builder|Label newModelQuery()
+ * @method static Builder|Label newQuery()
+ * @method static Builder|Label query()
+ * @method static Builder|Label whereId($value)
+ * @method static Builder|Label whereName($value)
+ * @method static Builder|Label whereSort($value)
  */
 class Label extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'label';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 }

+ 11 - 1
app/Http/Models/Level.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,10 +12,19 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property int    $level      等级
+ * @property string $level_name 等级名称
+ * @method static Builder|Level newModelQuery()
+ * @method static Builder|Level newQuery()
+ * @method static Builder|Level query()
+ * @method static Builder|Level whereId($value)
+ * @method static Builder|Level whereLevel($value)
+ * @method static Builder|Level whereLevelName($value)
  */
 class Level extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'level';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 }

+ 24 - 0
app/Http/Models/Marketing.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 营销
@@ -11,6 +13,28 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $type     类型:1-邮件群发、2-订阅渠道群发
+ * @property string      $receiver 接收者
+ * @property string      $title    标题
+ * @property string      $content  内容
+ * @property string|null $error    错误信息
+ * @property int         $status   状态:-1-失败、0-待发送、1-成功
+ * @property Carbon      $created_at
+ * @property Carbon      $updated_at
+ * @property-read mixed  $status_label
+ * @method static Builder|Marketing newModelQuery()
+ * @method static Builder|Marketing newQuery()
+ * @method static Builder|Marketing query()
+ * @method static Builder|Marketing whereContent($value)
+ * @method static Builder|Marketing whereCreatedAt($value)
+ * @method static Builder|Marketing whereError($value)
+ * @method static Builder|Marketing whereId($value)
+ * @method static Builder|Marketing whereReceiver($value)
+ * @method static Builder|Marketing whereStatus($value)
+ * @method static Builder|Marketing whereTitle($value)
+ * @method static Builder|Marketing whereType($value)
+ * @method static Builder|Marketing whereUpdatedAt($value)
  */
 class Marketing extends Model
 {

+ 39 - 1
app/Http/Models/Order.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 订单
@@ -12,7 +14,43 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
- * @property-read mixed $status_label
+ * @property-read mixed   $status_label
+ * @property int          $oid
+ * @property string       $order_sn      订单编号
+ * @property int          $user_id       操作人
+ * @property int          $goods_id      商品ID
+ * @property int          $coupon_id     优惠券ID
+ * @property string|null  $email         邮箱
+ * @property int          $origin_amount 订单原始总价,单位分
+ * @property int          $amount        订单总价,单位分
+ * @property string|null  $expire_at     过期时间
+ * @property int          $is_expire     是否已过期:0-未过期、1-已过期
+ * @property int          $pay_way       支付方式:1-余额支付、2-有赞云支付
+ * @property int          $status        订单状态:-1-已关闭、0-待支付、1-已支付待确认、2-已完成
+ * @property Carbon|null  $created_at    创建时间
+ * @property Carbon|null  $updated_at    最后一次更新时间
+ * @property-read Coupon  $coupon
+ * @property-read Goods   $goods
+ * @property-read Payment $payment
+ * @property-read User    $user
+ * @method static Builder|Order newModelQuery()
+ * @method static Builder|Order newQuery()
+ * @method static Builder|Order query()
+ * @method static Builder|Order uid()
+ * @method static Builder|Order whereAmount($value)
+ * @method static Builder|Order whereCouponId($value)
+ * @method static Builder|Order whereCreatedAt($value)
+ * @method static Builder|Order whereEmail($value)
+ * @method static Builder|Order whereExpireAt($value)
+ * @method static Builder|Order whereGoodsId($value)
+ * @method static Builder|Order whereIsExpire($value)
+ * @method static Builder|Order whereOid($value)
+ * @method static Builder|Order whereOrderSn($value)
+ * @method static Builder|Order whereOriginAmount($value)
+ * @method static Builder|Order wherePayWay($value)
+ * @method static Builder|Order whereStatus($value)
+ * @method static Builder|Order whereUpdatedAt($value)
+ * @method static Builder|Order whereUserId($value)
  */
 class Order extends Model
 {

+ 29 - 0
app/Http/Models/OrderGoods.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 订单商品
@@ -11,6 +13,33 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $oid          订单ID
+ * @property string      $order_sn     订单编号
+ * @property int         $user_id      用户ID
+ * @property int         $goods_id     商品ID
+ * @property int         $num          商品数量
+ * @property int         $origin_price 商品原价,单位分
+ * @property int         $price        商品实际价格,单位分
+ * @property int         $is_expire    是否已过期:0-未过期、1-已过期
+ * @property Carbon|null $created_at   创建时间
+ * @property Carbon|null $updated_at   最后更新时间
+ * @property-read Goods  $goods
+ * @property-read User   $user
+ * @method static Builder|OrderGoods newModelQuery()
+ * @method static Builder|OrderGoods newQuery()
+ * @method static Builder|OrderGoods query()
+ * @method static Builder|OrderGoods whereCreatedAt($value)
+ * @method static Builder|OrderGoods whereGoodsId($value)
+ * @method static Builder|OrderGoods whereId($value)
+ * @method static Builder|OrderGoods whereIsExpire($value)
+ * @method static Builder|OrderGoods whereNum($value)
+ * @method static Builder|OrderGoods whereOid($value)
+ * @method static Builder|OrderGoods whereOrderSn($value)
+ * @method static Builder|OrderGoods whereOriginPrice($value)
+ * @method static Builder|OrderGoods wherePrice($value)
+ * @method static Builder|OrderGoods whereUpdatedAt($value)
+ * @method static Builder|OrderGoods whereUserId($value)
  */
 class OrderGoods extends Model
 {

+ 38 - 0
app/Http/Models/Payment.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 支付单
@@ -12,6 +14,42 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int             $id
+ * @property string|null     $sn
+ * @property int             $user_id      用户ID
+ * @property int|null        $oid          本地订单ID
+ * @property string|null     $order_sn     本地订单长ID
+ * @property int             $pay_way      支付方式:1-微信、2-支付宝
+ * @property int             $amount       金额,单位分
+ * @property int             $qr_id        有赞生成的支付单ID
+ * @property string|null     $qr_url       有赞生成的支付二维码URL
+ * @property string|null     $qr_code      有赞生成的支付二维码图片base64
+ * @property string|null     $qr_local_url 支付二维码的本地存储URL
+ * @property int             $status       状态:-1-支付失败、0-等待支付、1-支付成功
+ * @property Carbon          $created_at
+ * @property Carbon          $updated_at
+ * @property-read mixed      $pay_way_label
+ * @property-read mixed      $status_label
+ * @property-read Order|null $order
+ * @property-read User       $user
+ * @method static Builder|Payment newModelQuery()
+ * @method static Builder|Payment newQuery()
+ * @method static Builder|Payment query()
+ * @method static Builder|Payment uid()
+ * @method static Builder|Payment whereAmount($value)
+ * @method static Builder|Payment whereCreatedAt($value)
+ * @method static Builder|Payment whereId($value)
+ * @method static Builder|Payment whereOid($value)
+ * @method static Builder|Payment whereOrderSn($value)
+ * @method static Builder|Payment wherePayWay($value)
+ * @method static Builder|Payment whereQrCode($value)
+ * @method static Builder|Payment whereQrId($value)
+ * @method static Builder|Payment whereQrLocalUrl($value)
+ * @method static Builder|Payment whereQrUrl($value)
+ * @method static Builder|Payment whereSn($value)
+ * @method static Builder|Payment whereStatus($value)
+ * @method static Builder|Payment whereUpdatedAt($value)
+ * @method static Builder|Payment whereUserId($value)
  */
 class Payment extends Model
 {

+ 36 - 0
app/Http/Models/PaymentCallback.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 支付回调(有赞云支付)
@@ -11,6 +13,40 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string|null $client_id
+ * @property string|null $yz_id
+ * @property string|null $kdt_id
+ * @property string|null $kdt_name
+ * @property int|null    $mode
+ * @property string|null $msg
+ * @property int|null    $sendCount
+ * @property string|null $sign
+ * @property string|null $status
+ * @property int|null    $test
+ * @property string|null $type
+ * @property string|null $version
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property-read mixed  $status_label
+ * @method static Builder|PaymentCallback newModelQuery()
+ * @method static Builder|PaymentCallback newQuery()
+ * @method static Builder|PaymentCallback query()
+ * @method static Builder|PaymentCallback whereClientId($value)
+ * @method static Builder|PaymentCallback whereCreatedAt($value)
+ * @method static Builder|PaymentCallback whereId($value)
+ * @method static Builder|PaymentCallback whereKdtId($value)
+ * @method static Builder|PaymentCallback whereKdtName($value)
+ * @method static Builder|PaymentCallback whereMode($value)
+ * @method static Builder|PaymentCallback whereMsg($value)
+ * @method static Builder|PaymentCallback whereSendCount($value)
+ * @method static Builder|PaymentCallback whereSign($value)
+ * @method static Builder|PaymentCallback whereStatus($value)
+ * @method static Builder|PaymentCallback whereTest($value)
+ * @method static Builder|PaymentCallback whereType($value)
+ * @method static Builder|PaymentCallback whereUpdatedAt($value)
+ * @method static Builder|PaymentCallback whereVersion($value)
+ * @method static Builder|PaymentCallback whereYzId($value)
  */
 class PaymentCallback extends Model
 {

+ 25 - 0
app/Http/Models/ReferralApply.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 返利申请
@@ -12,6 +14,29 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    用户ID
+ * @property int         $before     操作前可提现金额,单位分
+ * @property int         $after      操作后可提现金额,单位分
+ * @property int         $amount     本次提现金额,单位分
+ * @property string      $link_logs  关联返利日志ID,例如:1,3,4
+ * @property int         $status     状态:-1-驳回、0-待审核、1-审核通过待打款、2-已打款
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $User
+ * @method static Builder|ReferralApply newModelQuery()
+ * @method static Builder|ReferralApply newQuery()
+ * @method static Builder|ReferralApply query()
+ * @method static Builder|ReferralApply uid()
+ * @method static Builder|ReferralApply whereAfter($value)
+ * @method static Builder|ReferralApply whereAmount($value)
+ * @method static Builder|ReferralApply whereBefore($value)
+ * @method static Builder|ReferralApply whereCreatedAt($value)
+ * @method static Builder|ReferralApply whereId($value)
+ * @method static Builder|ReferralApply whereLinkLogs($value)
+ * @method static Builder|ReferralApply whereStatus($value)
+ * @method static Builder|ReferralApply whereUpdatedAt($value)
+ * @method static Builder|ReferralApply whereUserId($value)
  */
 class ReferralApply extends Model
 {

+ 27 - 0
app/Http/Models/ReferralLog.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 返利日志
@@ -12,6 +14,31 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id     用户ID
+ * @property int         $ref_user_id 推广人ID
+ * @property int         $order_id    关联订单ID
+ * @property int         $amount      消费金额,单位分
+ * @property int         $ref_amount  返利金额
+ * @property int         $status      状态:0-未提现、1-审核中、2-已提现
+ * @property Carbon|null $created_at  创建时间
+ * @property Carbon|null $updated_at  最后更新时间
+ * @property-read Order  $order
+ * @property-read User   $ref_user
+ * @property-read User   $user
+ * @method static Builder|ReferralLog newModelQuery()
+ * @method static Builder|ReferralLog newQuery()
+ * @method static Builder|ReferralLog query()
+ * @method static Builder|ReferralLog uid()
+ * @method static Builder|ReferralLog whereAmount($value)
+ * @method static Builder|ReferralLog whereCreatedAt($value)
+ * @method static Builder|ReferralLog whereId($value)
+ * @method static Builder|ReferralLog whereOrderId($value)
+ * @method static Builder|ReferralLog whereRefAmount($value)
+ * @method static Builder|ReferralLog whereRefUserId($value)
+ * @method static Builder|ReferralLog whereStatus($value)
+ * @method static Builder|ReferralLog whereUpdatedAt($value)
+ * @method static Builder|ReferralLog whereUserId($value)
  */
 class ReferralLog extends Model
 {

+ 11 - 1
app/Http/Models/SensitiveWords.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,10 +12,19 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property int    $type  类型:1-黑名单、2-白名单
+ * @property string $words 敏感词
+ * @method static Builder|SensitiveWords newModelQuery()
+ * @method static Builder|SensitiveWords newQuery()
+ * @method static Builder|SensitiveWords query()
+ * @method static Builder|SensitiveWords whereId($value)
+ * @method static Builder|SensitiveWords whereType($value)
+ * @method static Builder|SensitiveWords whereWords($value)
  */
 class SensitiveWords extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'sensitive_words';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 }

+ 18 - 1
app/Http/Models/SsConfig.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,14 +12,30 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property string $name       配置名
+ * @property int    $type       类型:1-加密方式、2-协议、3-混淆
+ * @property int    $is_default 是否默认:0-不是、1-是
+ * @property int    $sort       排序:值越大排越前
+ * @method static Builder|SsConfig default()
+ * @method static Builder|SsConfig newModelQuery()
+ * @method static Builder|SsConfig newQuery()
+ * @method static Builder|SsConfig query()
+ * @method static Builder|SsConfig type($type)
+ * @method static Builder|SsConfig whereId($value)
+ * @method static Builder|SsConfig whereIsDefault($value)
+ * @method static Builder|SsConfig whereName($value)
+ * @method static Builder|SsConfig whereSort($value)
+ * @method static Builder|SsConfig whereType($value)
  */
 class SsConfig extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'ss_config';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	// 筛选默认
+
 	function scopeDefault($query)
 	{
 		$query->where('is_default', 1);

+ 15 - 0
app/Http/Models/SsGroup.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * SS节点分组
@@ -11,6 +13,19 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string      $name  分组名称
+ * @property int         $level 分组级别
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @method static Builder|SsGroup newModelQuery()
+ * @method static Builder|SsGroup newQuery()
+ * @method static Builder|SsGroup query()
+ * @method static Builder|SsGroup whereCreatedAt($value)
+ * @method static Builder|SsGroup whereId($value)
+ * @method static Builder|SsGroup whereLevel($value)
+ * @method static Builder|SsGroup whereName($value)
+ * @method static Builder|SsGroup whereUpdatedAt($value)
  */
 class SsGroup extends Model
 {

+ 11 - 1
app/Http/Models/SsGroupNode.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,11 +12,20 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int $id
+ * @property int $group_id 分组ID
+ * @property int $node_id  节点ID
+ * @method static Builder|SsGroupNode newModelQuery()
+ * @method static Builder|SsGroupNode newQuery()
+ * @method static Builder|SsGroupNode query()
+ * @method static Builder|SsGroupNode whereGroupId($value)
+ * @method static Builder|SsGroupNode whereId($value)
+ * @method static Builder|SsGroupNode whereNodeId($value)
  */
 class SsGroupNode extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'ss_group_node';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 }

+ 90 - 0
app/Http/Models/SsNode.php

@@ -3,7 +3,10 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * SS节点信息
@@ -11,6 +14,93 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int                           $id
+ * @property int                           $type             服务类型:1-SS、2-V2ray
+ * @property string                        $name             名称
+ * @property int                           $group_id         所属分组
+ * @property string                        $country_code     国家代码
+ * @property string|null                   $server           服务器域名地址
+ * @property string|null                   $ip               服务器IPV4地址
+ * @property string|null                   $ipv6             服务器IPV6地址
+ * @property string|null                   $desc             节点简单描述
+ * @property string                        $method           加密方式
+ * @property string                        $protocol         协议
+ * @property string|null                   $protocol_param   协议参数
+ * @property string                        $obfs             混淆
+ * @property string|null                   $obfs_param       混淆参数
+ * @property float                         $traffic_rate     流量比率
+ * @property int                           $bandwidth        出口带宽,单位M
+ * @property int                           $traffic          每月可用流量,单位G
+ * @property string|null                   $monitor_url      监控地址
+ * @property int|null                      $is_subscribe     是否允许用户订阅该节点:0-否、1-是
+ * @property int                           $is_ddns          是否使用DDNS:0-否、1-是
+ * @property int                           $is_transit       是否中转节点:0-否、1-是
+ * @property int                           $ssh_port         SSH端口
+ * @property int                           $detectionType    节点检测: 0-关闭、1-只检测TCP、2-只检测ICMP、3-检测全部
+ * @property int                           $compatible       兼容SS
+ * @property int                           $single           启用单端口功能:0-否、1-是
+ * @property string|null                   $port             单端口的端口号
+ * @property string|null                   $passwd           单端口的连接密码
+ * @property int                           $sort             排序值,值越大越靠前显示
+ * @property int                           $status           状态:0-维护、1-正常
+ * @property int                           $v2_alter_id      V2ray额外ID
+ * @property int                           $v2_port          V2ray端口
+ * @property string                        $v2_method        V2ray加密方式
+ * @property string                        $v2_net           V2ray传输协议
+ * @property string                        $v2_type          V2ray伪装类型
+ * @property string                        $v2_host          V2ray伪装的域名
+ * @property string                        $v2_path          V2ray WS/H2路径
+ * @property int                           $v2_tls           V2ray底层传输安全 0 未开启 1 开启
+ * @property int                           $v2_insider_port  V2ray内部端口(内部监听),v2_port为0时有效
+ * @property int                           $v2_outsider_port V2ray外部端口(外部覆盖),v2_port为0时有效
+ * @property Carbon                        $created_at
+ * @property Carbon                        $updated_at
+ * @property-read Collection|SsNodeLabel[] $label
+ * @property-read int|null                 $label_count
+ * @method static Builder|SsNode newModelQuery()
+ * @method static Builder|SsNode newQuery()
+ * @method static Builder|SsNode query()
+ * @method static Builder|SsNode whereBandwidth($value)
+ * @method static Builder|SsNode whereCompatible($value)
+ * @method static Builder|SsNode whereCountryCode($value)
+ * @method static Builder|SsNode whereCreatedAt($value)
+ * @method static Builder|SsNode whereDesc($value)
+ * @method static Builder|SsNode whereDetectionType($value)
+ * @method static Builder|SsNode whereGroupId($value)
+ * @method static Builder|SsNode whereId($value)
+ * @method static Builder|SsNode whereIp($value)
+ * @method static Builder|SsNode whereIpv6($value)
+ * @method static Builder|SsNode whereIsDdns($value)
+ * @method static Builder|SsNode whereIsSubscribe($value)
+ * @method static Builder|SsNode whereIsTransit($value)
+ * @method static Builder|SsNode whereMethod($value)
+ * @method static Builder|SsNode whereMonitorUrl($value)
+ * @method static Builder|SsNode whereName($value)
+ * @method static Builder|SsNode whereObfs($value)
+ * @method static Builder|SsNode whereObfsParam($value)
+ * @method static Builder|SsNode wherePasswd($value)
+ * @method static Builder|SsNode wherePort($value)
+ * @method static Builder|SsNode whereProtocol($value)
+ * @method static Builder|SsNode whereProtocolParam($value)
+ * @method static Builder|SsNode whereServer($value)
+ * @method static Builder|SsNode whereSingle($value)
+ * @method static Builder|SsNode whereSort($value)
+ * @method static Builder|SsNode whereSshPort($value)
+ * @method static Builder|SsNode whereStatus($value)
+ * @method static Builder|SsNode whereTraffic($value)
+ * @method static Builder|SsNode whereTrafficRate($value)
+ * @method static Builder|SsNode whereType($value)
+ * @method static Builder|SsNode whereUpdatedAt($value)
+ * @method static Builder|SsNode whereV2AlterId($value)
+ * @method static Builder|SsNode whereV2Host($value)
+ * @method static Builder|SsNode whereV2InsiderPort($value)
+ * @method static Builder|SsNode whereV2Method($value)
+ * @method static Builder|SsNode whereV2Net($value)
+ * @method static Builder|SsNode whereV2OutsiderPort($value)
+ * @method static Builder|SsNode whereV2Path($value)
+ * @method static Builder|SsNode whereV2Port($value)
+ * @method static Builder|SsNode whereV2Tls($value)
+ * @method static Builder|SsNode whereV2Type($value)
  */
 class SsNode extends Model
 {

+ 15 - 1
app/Http/Models/SsNodeInfo.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,11 +12,24 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int    $id
+ * @property int    $node_id  节点ID
+ * @property int    $uptime   后端存活时长,单位秒
+ * @property string $load     负载
+ * @property int    $log_time 记录时间
+ * @method static Builder|SsNodeInfo newModelQuery()
+ * @method static Builder|SsNodeInfo newQuery()
+ * @method static Builder|SsNodeInfo query()
+ * @method static Builder|SsNodeInfo whereId($value)
+ * @method static Builder|SsNodeInfo whereLoad($value)
+ * @method static Builder|SsNodeInfo whereLogTime($value)
+ * @method static Builder|SsNodeInfo whereNodeId($value)
+ * @method static Builder|SsNodeInfo whereUptime($value)
  */
 class SsNodeInfo extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'ss_node_info';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 }

+ 21 - 0
app/Http/Models/SsNodeIp.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * SS节点在线IP信息
@@ -11,6 +13,25 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $node_id    节点ID
+ * @property int         $user_id    用户ID
+ * @property int         $port       端口
+ * @property string      $type       类型:all、tcp、udp
+ * @property string|null $ip         连接IP:每个IP用,号隔开
+ * @property Carbon      $created_at 上报时间
+ * @property-read SsNode $node
+ * @property-read User   $user
+ * @method static Builder|SsNodeIp newModelQuery()
+ * @method static Builder|SsNodeIp newQuery()
+ * @method static Builder|SsNodeIp query()
+ * @method static Builder|SsNodeIp whereCreatedAt($value)
+ * @method static Builder|SsNodeIp whereId($value)
+ * @method static Builder|SsNodeIp whereIp($value)
+ * @method static Builder|SsNodeIp whereNodeId($value)
+ * @method static Builder|SsNodeIp wherePort($value)
+ * @method static Builder|SsNodeIp whereType($value)
+ * @method static Builder|SsNodeIp whereUserId($value)
  */
 class SsNodeIp extends Model
 {

+ 11 - 1
app/Http/Models/SsNodeLabel.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -12,12 +13,21 @@ use Illuminate\Database\Eloquent\Model;
  * @package App\Http\Models
  * @property-read Label $labelInfo
  * @mixin Eloquent
+ * @property int        $id
+ * @property int        $node_id  用户ID
+ * @property int        $label_id 标签ID
+ * @method static Builder|SsNodeLabel newModelQuery()
+ * @method static Builder|SsNodeLabel newQuery()
+ * @method static Builder|SsNodeLabel query()
+ * @method static Builder|SsNodeLabel whereId($value)
+ * @method static Builder|SsNodeLabel whereLabelId($value)
+ * @method static Builder|SsNodeLabel whereNodeId($value)
  */
 class SsNodeLabel extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'ss_node_label';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function labelInfo()
 	{

+ 13 - 1
app/Http/Models/SsNodeOnlineLog.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,11 +12,22 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int $id
+ * @property int $node_id     节点ID
+ * @property int $online_user 在线用户数
+ * @property int $log_time    记录时间
+ * @method static Builder|SsNodeOnlineLog newModelQuery()
+ * @method static Builder|SsNodeOnlineLog newQuery()
+ * @method static Builder|SsNodeOnlineLog query()
+ * @method static Builder|SsNodeOnlineLog whereId($value)
+ * @method static Builder|SsNodeOnlineLog whereLogTime($value)
+ * @method static Builder|SsNodeOnlineLog whereNodeId($value)
+ * @method static Builder|SsNodeOnlineLog whereOnlineUser($value)
  */
 class SsNodeOnlineLog extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'ss_node_online_log';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 }

+ 22 - 0
app/Http/Models/SsNodeTrafficDaily.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 节点每日流量统计
@@ -11,6 +13,26 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $node_id    节点ID
+ * @property int         $u          上传流量
+ * @property int         $d          下载流量
+ * @property int         $total      总流量
+ * @property string|null $traffic    总流量(带单位)
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read SsNode $info
+ * @method static Builder|SsNodeTrafficDaily newModelQuery()
+ * @method static Builder|SsNodeTrafficDaily newQuery()
+ * @method static Builder|SsNodeTrafficDaily query()
+ * @method static Builder|SsNodeTrafficDaily whereCreatedAt($value)
+ * @method static Builder|SsNodeTrafficDaily whereD($value)
+ * @method static Builder|SsNodeTrafficDaily whereId($value)
+ * @method static Builder|SsNodeTrafficDaily whereNodeId($value)
+ * @method static Builder|SsNodeTrafficDaily whereTotal($value)
+ * @method static Builder|SsNodeTrafficDaily whereTraffic($value)
+ * @method static Builder|SsNodeTrafficDaily whereU($value)
+ * @method static Builder|SsNodeTrafficDaily whereUpdatedAt($value)
  */
 class SsNodeTrafficDaily extends Model
 {

+ 22 - 0
app/Http/Models/SsNodeTrafficHourly.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 节点每日流量统计
@@ -11,6 +13,26 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $node_id    节点ID
+ * @property int         $u          上传流量
+ * @property int         $d          下载流量
+ * @property int         $total      总流量
+ * @property string|null $traffic    总流量(带单位)
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read SsNode $info
+ * @method static Builder|SsNodeTrafficHourly newModelQuery()
+ * @method static Builder|SsNodeTrafficHourly newQuery()
+ * @method static Builder|SsNodeTrafficHourly query()
+ * @method static Builder|SsNodeTrafficHourly whereCreatedAt($value)
+ * @method static Builder|SsNodeTrafficHourly whereD($value)
+ * @method static Builder|SsNodeTrafficHourly whereId($value)
+ * @method static Builder|SsNodeTrafficHourly whereNodeId($value)
+ * @method static Builder|SsNodeTrafficHourly whereTotal($value)
+ * @method static Builder|SsNodeTrafficHourly whereTraffic($value)
+ * @method static Builder|SsNodeTrafficHourly whereU($value)
+ * @method static Builder|SsNodeTrafficHourly whereUpdatedAt($value)
  */
 class SsNodeTrafficHourly extends Model
 {

+ 22 - 1
app/Http/Models/Ticket.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 工单
@@ -12,7 +14,26 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
- * @property-read mixed $status_label
+ * @property-read mixed  $status_label
+ * @property int         $id
+ * @property int         $user_id
+ * @property string      $title      标题
+ * @property string      $content    内容
+ * @property int         $status     状态:0-待处理、1-已处理未关闭、2-已关闭
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $user
+ * @method static Builder|Ticket newModelQuery()
+ * @method static Builder|Ticket newQuery()
+ * @method static Builder|Ticket query()
+ * @method static Builder|Ticket uid()
+ * @method static Builder|Ticket whereContent($value)
+ * @method static Builder|Ticket whereCreatedAt($value)
+ * @method static Builder|Ticket whereId($value)
+ * @method static Builder|Ticket whereStatus($value)
+ * @method static Builder|Ticket whereTitle($value)
+ * @method static Builder|Ticket whereUpdatedAt($value)
+ * @method static Builder|Ticket whereUserId($value)
  */
 class Ticket extends Model
 {

+ 18 - 0
app/Http/Models/TicketReply.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 工单回复
@@ -11,6 +13,22 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $ticket_id  工单ID
+ * @property int         $user_id    回复人ID
+ * @property string      $content    回复内容
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $user
+ * @method static Builder|TicketReply newModelQuery()
+ * @method static Builder|TicketReply newQuery()
+ * @method static Builder|TicketReply query()
+ * @method static Builder|TicketReply whereContent($value)
+ * @method static Builder|TicketReply whereCreatedAt($value)
+ * @method static Builder|TicketReply whereId($value)
+ * @method static Builder|TicketReply whereTicketId($value)
+ * @method static Builder|TicketReply whereUpdatedAt($value)
+ * @method static Builder|TicketReply whereUserId($value)
  */
 class TicketReply extends Model
 {

+ 96 - 0
app/Http/Models/User.php

@@ -4,8 +4,13 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Foundation\Auth\User as Authenticatable;
+use Illuminate\Notifications\DatabaseNotification;
+use Illuminate\Notifications\DatabaseNotificationCollection;
 use Illuminate\Notifications\Notifiable;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户信息
@@ -13,6 +18,97 @@ use Illuminate\Notifications\Notifiable;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int                                                        $id
+ * @property string                                                     $username             用户名
+ * @property string                                                     $password             密码
+ * @property int                                                        $port                 代理端口
+ * @property string                                                     $passwd               代理密码
+ * @property string                                                     $vmess_id             V2Ray用户ID
+ * @property int                                                        $transfer_enable      可用流量,单位字节,默认1TiB
+ * @property int                                                        $u                    已上传流量,单位字节
+ * @property int                                                        $d                    已下载流量,单位字节
+ * @property int                                                        $t                    最后使用时间
+ * @property string|null                                                $ip                   最后连接IP
+ * @property int                                                        $enable               代理状态
+ * @property string                                                     $method               加密方式
+ * @property string                                                     $protocol             协议
+ * @property string|null                                                $protocol_param       协议参数
+ * @property string                                                     $obfs                 混淆
+ * @property string|null                                                $obfs_param           混淆参数
+ * @property int                                                        $speed_limit_per_con  单连接限速,默认10G,为0表示不限速,单位Byte
+ * @property int                                                        $speed_limit_per_user 单用户限速,默认10G,为0表示不限速,单位Byte
+ * @property string|null                                                $wechat               微信
+ * @property string|null                                                $qq                   QQ
+ * @property string                                                     $usage                用途:1-手机、2-电脑、3-路由器、4-其他
+ * @property int                                                        $pay_way              付费方式:0-免费、1-季付、2-月付、3-半年付、4-年付
+ * @property int                                                        $balance              余额,单位分
+ * @property string|null                                                $enable_time          开通日期
+ * @property string                                                     $expire_time          过期时间
+ * @property int                                                        $ban_time             封禁到期时间
+ * @property string|null                                                $remark               备注
+ * @property int                                                        $level                等级:可定义名称
+ * @property int                                                        $is_admin             是否管理员:0-否、1-是
+ * @property string                                                     $reg_ip               注册IP
+ * @property int                                                        $last_login           最后登录时间
+ * @property int                                                        $referral_uid         邀请人
+ * @property string|null                                                $reset_time           流量重置日期,NULL表示不重置
+ * @property int                                                        $invite_num           可生成邀请码数
+ * @property int                                                        $status               状态:-1-禁用、0-未激活、1-正常
+ * @property string|null                                                $remember_token
+ * @property Carbon|null                                                $created_at
+ * @property Carbon|null                                                $updated_at
+ * @property-read Collection|UserLabel[]                                $label
+ * @property-read int|null                                              $label_count
+ * @property-read Level                                                 $levelList
+ * @property-read DatabaseNotificationCollection|DatabaseNotification[] $notifications
+ * @property-read int|null                                              $notifications_count
+ * @property-read Collection|Payment[]                                  $payment
+ * @property-read int|null                                              $payment_count
+ * @property-read User                                                  $referral
+ * @property-read UserSubscribe                                         $subscribe
+ * @method static Builder|User newModelQuery()
+ * @method static Builder|User newQuery()
+ * @method static Builder|User query()
+ * @method static Builder|User uid()
+ * @method static Builder|User whereBalance($value)
+ * @method static Builder|User whereBanTime($value)
+ * @method static Builder|User whereCreatedAt($value)
+ * @method static Builder|User whereD($value)
+ * @method static Builder|User whereEnable($value)
+ * @method static Builder|User whereEnableTime($value)
+ * @method static Builder|User whereExpireTime($value)
+ * @method static Builder|User whereId($value)
+ * @method static Builder|User whereInviteNum($value)
+ * @method static Builder|User whereIp($value)
+ * @method static Builder|User whereIsAdmin($value)
+ * @method static Builder|User whereLastLogin($value)
+ * @method static Builder|User whereLevel($value)
+ * @method static Builder|User whereMethod($value)
+ * @method static Builder|User whereObfs($value)
+ * @method static Builder|User whereObfsParam($value)
+ * @method static Builder|User wherePasswd($value)
+ * @method static Builder|User wherePassword($value)
+ * @method static Builder|User wherePayWay($value)
+ * @method static Builder|User wherePort($value)
+ * @method static Builder|User whereProtocol($value)
+ * @method static Builder|User whereProtocolParam($value)
+ * @method static Builder|User whereQq($value)
+ * @method static Builder|User whereReferralUid($value)
+ * @method static Builder|User whereRegIp($value)
+ * @method static Builder|User whereRemark($value)
+ * @method static Builder|User whereRememberToken($value)
+ * @method static Builder|User whereResetTime($value)
+ * @method static Builder|User whereSpeedLimitPerCon($value)
+ * @method static Builder|User whereSpeedLimitPerUser($value)
+ * @method static Builder|User whereStatus($value)
+ * @method static Builder|User whereT($value)
+ * @method static Builder|User whereTransferEnable($value)
+ * @method static Builder|User whereU($value)
+ * @method static Builder|User whereUpdatedAt($value)
+ * @method static Builder|User whereUsage($value)
+ * @method static Builder|User whereUsername($value)
+ * @method static Builder|User whereVmessId($value)
+ * @method static Builder|User whereWechat($value)
  */
 class User extends Authenticatable
 {

+ 22 - 1
app/Http/Models/UserBalanceLog.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,12 +12,32 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    账号ID
+ * @property int         $order_id   订单ID
+ * @property int         $before     发生前余额,单位分
+ * @property int         $after      发生后金额,单位分
+ * @property int         $amount     发生金额,单位分
+ * @property string|null $desc       操作描述
+ * @property string|null $created_at 创建时间
+ * @property-read User   $user
+ * @method static Builder|UserBalanceLog newModelQuery()
+ * @method static Builder|UserBalanceLog newQuery()
+ * @method static Builder|UserBalanceLog query()
+ * @method static Builder|UserBalanceLog whereAfter($value)
+ * @method static Builder|UserBalanceLog whereAmount($value)
+ * @method static Builder|UserBalanceLog whereBefore($value)
+ * @method static Builder|UserBalanceLog whereCreatedAt($value)
+ * @method static Builder|UserBalanceLog whereDesc($value)
+ * @method static Builder|UserBalanceLog whereId($value)
+ * @method static Builder|UserBalanceLog whereOrderId($value)
+ * @method static Builder|UserBalanceLog whereUserId($value)
  */
 class UserBalanceLog extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'user_balance_log';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function user()
 	{

+ 20 - 0
app/Http/Models/UserBanLog.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户封禁日志
@@ -11,6 +13,24 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    用户ID
+ * @property int         $minutes    封禁账号时长,单位分钟
+ * @property string      $desc       操作描述
+ * @property int         $status     状态:0-未处理、1-已处理
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $user
+ * @method static Builder|UserBanLog newModelQuery()
+ * @method static Builder|UserBanLog newQuery()
+ * @method static Builder|UserBanLog query()
+ * @method static Builder|UserBanLog whereCreatedAt($value)
+ * @method static Builder|UserBanLog whereDesc($value)
+ * @method static Builder|UserBanLog whereId($value)
+ * @method static Builder|UserBanLog whereMinutes($value)
+ * @method static Builder|UserBanLog whereStatus($value)
+ * @method static Builder|UserBanLog whereUpdatedAt($value)
+ * @method static Builder|UserBanLog whereUserId($value)
  */
 class UserBanLog extends Model
 {

+ 13 - 1
app/Http/Models/UserLabel.php

@@ -4,6 +4,7 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -12,12 +13,23 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int       $id
+ * @property int       $user_id  用户ID
+ * @property int       $label_id 标签ID
+ * @property-read User $user
+ * @method static Builder|UserLabel newModelQuery()
+ * @method static Builder|UserLabel newQuery()
+ * @method static Builder|UserLabel query()
+ * @method static Builder|UserLabel uid()
+ * @method static Builder|UserLabel whereId($value)
+ * @method static Builder|UserLabel whereLabelId($value)
+ * @method static Builder|UserLabel whereUserId($value)
  */
 class UserLabel extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'user_label';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function scopeUid($query)
 	{

+ 28 - 0
app/Http/Models/UserLoginLog.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户登录日志
@@ -11,6 +13,32 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int       $id
+ * @property int       $user_id
+ * @property string    $ip
+ * @property string    $country
+ * @property string    $province
+ * @property string    $city
+ * @property string    $county
+ * @property string    $isp
+ * @property string    $area
+ * @property Carbon    $created_at
+ * @property Carbon    $updated_at
+ * @property-read User $user
+ * @method static Builder|UserLoginLog newModelQuery()
+ * @method static Builder|UserLoginLog newQuery()
+ * @method static Builder|UserLoginLog query()
+ * @method static Builder|UserLoginLog whereArea($value)
+ * @method static Builder|UserLoginLog whereCity($value)
+ * @method static Builder|UserLoginLog whereCountry($value)
+ * @method static Builder|UserLoginLog whereCounty($value)
+ * @method static Builder|UserLoginLog whereCreatedAt($value)
+ * @method static Builder|UserLoginLog whereId($value)
+ * @method static Builder|UserLoginLog whereIp($value)
+ * @method static Builder|UserLoginLog whereIsp($value)
+ * @method static Builder|UserLoginLog whereProvince($value)
+ * @method static Builder|UserLoginLog whereUpdatedAt($value)
+ * @method static Builder|UserLoginLog whereUserId($value)
  */
 class UserLoginLog extends Model
 {

+ 25 - 0
app/Http/Models/UserSubscribe.php

@@ -4,7 +4,9 @@ namespace App\Http\Models;
 
 use Auth;
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户订阅地址
@@ -12,6 +14,29 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    用户ID
+ * @property string|null $code       订阅地址唯一识别码
+ * @property int         $times      地址请求次数
+ * @property int         $status     状态:0-禁用、1-启用
+ * @property int         $ban_time   封禁时间
+ * @property string      $ban_desc   封禁理由
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $user
+ * @method static Builder|UserSubscribe newModelQuery()
+ * @method static Builder|UserSubscribe newQuery()
+ * @method static Builder|UserSubscribe query()
+ * @method static Builder|UserSubscribe uid()
+ * @method static Builder|UserSubscribe whereBanDesc($value)
+ * @method static Builder|UserSubscribe whereBanTime($value)
+ * @method static Builder|UserSubscribe whereCode($value)
+ * @method static Builder|UserSubscribe whereCreatedAt($value)
+ * @method static Builder|UserSubscribe whereId($value)
+ * @method static Builder|UserSubscribe whereStatus($value)
+ * @method static Builder|UserSubscribe whereTimes($value)
+ * @method static Builder|UserSubscribe whereUpdatedAt($value)
+ * @method static Builder|UserSubscribe whereUserId($value)
  */
 class UserSubscribe extends Model
 {

+ 18 - 1
app/Http/Models/UserSubscribeLog.php

@@ -3,6 +3,8 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,12 +13,27 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int                    $id
+ * @property int|null               $sid            对应user_subscribe的id
+ * @property string|null            $request_ip     请求IP
+ * @property string|null            $request_time   请求时间
+ * @property string|null            $request_header 请求头部信息
+ * @property-read Collection|User[] $user
+ * @property-read int|null          $user_count
+ * @method static Builder|UserSubscribeLog newModelQuery()
+ * @method static Builder|UserSubscribeLog newQuery()
+ * @method static Builder|UserSubscribeLog query()
+ * @method static Builder|UserSubscribeLog whereId($value)
+ * @method static Builder|UserSubscribeLog whereRequestHeader($value)
+ * @method static Builder|UserSubscribeLog whereRequestIp($value)
+ * @method static Builder|UserSubscribeLog whereRequestTime($value)
+ * @method static Builder|UserSubscribeLog whereSid($value)
  */
 class UserSubscribeLog extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'user_subscribe_log';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	function user()
 	{

+ 24 - 0
app/Http/Models/UserTrafficDaily.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户每日流量统计
@@ -11,6 +13,28 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    用户ID
+ * @property int         $node_id    节点ID,0表示统计全部节点
+ * @property int         $u          上传流量
+ * @property int         $d          下载流量
+ * @property int         $total      总流量
+ * @property string|null $traffic    总流量(带单位)
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read SsNode $node
+ * @method static Builder|UserTrafficDaily newModelQuery()
+ * @method static Builder|UserTrafficDaily newQuery()
+ * @method static Builder|UserTrafficDaily query()
+ * @method static Builder|UserTrafficDaily whereCreatedAt($value)
+ * @method static Builder|UserTrafficDaily whereD($value)
+ * @method static Builder|UserTrafficDaily whereId($value)
+ * @method static Builder|UserTrafficDaily whereNodeId($value)
+ * @method static Builder|UserTrafficDaily whereTotal($value)
+ * @method static Builder|UserTrafficDaily whereTraffic($value)
+ * @method static Builder|UserTrafficDaily whereU($value)
+ * @method static Builder|UserTrafficDaily whereUpdatedAt($value)
+ * @method static Builder|UserTrafficDaily whereUserId($value)
  */
 class UserTrafficDaily extends Model
 {

+ 24 - 0
app/Http/Models/UserTrafficHourly.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户流量每小时统计
@@ -11,6 +13,28 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id    用户ID
+ * @property int         $node_id    节点ID,0表示统计全部节点
+ * @property int         $u          上传流量
+ * @property int         $d          下载流量
+ * @property int         $total      总流量
+ * @property string|null $traffic    总流量(带单位)
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read SsNode $node
+ * @method static Builder|UserTrafficHourly newModelQuery()
+ * @method static Builder|UserTrafficHourly newQuery()
+ * @method static Builder|UserTrafficHourly query()
+ * @method static Builder|UserTrafficHourly whereCreatedAt($value)
+ * @method static Builder|UserTrafficHourly whereD($value)
+ * @method static Builder|UserTrafficHourly whereId($value)
+ * @method static Builder|UserTrafficHourly whereNodeId($value)
+ * @method static Builder|UserTrafficHourly whereTotal($value)
+ * @method static Builder|UserTrafficHourly whereTraffic($value)
+ * @method static Builder|UserTrafficHourly whereU($value)
+ * @method static Builder|UserTrafficHourly whereUpdatedAt($value)
+ * @method static Builder|UserTrafficHourly whereUserId($value)
  */
 class UserTrafficHourly extends Model
 {

+ 24 - 1
app/Http/Models/UserTrafficLog.php

@@ -3,6 +3,7 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 /**
@@ -11,14 +12,36 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $user_id  用户ID
+ * @property int         $u        上传流量
+ * @property int         $d        下载流量
+ * @property int         $node_id  节点ID
+ * @property float       $rate     流量比例
+ * @property string      $traffic  产生流量
+ * @property int         $log_time 记录时间
+ * @property-read SsNode $node
+ * @property-read User   $user
+ * @method static Builder|UserTrafficLog newModelQuery()
+ * @method static Builder|UserTrafficLog newQuery()
+ * @method static Builder|UserTrafficLog query()
+ * @method static Builder|UserTrafficLog whereD($value)
+ * @method static Builder|UserTrafficLog whereId($value)
+ * @method static Builder|UserTrafficLog whereLogTime($value)
+ * @method static Builder|UserTrafficLog whereNodeId($value)
+ * @method static Builder|UserTrafficLog whereRate($value)
+ * @method static Builder|UserTrafficLog whereTraffic($value)
+ * @method static Builder|UserTrafficLog whereU($value)
+ * @method static Builder|UserTrafficLog whereUserId($value)
  */
 class UserTrafficLog extends Model
 {
+	public $timestamps = FALSE;
 	protected $table = 'user_traffic_log';
 	protected $primaryKey = 'id';
-	public $timestamps = FALSE;
 
 	// 关联账号
+
 	function user()
 	{
 		return $this->belongsTo(User::class, 'user_id', 'id');

+ 23 - 0
app/Http/Models/UserTrafficModifyLog.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 用户流量变动记录
@@ -11,6 +13,27 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int        $id
+ * @property int        $user_id  用户ID
+ * @property int        $order_id 发生的订单ID
+ * @property int        $before   操作前流量
+ * @property int        $after    操作后流量
+ * @property string     $desc     描述
+ * @property Carbon     $created_at
+ * @property Carbon     $updated_at
+ * @property-read Order $order
+ * @property-read User  $user
+ * @method static Builder|UserTrafficModifyLog newModelQuery()
+ * @method static Builder|UserTrafficModifyLog newQuery()
+ * @method static Builder|UserTrafficModifyLog query()
+ * @method static Builder|UserTrafficModifyLog whereAfter($value)
+ * @method static Builder|UserTrafficModifyLog whereBefore($value)
+ * @method static Builder|UserTrafficModifyLog whereCreatedAt($value)
+ * @method static Builder|UserTrafficModifyLog whereDesc($value)
+ * @method static Builder|UserTrafficModifyLog whereId($value)
+ * @method static Builder|UserTrafficModifyLog whereOrderId($value)
+ * @method static Builder|UserTrafficModifyLog whereUpdatedAt($value)
+ * @method static Builder|UserTrafficModifyLog whereUserId($value)
  */
 class UserTrafficModifyLog extends Model
 {

+ 21 - 0
app/Http/Models/Verify.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 注册时的验证激活地址
@@ -11,6 +13,25 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property int         $type       激活类型:1-自行激活、2-管理员激活
+ * @property int         $user_id    用户ID
+ * @property string      $token      校验token
+ * @property int         $status     状态:0-未使用、1-已使用、2-已失效
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @property-read User   $user
+ * @method static Builder|Verify newModelQuery()
+ * @method static Builder|Verify newQuery()
+ * @method static Builder|Verify query()
+ * @method static Builder|Verify type($type)
+ * @method static Builder|Verify whereCreatedAt($value)
+ * @method static Builder|Verify whereId($value)
+ * @method static Builder|Verify whereStatus($value)
+ * @method static Builder|Verify whereToken($value)
+ * @method static Builder|Verify whereType($value)
+ * @method static Builder|Verify whereUpdatedAt($value)
+ * @method static Builder|Verify whereUserId($value)
  */
 class Verify extends Model
 {

+ 17 - 0
app/Http/Models/VerifyCode.php

@@ -3,7 +3,9 @@
 namespace App\Http\Models;
 
 use Eloquent;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Support\Carbon;
 
 /**
  * 注册时的激活验证码
@@ -11,6 +13,21 @@ use Illuminate\Database\Eloquent\Model;
  *
  * @package App\Http\Models
  * @mixin Eloquent
+ * @property int         $id
+ * @property string      $username   用户邮箱
+ * @property string      $code       验证码
+ * @property int         $status     状态:0-未使用、1-已使用、2-已失效
+ * @property Carbon|null $created_at 创建时间
+ * @property Carbon|null $updated_at 最后更新时间
+ * @method static Builder|VerifyCode newModelQuery()
+ * @method static Builder|VerifyCode newQuery()
+ * @method static Builder|VerifyCode query()
+ * @method static Builder|VerifyCode whereCode($value)
+ * @method static Builder|VerifyCode whereCreatedAt($value)
+ * @method static Builder|VerifyCode whereId($value)
+ * @method static Builder|VerifyCode whereStatus($value)
+ * @method static Builder|VerifyCode whereUpdatedAt($value)
+ * @method static Builder|VerifyCode whereUsername($value)
  */
 class VerifyCode extends Model
 {

+ 0 - 39
app/Mail/closeOrder.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Mail;
-
-use App\Http\Models\EmailLog;
-use Illuminate\Bus\Queueable;
-use Illuminate\Mail\Mailable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Contracts\Queue\ShouldQueue;
-
-class closeOrder extends Mailable implements ShouldQueue
-{
-    use Queueable, SerializesModels;
-
-    protected $id; // 邮件记录ID
-    protected $title; // 邮件标题
-    protected $content; // 邮件内容
-
-    public function __construct($id, $title, $content)
-    {
-        $this->id = $id;
-        $this->title = $title;
-        $this->content = $content;
-    }
-
-    public function build()
-    {
-        return $this->view('emails.closeOrder')->subject('订单关闭通知')->with([
-            'title'   => $this->title,
-            'content' => $this->content
-        ]);
-    }
-
-    // 发件失败处理
-    public function failed(\Exception $e)
-    {
-        EmailLog::query()->where('id', $this->id)->update(['status' => -1, 'error' => $e->getMessage()]);
-    }
-}

+ 0 - 39
app/Mail/sendCustomMessage.php

@@ -1,39 +0,0 @@
-<?php
-
-namespace App\Mail;
-
-use App\Http\Models\EmailLog;
-use Illuminate\Bus\Queueable;
-use Illuminate\Mail\Mailable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Contracts\Queue\ShouldQueue;
-
-class sendCustomMessage extends Mailable implements ShouldQueue
-{
-    use Queueable, SerializesModels;
-
-    protected $id; // 邮件记录ID
-    protected $title; // 邮件标题
-    protected $content; // 邮件内容
-
-    public function __construct($id, $title, $content)
-    {
-        $this->id = $id;
-        $this->title = $title;
-        $this->content = $content;
-    }
-
-    public function build()
-    {
-        return $this->view('emails.sendCustomMessage')->subject($this->title)->with([
-            'title'   => $this->title,
-            'content' => $this->content
-        ]);
-    }
-
-    // 发件失败处理
-    public function failed(\Exception $e)
-    {
-        EmailLog::query()->where('id', $this->id)->update(['status' => -1, 'error' => $e->getMessage()]);
-    }
-}

+ 0 - 38
app/Mail/userTrafficAbnormalWarning.php

@@ -1,38 +0,0 @@
-<?php
-
-namespace App\Mail;
-
-use App\Http\Models\EmailLog;
-use Illuminate\Bus\Queueable;
-use Illuminate\Mail\Mailable;
-use Illuminate\Queue\SerializesModels;
-use Illuminate\Contracts\Queue\ShouldQueue;
-
-class userTrafficAbnormalWarning extends Mailable implements ShouldQueue
-{
-    use Queueable, SerializesModels;
-
-    protected $id; // 邮件记录ID
-    protected $title; // 邮件标题
-    protected $content; // 邮件内容
-
-    public function __construct($id, $title, $content)
-    {
-        $this->id = $id;
-        $this->title = $title;
-        $this->content = $content;
-    }
-
-    public function build()
-    {
-        return $this->view('emails.userTrafficAbnormalWarning')->subject('流量异常警告')->with([
-            'content' => $this->content
-        ]);
-    }
-
-    // 发件失败处理
-    public function failed(\Exception $e)
-    {
-        EmailLog::query()->where('id', $this->id)->update(['status' => -1, 'error' => $e->getMessage()]);
-    }
-}

+ 11 - 11
app/Providers/RouteServiceProvider.php

@@ -43,31 +43,31 @@ class RouteServiceProvider extends ServiceProvider
 	}
 
 	/**
-	 * Define the "web" routes for the application.
+	 * Define the "api" routes for the application.
 	 *
-	 * These routes all receive session state, CSRF protection, etc.
+	 * These routes are typically stateless.
 	 *
 	 * @return void
 	 */
-	protected function mapWebRoutes()
+	protected function mapApiRoutes()
 	{
-		Route::middleware('web')
+		Route::prefix('api')
+			->middleware('api')
 			->namespace($this->namespace)
-			->group(base_path('routes/web.php'));
+			->group(base_path('routes/api.php'));
 	}
 
 	/**
-	 * Define the "api" routes for the application.
+	 * Define the "web" routes for the application.
 	 *
-	 * These routes are typically stateless.
+	 * These routes all receive session state, CSRF protection, etc.
 	 *
 	 * @return void
 	 */
-	protected function mapApiRoutes()
+	protected function mapWebRoutes()
 	{
-		Route::prefix('api')
-			->middleware('api')
+		Route::middleware('web')
 			->namespace($this->namespace)
-			->group(base_path('routes/api.php'));
+			->group(base_path('routes/web.php'));
 	}
 }

+ 30 - 21
composer.json

@@ -1,41 +1,45 @@
 {
   "name": "laravel/laravel",
   "description": "The Laravel Framework.",
-    "keywords": ["framework", "laravel"],
+  "keywords": [
+    "framework",
+    "laravel"
+  ],
   "license": "MIT",
   "type": "project",
   "require": {
-    "php": "^7.1.3",
-    "fideloper/proxy": "^4.0",
-    "guzzlehttp/guzzle": "^6.3",
+    "php": "^7.2",
+    "ext-curl": "*",
+    "ext-json": "*",
+    "ext-openssl": "*",
+    "ext-dom": "*",
+    "barryvdh/laravel-debugbar": "^3.2",
+    "barryvdh/laravel-ide-helper": "^2.6",
+    "fideloper/proxy": "^4.2",
+    "guzzlehttp/guzzle": "^6.5",
     "ipip/db": "^1.0",
     "itbdw/ip-database": "^2.0",
     "jenssegers/agent": "^2.6",
-    "laravel/framework": "5.6.*",
-    "laravel/tinker": "^1.0",
-    "mews/captcha": "^2.2",
-    "mews/purifier": "^2.1",
+    "laravel/framework": "5.8.*",
+    "laravel/tinker": "~1.0",
+    "mews/captcha": "^3.0",
+    "mews/purifier": "^3.1",
     "misechow/geetest": "^1.0",
     "misechow/no-captcha": "^1.0",
-    "openlss/lib-array2xml": "^0.5.1",
+    "openlss/lib-array2xml": "^1.0",
     "overtrue/laravel-lang": "^3.0",
-    "phpoffice/phpspreadsheet": "^1.6",
+    "phpoffice/phpspreadsheet": "^1.10",
     "predis/predis": "^1.1",
-    "rap2hpoutre/laravel-log-viewer": "^1.0",
+    "rap2hpoutre/laravel-log-viewer": "^1.3",
     "riverslei/payment": "*",
-    "spatie/laravel-permission": "^2.29",
-    "youzanyun/open-sdk": "^2.0",
-    "ext-json": "*",
-    "ext-curl": "*"
+    "spatie/laravel-permission": "^3.4"
   },
   "require-dev": {
-    "barryvdh/laravel-debugbar": "^3.2",
-    "barryvdh/laravel-ide-helper": "^2.6",
-    "filp/whoops": "^2.0",
-    "fzaninotto/faker": "^1.4",
+    "filp/whoops": "^2.7",
+    "fzaninotto/faker": "^1.9",
     "mockery/mockery": "^1.0",
-    "nunomaduro/collision": "^2.0",
-    "phpunit/phpunit": "^7.0"
+    "nunomaduro/collision": "^3.0",
+    "phpunit/phpunit": "^8.0"
   },
   "autoload": {
     "files": [
@@ -64,6 +68,11 @@
     "post-root-package-install": [
       "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
     ],
+    "post-update-cmd": [
+      "Illuminate\\Foundation\\ComposerScripts::postUpdate",
+      "@php artisan ide-helper:generate",
+      "@php artisan ide-helper:meta"
+    ],
     "post-create-project-cmd": [
       "@php artisan key:generate"
     ]

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 360 - 294
composer.lock


BIN
composer.phar


+ 4 - 3
config/app.php

@@ -124,8 +124,6 @@ return [
 		/*
 		 * Laravel Framework Service Providers...
 		 */
-		Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
-		Barryvdh\Debugbar\ServiceProvider::class,
 		Illuminate\Auth\AuthServiceProvider::class,
 		Illuminate\Broadcasting\BroadcastServiceProvider::class,
 		Illuminate\Bus\BusServiceProvider::class,
@@ -149,13 +147,16 @@ return [
 		Illuminate\Validation\ValidationServiceProvider::class,
 		Illuminate\View\ViewServiceProvider::class,
 
-
 		/*
 		* Package Service Providers...
 		*/
+		Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class, //IDE帮助
+		Barryvdh\Debugbar\ServiceProvider::class,//Debug工具
+		Jenssegers\Agent\AgentServiceProvider::class, //用户浏览器检测
 		Misechow\Geetest\GeetestServiceProvider::class,  // Geetest极验
 		Misechow\NoCaptcha\NoCaptchaServiceProvider::class, // Google reCAPTCHA
 		Overtrue\LaravelLang\TranslationServiceProvider::class, // 多国语言包功能
+		Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,//日志查看
 
 		/*
 		 * Application Service Providers...

+ 1 - 1
config/version.php

@@ -1,6 +1,6 @@
 <?php
 
 return [
-	'number' => '450',
+	'number' => '210',
 	'name'   => 'SSRPanel_OtakuMod'
 ];

+ 2 - 0
public/assets/custom/jump-tab.js

@@ -0,0 +1,2 @@
+// tab 转跳
+const url=window.location.href;if(url.indexOf("#")>0){const activeTab=url.substring(url.indexOf("#")+1);$('.nav[role="tablist"] a[href="#'+activeTab+'"]').tab('show')}$(document).ready(()=>{$('a[role="tab"]').on("click",function(){const hash=$(this).attr("href");let newUrl=url.split("#")[0]+hash;history.replaceState(null,null,newUrl)})});

+ 4 - 4
resources/lang/en/auth.php

@@ -12,7 +12,7 @@ return [
 	'tip'                    => 'Tip',
 	'username'               => 'Email',
 	'password'               => 'Password',
-	'retype_password'        => 'Please renter your password',
+	'confirm_password'       => 'Please renter your password',
 	'back'                   => 'Back',
 	'close'                  => 'Close',
 	'submit'                 => 'Submit',
@@ -60,13 +60,13 @@ return [
 	'register_anti'              => 'Anti-robot registration is enabled! Please do not register Multiple accounts',
 	'register_fail'              => 'Registration failed, please try later',
 	'register_success'           => 'Registered successfully',
-	'register_success_tip'       => 'Activation email sent! Please check the mailbox (the email may be in the Trash)',
+	'register_active_tip'        => 'Activation email sent! Please check the mailbox (the email may be in the Trash)',
 	"repeat_request"             => 'Please refresh the page and try again',
 	"reset_password_close"       => '"Find my Password"function is disabled.If you need help, Please email :email',
 	'reset_password_limit'       => 'Password can only be reset :time times within 24 hours!',
 	'reset_password_success_tip' => 'Reset successfully! Please check the mailbox (the email may be in the Trash)',
-	'reset_password_same_fail'    => 'The new password is the same as the old one. Please renter',
-	'reset_password_fail'         => 'Password reset failed',
+	'reset_password_same_fail'   => 'The new password is the same as the old one. Please renter',
+	'reset_password_fail'        => 'Password reset failed',
 	'reset_password_new'         => 'The new password has been set successfully!',
 	'request_error'              => 'Request exception, Please refresh and try again'
 ];

+ 1 - 0
resources/lang/en/error.php

@@ -8,6 +8,7 @@ return [
 	'ForbiddenOversea' => 'Oversea IP or Proxy Access Forbidden',
 	'MissingPage'      => 'Page Not Found',
 	'Unauthorized'     => 'Unauthorized visit',
+	'Refresh'          => 'Refresh',
 	'RefreshPage'      => 'Refresh Page, Try One More Time',
 	'SystemError'      => 'System Error',
 	'Visit'            => 'Please visit',

+ 3 - 3
resources/lang/ja/auth.php

@@ -18,7 +18,7 @@ return [
 	'loading_captcha'      => '確認コードを読み込んでいます...',
 	'required_captcha'     => '確認コードの操作を正しく完了してください',
 	'fail_captcha'         => 'サーバーの確認に失敗しました。もう一度お試しください',
-	'retype_password'      => 'パスワードの確認',
+	'confirm_password'     => 'パスワードの確認',
 	'code'                 => '招待コード',
 	'send'                 => '送 信',
 	'tnc_button'           => '私はすでに読んで守ることに同意した',
@@ -40,7 +40,7 @@ return [
 	'register'               => 'ログイン',
 	'username'               => 'メール',
 	'password'               => 'パスワード',
-	'retype_password'        => 'パスワードの確認',
+	'confirm_password'       => 'パスワードの確認',
 	'back'                   => 'Back',
 	'close'                  => 'Close',
 	'submit'                 => 'Submit',
@@ -88,7 +88,7 @@ return [
 	'register_anti'              => 'Anti-robot registration is enabled! Please do not register Multiple accounts',
 	'register_fail'              => 'Registration failed, please try later',
 	'register_success'           => 'Registered successfully',
-	'register_success_tip'       => 'Activation email sent! Please check the mailbox (the email may be in the Trash)',
+	'register_active_tip'        => 'Activation email sent! Please check the mailbox (the email may be in the Trash)',
 	"repeat_request"             => 'Please refresh the page and try again',
 	"reset_password_close"       => '"Find my Password"function is disabled.If you need help, Please email :email',
 	'reset_password_limit'       => 'Password can only be reset :time times within 24 hours!',

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно