Browse Source

Apply fixes from StyleCI (#55)

兔姬桑 4 years ago
parent
commit
b6c59803da
100 changed files with 459 additions and 471 deletions
  1. 8 10
      app/Components/CaptchaVerify.php
  2. 5 8
      app/Components/DDNS.php
  3. 3 3
      app/Components/DDNS/Aliyun.php
  4. 1 1
      app/Components/DDNS/CloudFlare.php
  5. 2 2
      app/Components/DDNS/DNSPod.php
  6. 11 12
      app/Components/Helpers.php
  7. 7 7
      app/Components/IP.php
  8. 15 15
      app/Components/NetworkDetection.php
  9. 3 4
      app/Components/PushNotification.php
  10. 1 1
      app/Components/QQInfo.php
  11. 7 7
      app/Console/Commands/AutoClearLog.php
  12. 10 10
      app/Console/Commands/AutoJob.php
  13. 5 5
      app/Console/Commands/AutoPingNode.php
  14. 1 1
      app/Console/Commands/AutoReportNode.php
  15. 1 1
      app/Console/Commands/AutoStatisticsNodeHourlyTraffic.php
  16. 1 1
      app/Console/Commands/AutoStatisticsUserHourlyTraffic.php
  17. 4 4
      app/Console/Commands/DailyJob.php
  18. 9 10
      app/Console/Commands/NodeBlockedDetection.php
  19. 4 4
      app/Console/Commands/UserTrafficAbnormalAutoWarning.php
  20. 1 1
      app/Console/Commands/UserTrafficAutoWarning.php
  21. 3 3
      app/Console/Commands/fixDailyTrafficLogError.php
  22. 1 1
      app/Console/Commands/updateUserName.php
  23. 10 10
      app/Console/Commands/upgradeUserResetTime.php
  24. 0 1
      app/Console/Kernel.php
  25. 2 3
      app/Exceptions/Handler.php
  26. 1 4
      app/Http/Controllers/Admin/AffiliateController.php
  27. 3 4
      app/Http/Controllers/Admin/ArticleController.php
  28. 2 4
      app/Http/Controllers/Admin/Config/CountryController.php
  29. 1 1
      app/Http/Controllers/Admin/Config/SsConfigController.php
  30. 2 4
      app/Http/Controllers/Admin/CouponController.php
  31. 32 12
      app/Http/Controllers/Admin/LogsController.php
  32. 3 5
      app/Http/Controllers/Admin/MarketingController.php
  33. 8 8
      app/Http/Controllers/Admin/NodeController.php
  34. 3 1
      app/Http/Controllers/Admin/RuleController.php
  35. 2 2
      app/Http/Controllers/Admin/RuleGroupController.php
  36. 3 5
      app/Http/Controllers/Admin/ShopController.php
  37. 1 3
      app/Http/Controllers/Admin/SubscribeController.php
  38. 20 20
      app/Http/Controllers/Admin/SystemController.php
  39. 10 13
      app/Http/Controllers/Admin/TicketController.php
  40. 10 10
      app/Http/Controllers/Admin/ToolsController.php
  41. 12 13
      app/Http/Controllers/Admin/UserController.php
  42. 1 1
      app/Http/Controllers/Admin/UserGroupController.php
  43. 15 14
      app/Http/Controllers/AdminController.php
  44. 5 6
      app/Http/Controllers/Api/WebApi/BaseController.php
  45. 20 20
      app/Http/Controllers/Api/WebApi/V2RayController.php
  46. 15 16
      app/Http/Controllers/Api/WebApi/VNetController.php
  47. 29 32
      app/Http/Controllers/AuthController.php
  48. 26 26
      app/Http/Controllers/Controller.php
  49. 1 1
      app/Http/Controllers/Gateway/AbstractPayment.php
  50. 0 1
      app/Http/Controllers/Gateway/EPay.php
  51. 8 8
      app/Http/Controllers/Gateway/F2Fpay.php
  52. 3 2
      app/Http/Controllers/Gateway/Local.php
  53. 4 5
      app/Http/Controllers/Gateway/PayPal.php
  54. 10 12
      app/Http/Controllers/PaymentController.php
  55. 1 2
      app/Http/Controllers/User/AffiliateController.php
  56. 6 6
      app/Http/Controllers/User/SubscribeController.php
  57. 23 23
      app/Http/Controllers/UserController.php
  58. 1 1
      app/Http/Middleware/Affiliate.php
  59. 1 1
      app/Http/Middleware/Authenticate.php
  60. 1 1
      app/Http/Middleware/VerifyCsrfToken.php
  61. 4 4
      app/Http/Middleware/WebApi.php
  62. 2 2
      app/Http/Middleware/isAdmin.php
  63. 8 9
      app/Http/Middleware/isForbidden.php
  64. 1 1
      app/Http/Middleware/isLogin.php
  65. 1 1
      app/Http/Middleware/isMaintenance.php
  66. 3 3
      app/Http/Middleware/isSecurity.php
  67. 1 1
      app/Http/Requests/Admin/NodeRequest.php
  68. 1 1
      app/Jobs/VNet/reloadNode.php
  69. 1 1
      app/Models/Article.php
  70. 1 1
      app/Models/Config.php
  71. 1 1
      app/Models/Country.php
  72. 1 1
      app/Models/Coupon.php
  73. 1 1
      app/Models/CouponLog.php
  74. 1 1
      app/Models/EmailFilter.php
  75. 1 1
      app/Models/Label.php
  76. 1 1
      app/Models/Level.php
  77. 1 1
      app/Models/Node.php
  78. 1 1
      app/Models/NodeAuth.php
  79. 1 1
      app/Models/NodeCertificate.php
  80. 2 2
      app/Models/NodeHeartBeat.php
  81. 1 1
      app/Models/NodeLabel.php
  82. 1 1
      app/Models/NodeOnlineLog.php
  83. 1 1
      app/Models/NodeOnlineUserIp.php
  84. 1 1
      app/Models/NodeRule.php
  85. 1 1
      app/Models/NotificationLog.php
  86. 8 5
      app/Models/Order.php
  87. 1 1
      app/Models/Payment.php
  88. 1 1
      app/Models/PaymentCallback.php
  89. 1 1
      app/Models/ProductsPool.php
  90. 1 1
      app/Models/ReferralApply.php
  91. 1 1
      app/Models/ReferralLog.php
  92. 1 1
      app/Models/Rule.php
  93. 1 1
      app/Models/RuleGroup.php
  94. 1 1
      app/Models/RuleGroupNode.php
  95. 1 1
      app/Models/RuleLog.php
  96. 1 1
      app/Models/SsConfig.php
  97. 1 1
      app/Models/Ticket.php
  98. 1 1
      app/Models/TicketReply.php
  99. 1 1
      app/Models/User.php
  100. 1 1
      app/Models/UserBanedLog.php

+ 8 - 10
app/Components/CaptchaVerify.php

@@ -4,8 +4,6 @@ namespace App\Components;
 
 /**
  * Class CaptchaVerify 验证码
- *
- * @package App\Components
  */
 class CaptchaVerify
 {
@@ -13,9 +11,9 @@ class CaptchaVerify
     public static function hCaptchaGetConfig(): array
     {
         return [
-            "sitekey" => sysConfig('hcaptcha_sitekey'),
-            "secret"  => sysConfig('hcaptcha_secret'),
-            "options" => [],
+            'sitekey' => sysConfig('hcaptcha_sitekey'),
+            'secret'  => sysConfig('hcaptcha_secret'),
+            'options' => [],
         ];
     }
 
@@ -23,8 +21,8 @@ class CaptchaVerify
     public static function geetestCaptchaGetConfig(): array
     {
         return [
-            "geetest_id"  => sysConfig('geetest_id'),
-            "geetest_key" => sysConfig('geetest_key'),
+            'geetest_id'  => sysConfig('geetest_id'),
+            'geetest_key' => sysConfig('geetest_key'),
         ];
     }
 
@@ -32,9 +30,9 @@ class CaptchaVerify
     public static function googleCaptchaGetConfig(): array
     {
         return [
-            "sitekey" => sysConfig('google_captcha_sitekey'),
-            "secret"  => sysConfig('google_captcha_secret'),
-            "options" => [],
+            'sitekey' => sysConfig('google_captcha_sitekey'),
+            'secret'  => sysConfig('google_captcha_secret'),
+            'options' => [],
         ];
     }
 }

+ 5 - 8
app/Components/DDNS.php

@@ -9,14 +9,12 @@ use App\Components\DDNS\Namesilo;
 use Log;
 
 /**
- * Class DDNS 域名解析
- *
- * @package App\Components
+ * Class DDNS 域名解析.
  */
 class DDNS
 {
     /**
-     * 删除解析记录
+     * 删除解析记录.
      *
      * @param  string  $domain  域名
      * @param  string|null  $type
@@ -39,14 +37,14 @@ class DDNS
             case 'cloudflare':
                 return new CloudFlare($domain);
             default:
-                Log::error("未知渠道:".sysConfig('ddns_mode'));
+                Log::error('未知渠道:'.sysConfig('ddns_mode'));
 
                 return false;
         }
     }
 
     /**
-     * 修改解析记录
+     * 修改解析记录.
      *
      * @param  string  $domain  域名
      * @param  string  $ip  ip地址
@@ -59,7 +57,7 @@ class DDNS
     }
 
     /**
-     * 添加解析记录
+     * 添加解析记录.
      *
      * @param  string  $domain  域名
      * @param  string  $ip  ip地址
@@ -70,5 +68,4 @@ class DDNS
     {
         return self::dnsProvider($domain)->store($ip, $type);
     }
-
 }

+ 3 - 3
app/Components/DDNS/Aliyun.php

@@ -61,9 +61,9 @@ class Aliyun
             'Version'          => '2015-01-09',
             'AccessKeyId'      => sysConfig('ddns_key'),
             'SignatureMethod'  => 'HMAC-SHA1',
-            'Timestamp'        => gmdate("Y-m-d\TH:i:s\Z"),//公共参数Timestamp GMT时间
+            'Timestamp'        => gmdate("Y-m-d\TH:i:s\Z"), //公共参数Timestamp GMT时间
             'SignatureVersion' => '1.0',
-            'SignatureNonce'   => str_replace('.', '', microtime(true)),//唯一数,用于防止网络重放攻击
+            'SignatureNonce'   => str_replace('.', '', microtime(true)), //唯一数,用于防止网络重放攻击
         ];
         $parameters = array_merge(['Action' => $action], $data, $public);
         $parameters['Signature'] = $this->computeSignature($parameters);
@@ -107,7 +107,7 @@ class Aliyun
     }
 
     /**
-     * 域名信息
+     * 域名信息.
      *
      * @param  string|null  $type  记录类型,默认为 null
      * @return array|false

+ 1 - 1
app/Components/DDNS/CloudFlare.php

@@ -66,7 +66,7 @@ class CloudFlare
             }
 
             $message = $response->json();
-            if ($message && !$response->failed()) {
+            if ($message && ! $response->failed()) {
                 return $message;
             }
 

+ 2 - 2
app/Components/DDNS/DNSPod.php

@@ -68,8 +68,8 @@ class DNSPod
         $response = Http::timeout(15)->asForm()->post(self::$apiHost.$action, $parameters);
         $message = $response->json();
 
-        if ($response->failed() || ($message && Arr::has($message, 'status.code') && $message['status']['code'] !== "1")) {
-            if ($message && Arr::has($message, 'status.code') && $message['status']['code'] !== "1") {
+        if ($response->failed() || ($message && Arr::has($message, 'status.code') && $message['status']['code'] !== '1')) {
+            if ($message && Arr::has($message, 'status.code') && $message['status']['code'] !== '1') {
                 $error = $message['status']['message'];
             } else {
                 $error = $response->body();

+ 11 - 12
app/Components/Helpers.php

@@ -16,7 +16,6 @@ use Str;
 
 class Helpers
 {
-
     // 不生成的端口
     private static $denyPorts = [
         1068, 1109, 1434, 3127, 3128, 3129, 3130, 3332, 4444, 5554, 6669, 8080, 8081, 8082, 8181, 8282, 9996, 17185, 24554, 35601, 60177, 60179,
@@ -52,7 +51,7 @@ class Helpers
     }
 
     /**
-     * 添加用户
+     * 添加用户.
      *
      * @param  string  $email  用户邮箱
      * @param  string  $password  用户密码
@@ -77,7 +76,7 @@ class Helpers
         $user->protocol = self::getDefaultProtocol();
         $user->obfs = self::getDefaultObfs();
         $user->transfer_enable = $transfer_enable;
-        $user->expired_at = date('Y-m-d', strtotime("+".$data." days"));
+        $user->expired_at = date('Y-m-d', strtotime('+'.$data.' days'));
         $user->reg_ip = IP::getClientIp();
         $user->inviter_id = $inviter_id;
         $user->reset_time = null;
@@ -97,7 +96,7 @@ class Helpers
             $exists_port = array_merge(User::where('port', '>=', $port)->pluck('port')->toArray(), self::$denyPorts);
 
             while (in_array($port, $exists_port, true)) {
-                ++$port;
+                $port++;
             }
         }
 
@@ -148,7 +147,7 @@ class Helpers
     public static function cacheSysConfig($name)
     {
         if ($name === 'is_onlinePay') {
-            $value = !empty(array_filter(Cache::tags('sysConfig')->many(['is_AliPay', 'is_QQPay', 'is_WeChatPay', 'is_otherPay'])));
+            $value = ! empty(array_filter(Cache::tags('sysConfig')->many(['is_AliPay', 'is_QQPay', 'is_WeChatPay', 'is_otherPay'])));
             Cache::tags('sysConfig')->put('is_onlinePay', $value);
         } else {
             $value = Config::find($name)->value;
@@ -164,7 +163,7 @@ class Helpers
     }
 
     /**
-     * 添加通知推送日志
+     * 添加通知推送日志.
      *
      * @param  string  $title  标题
      * @param  string  $content  内容
@@ -189,7 +188,7 @@ class Helpers
     }
 
     /**
-     * 添加优惠券操作日志
+     * 添加优惠券操作日志.
      *
      * @param  string  $description  备注
      * @param  int  $couponId  优惠券ID
@@ -210,7 +209,7 @@ class Helpers
     }
 
     /**
-     * 记录余额操作日志
+     * 记录余额操作日志.
      *
      * @param  int  $userId  用户ID
      * @param  int  $orderId  订单ID
@@ -236,7 +235,7 @@ class Helpers
     }
 
     /**
-     * 记录流量变动日志
+     * 记录流量变动日志.
      *
      * @param  int  $userId  用户ID
      * @param  int  $orderId  订单ID
@@ -262,12 +261,12 @@ class Helpers
     {
         $req = request();
         // Only for "GET" method
-        if (!$req->isMethod('GET')) {
-            return "";
+        if (! $req->isMethod('GET')) {
+            return '';
         }
 
         $etag = sha1(json_encode($data));
-        if ($etag == $req->header("IF-NONE-MATCH")) {
+        if ($etag == $req->header('IF-NONE-MATCH')) {
             abort(304);
         }
 

+ 7 - 7
app/Components/IP.php

@@ -23,7 +23,7 @@ class IP
             $ipInfo = self::IPSB($ip);
         } else {
             $ipInfo = self::ip2Region($ip);
-            if (!$ipInfo) {
+            if (! $ipInfo) {
                 Log::info('无法识别,尝试使用【IPIP库】库解析:'.$ip);
                 $ipInfo = self::ip2Location($ip);
             }
@@ -57,7 +57,7 @@ class IP
         }
 
         if ($ipInfo) {
-            $location = explode("|", $ipInfo['region']);
+            $location = explode('|', $ipInfo['region']);
 
             return [
                 'country'  => $location[0] ?: '',
@@ -75,7 +75,7 @@ class IP
         $filePath = database_path('IP2LOCATION-LITE-DB3.IPV6.BIN');
         try {
             $location = (new Database($filePath, Database::FILE_IO))
-                ->lookup($ip, [Database::CITY_NAME, Database::REGION_NAME, Database::COUNTRY_NAME,]);
+                ->lookup($ip, [Database::CITY_NAME, Database::REGION_NAME, Database::COUNTRY_NAME]);
 
             return [
                 'country'  => $location['countryName'],
@@ -112,9 +112,9 @@ class IP
             $message = $response->json();
             if ($message['code'] === 0) {
                 return [
-                    'country'  => $message['data']['country'] === "XX" ? '' : $message['data']['country'],
-                    'province' => $message['data']['region'] === "XX" ? '' : $message['data']['region'],
-                    'city'     => $message['data']['city'] === "XX" ? '' : $message['data']['city'],
+                    'country'  => $message['data']['country'] === 'XX' ? '' : $message['data']['country'],
+                    'province' => $message['data']['region'] === 'XX' ? '' : $message['data']['region'],
+                    'city'     => $message['data']['city'] === 'XX' ? '' : $message['data']['city'],
                 ];
             }
 
@@ -129,7 +129,7 @@ class IP
     // 通过api.map.baidu.com查询IP地址的详细信息
     public static function Baidu(string $ip)
     {
-        if (!env('BAIDU_APP_AK')) {
+        if (! env('BAIDU_APP_AK')) {
             Log::error('【百度IP库】AK信息缺失');
 
             return false;

+ 15 - 15
app/Components/NetworkDetection.php

@@ -8,7 +8,7 @@ use Log;
 class NetworkDetection
 {
     /**
-     * 用api.50network.com进行节点阻断检测
+     * 用api.50network.com进行节点阻断检测.
      *
      * @param  string  $ip  被检测的IP
      * @param  bool  $type  TRUE 为ICMP,FALSE 为tcp
@@ -25,44 +25,44 @@ class NetworkDetection
 
         if ($response->ok()) {
             $message = $response->json();
-            if (!$message) {
-                Log::warning("【".$checkName."阻断检测】检测".$ip."时,接口返回异常访问链接:".$url);
+            if (! $message) {
+                Log::warning('【'.$checkName.'阻断检测】检测'.$ip.'时,接口返回异常访问链接:'.$url);
 
                 return false;
             }
 
-            if (!$message['success']) {
-                if ($message['error'] === "execute timeout (3s)") {
+            if (! $message['success']) {
+                if ($message['error'] === 'execute timeout (3s)') {
                     sleep(10);
 
                     return self::networkCheck($ip, $type, $port);
                 }
 
-                Log::warning("【".$checkName."阻断检测】检测".$ip.$port."时,返回".var_export($message, true));
+                Log::warning('【'.$checkName.'阻断检测】检测'.$ip.$port.'时,返回'.var_export($message, true));
 
                 return false;
             }
 
             if ($message['firewall-enable'] && $message['firewall-disable']) {
-                return "通讯正常"; // 正常
+                return '通讯正常'; // 正常
             }
 
-            if ($message['firewall-enable'] && !$message['firewall-disable']) {
-                return "海外阻断"; // 国外访问异常
+            if ($message['firewall-enable'] && ! $message['firewall-disable']) {
+                return '海外阻断'; // 国外访问异常
             }
 
-            if (!$message['firewall-enable'] && $message['firewall-disable']) {
-                return "国内阻断"; // 被墙
+            if (! $message['firewall-enable'] && $message['firewall-disable']) {
+                return '国内阻断'; // 被墙
             }
 
-            return "机器宕机"; // 服务器宕机
+            return '机器宕机'; // 服务器宕机
         }
 
         return false;
     }
 
     /**
-     * 用外部API进行Ping检测
+     * 用外部API进行Ping检测.
      *
      * @param  string  $ip  被检测的IP或者域名
      *
@@ -80,11 +80,11 @@ class NetworkDetection
                 return $message['data'];
             }
             // 发送失败
-            Log::warning("【PING】检测".$ip."时,返回".var_export($message, true));
+            Log::warning('【PING】检测'.$ip.'时,返回'.var_export($message, true));
 
             return false;
         }
-        Log::warning("【PING】检测".$ip."时,接口返回异常访问链接:".$url);
+        Log::warning('【PING】检测'.$ip.'时,接口返回异常访问链接:'.$url);
 
         // 发送错误
         return false;

+ 3 - 4
app/Components/PushNotification.php

@@ -1,6 +1,5 @@
 <?php
 
-
 namespace App\Components;
 
 use Cache;
@@ -22,7 +21,7 @@ class PushNotification
     }
 
     /**
-     * ServerChan推送消息
+     * ServerChan推送消息.
      *
      * @param  string  $title  消息标题
      * @param  string  $content  消息内容
@@ -50,7 +49,7 @@ class PushNotification
         // 发送成功
         if ($response->ok()) {
             $message = $response->json();
-            if (!$message['errno']) {
+            if (! $message['errno']) {
                 Helpers::addNotificationLog($title, $content, 2);
 
                 return $message;
@@ -67,7 +66,7 @@ class PushNotification
     }
 
     /**
-     * Bark推送消息
+     * Bark推送消息.
      *
      * @param  string  $title  消息标题
      * @param  string  $content  消息内容

+ 1 - 1
app/Components/QQInfo.php

@@ -11,7 +11,7 @@ class QQInfo
         //向接口发起请求获取json数据
         $url = 'https://r.qzone.qq.com/fcg-bin/cgi_get_portrait.fcg?get_nick=1&uins='.$qq;
         $response = Http::timeout(15)->retry(2)->get($url);
-        $message = mb_convert_encoding($response->body(), "UTF-8", "GBK");
+        $message = mb_convert_encoding($response->body(), 'UTF-8', 'GBK');
 
         // 接口是否异常
         if ($response->ok() && str_contains($message, $qq)) {

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

@@ -42,13 +42,13 @@ class AutoClearLog extends Command
     {
         try {
             // 清除节点负载信息日志
-            NodeHeartBeat::where('log_time', '<=', strtotime("-30 minutes"))->delete();
+            NodeHeartBeat::where('log_time', '<=', strtotime('-30 minutes'))->delete();
 
             // 清除节点在线用户数日志
-            NodeOnlineLog::where('log_time', '<=', strtotime("-1 hour"))->delete();
+            NodeOnlineLog::where('log_time', '<=', strtotime('-1 hour'))->delete();
 
             // 清除用户流量日志
-            UserDataFlowLog::where('log_time', '<=', strtotime("-3 days"))->delete();
+            UserDataFlowLog::where('log_time', '<=', strtotime('-3 days'))->delete();
 
             // 清除用户每时各流量数据日志
             UserHourlyDataFlow::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 days')))->delete();
@@ -66,16 +66,16 @@ class AutoClearLog extends Command
             NodeDailyDataFlow::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-2 month')))->delete();
 
             // 清除用户封禁日志
-            UserBanedLog::where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-3 month")))->delete();
+            UserBanedLog::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 month')))->delete();
 
             // 清除用户连接IP
-            NodeOnlineUserIp::where('created_at', '<=', strtotime("-1 month"))->delete();
+            NodeOnlineUserIp::where('created_at', '<=', strtotime('-1 month'))->delete();
 
             // 清除用户登陆日志
-            UserLoginLog::where('created_at', '<=', date('Y-m-d H:i:s', strtotime("-3 month")))->delete();
+            UserLoginLog::where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-3 month')))->delete();
 
             // 清除用户订阅记录
-            UserSubscribeLog::where('request_time', '<=', date('Y-m-d H:i:s', strtotime("-1 month")))->delete();
+            UserSubscribeLog::where('request_time', '<=', date('Y-m-d H:i:s', strtotime('-1 month')))->delete();
         } catch (Exception $e) {
             Log::error('【清理日志】错误: '.$e->getMessage());
         }

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

@@ -97,18 +97,18 @@ class AutoJob extends Command
         if (sysConfig('is_subscribe_ban')) {
             $subscribe_ban_times = sysConfig('subscribe_ban_times');
             foreach (User::activeUser()->with('subscribe')->get() as $user) {
-                if (!$user->subscribe || $user->subscribe->status === 0) { // 无订阅链接 或 已封
+                if (! $user->subscribe || $user->subscribe->status === 0) { // 无订阅链接 或 已封
                     continue;
                 }
                 // 24小时内不同IP的请求次数
                 $request_times = $user->subscribeLogs()
-                    ->where('request_time', '>=', date("Y-m-d H:i:s", strtotime("-1 days")))
+                    ->where('request_time', '>=', date('Y-m-d H:i:s', strtotime('-1 days')))
                     ->distinct()
                     ->count('request_ip');
                 if ($request_times >= $subscribe_ban_times) {
                     $user->subscribe->update([
                         'status'   => 0,
-                        'ban_time' => strtotime("+".sysConfig('traffic_ban_time')." minutes"),
+                        'ban_time' => strtotime('+'.sysConfig('traffic_ban_time').' minutes'),
                         'ban_desc' => '存在异常,自动封禁',
                     ]);
 
@@ -120,7 +120,7 @@ class AutoJob extends Command
     }
 
     /**
-     * 添加用户封禁日志
+     * 添加用户封禁日志.
      *
      * @param  int  $userId  用户ID
      * @param  int  $time  封禁时长,单位分钟
@@ -139,7 +139,7 @@ class AutoJob extends Command
     private function blockUsers(): void
     {
         // 禁用流量超限用户
-        foreach (User::activeUser()->whereRaw("u + d >= transfer_enable")->get() as $user) {
+        foreach (User::activeUser()->whereRaw('u + d >= transfer_enable')->get() as $user) {
             $user->update(['enable' => 0]);
 
             // 写入日志
@@ -161,7 +161,7 @@ class AutoJob extends Command
                 if ($totalTraffic >= $trafficBanValue * GB) {
                     $user->update([
                         'enable'   => 0,
-                        'ban_time' => strtotime("+".$trafficBanTime." minutes"),
+                        'ban_time' => strtotime('+'.$trafficBanTime.' minutes'),
                     ]);
 
                     // 写入日志
@@ -190,7 +190,7 @@ class AutoJob extends Command
             ->where('status', '>=', 0)
             ->whereBanTime(null)
             ->where('expired_at', '>=', date('Y-m-d'))
-            ->whereRaw("u + d < transfer_enable")
+            ->whereRaw('u + d < transfer_enable')
             ->get();
         foreach ($userList as $user) {
             $user->update(['enable' => 1]);
@@ -203,7 +203,7 @@ class AutoJob extends Command
     // 端口回收与分配
     private function dispatchPort(): void
     {
-        ## 自动分配端口
+        //# 自动分配端口
         foreach (User::activeUser()->wherePort(0)->get() as $user) {
             $user->update(['port' => Helpers::getPort()]);
         }
@@ -211,7 +211,7 @@ class AutoJob extends Command
         // 被封禁 / 过期一个月 的账号自动释放端口
         User::where('port', '<>', 0)
             ->whereStatus(-1)
-            ->orWhere('expired_at', '<=', date("Y-m-d", strtotime("-1 months")))
+            ->orWhere('expired_at', '<=', date('Y-m-d', strtotime('-1 months')))
             ->update(['port' => 0]);
     }
 
@@ -223,7 +223,7 @@ class AutoJob extends Command
             $onlineNode = NodeHeartBeat::recently()->distinct()->pluck('node_id')->toArray();
             foreach (Node::whereIsRelay(0)->whereStatus(1)->get() as $node) {
                 // 10分钟内无节点负载信息则认为是后端炸了
-                $nodeTTL = !in_array($node->id, $onlineNode, true);
+                $nodeTTL = ! in_array($node->id, $onlineNode, true);
                 if ($nodeTTL && $offlineCheckTimes) {
                     // 已通知次数
                     $cacheKey = 'offline_check_times'.$node->id;

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

@@ -35,13 +35,13 @@ class AutoPingNode extends Command
         if ($result) {
             $obj = new NodePing();
             $obj->node_id = $nodeId;
-            $obj->ct = (int) $result['telecom']['time'];//电信
-            $obj->cu = (int) $result['Unicom']['time'];// 联通
-            $obj->cm = (int) $result['move']['time'];// 移动
-            $obj->hk = (int) $result['HongKong']['time'];// 香港
+            $obj->ct = (int) $result['telecom']['time']; //电信
+            $obj->cu = (int) $result['Unicom']['time']; // 联通
+            $obj->cm = (int) $result['move']['time']; // 移动
+            $obj->hk = (int) $result['HongKong']['time']; // 香港
             $obj->save();
         } else {
-            Log::error("【".$ip."】Ping测速获取失败");
+            Log::error('【'.$ip.'】Ping测速获取失败');
         }
     }
 }

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

@@ -23,7 +23,7 @@ class AutoReportNode extends Command
                 $msg = "|节点|上行流量|下行流量|合计|\r\n| :------ | :------ | :------ |\r\n";
                 foreach ($nodeList as $node) {
                     $log = NodeDailyDataFlow::whereNodeId($node->id)
-                        ->whereDate('created_at', date("Y-m-d", strtotime('-1 days')))
+                        ->whereDate('created_at', date('Y-m-d', strtotime('-1 days')))
                         ->first();
 
                     if ($log) {

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

@@ -29,7 +29,7 @@ class AutoStatisticsNodeHourlyTraffic extends Command
 
     private function statisticsByNode($node_id): void
     {
-        $query = UserDataFlowLog::whereNodeId($node_id)->whereBetween('log_time', [strtotime("-1 hour"), time()]);
+        $query = UserDataFlowLog::whereNodeId($node_id)->whereBetween('log_time', [strtotime('-1 hour'), time()]);
 
         $u = $query->sum('u');
         $d = $query->sum('d');

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

@@ -36,7 +36,7 @@ class AutoStatisticsUserHourlyTraffic extends Command
 
     private function statisticsByNode($user_id, $node_id = 0): void
     {
-        $query = UserDataFlowLog::whereUserId($user_id)->whereBetween('log_time', [strtotime("-1 hour"), time()]);
+        $query = UserDataFlowLog::whereUserId($user_id)->whereBetween('log_time', [strtotime('-1 hour'), time()]);
 
         if ($node_id) {
             $query->whereNodeId($node_id);

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

@@ -82,7 +82,7 @@ class DailyJob extends Command
     }
 
     /**
-     * 添加用户封禁日志
+     * 添加用户封禁日志.
      *
      * @param  int  $userId  用户ID
      * @param  int  $time  封禁时长,单位分钟
@@ -102,7 +102,7 @@ class DailyJob extends Command
     // 关闭超过72小时未处理的工单
     private function closeTickets(): void
     {
-        $ticketList = Ticket::where('updated_at', '<=', date('Y-m-d', strtotime("-3 days")))->whereStatus(1)->get();
+        $ticketList = Ticket::where('updated_at', '<=', date('Y-m-d', strtotime('-3 days')))->whereStatus(1)->get();
         foreach ($ticketList as $ticket) {
             $ret = Ticket::whereId($ticket->id)->update(['status' => 2]);
             if ($ret) {
@@ -120,7 +120,7 @@ class DailyJob extends Command
             ->get();
         foreach ($userList as $user) {
             // 跳过 没有重置日期的账号
-            if (!$user->reset_time) {
+            if (! $user->reset_time) {
                 continue;
             }
 
@@ -128,7 +128,7 @@ class DailyJob extends Command
             $order = Order::userActivePlan($user->id)->first();
 
             // 无订单用户跳过
-            if (!$order) {
+            if (! $order) {
                 continue;
             }
 

+ 9 - 10
app/Console/Commands/NodeBlockedDetection.php

@@ -21,7 +21,7 @@ class NodeBlockedDetection extends Command
     {
         $jobStartTime = microtime(true);
         if (sysConfig('nodes_detection')) {
-            if (!Cache::has('LastCheckTime')) {
+            if (! Cache::has('LastCheckTime')) {
                 $this->checkNodes();
             } elseif (Cache::get('LastCheckTime') <= time()) {
                 $this->checkNodes();
@@ -54,22 +54,22 @@ class NodeBlockedDetection extends Command
                 if (strcmp($ip, $node->server) !== 0) {
                     $node->ip = $ip;
                 } else {
-                    Log::warning("【节点阻断检测】检测".$node->server."时,IP获取失败".$ip." | ".$node->server);
+                    Log::warning('【节点阻断检测】检测'.$node->server.'时,IP获取失败'.$ip.' | '.$node->server);
                     $this->notifyMaster("{$node->name}动态IP获取失败", "节点 {$node->name} : IP获取失败 ");
                 }
             }
             if ($node->detection_type !== 1) {
                 $icmpCheck = NetworkDetection::networkCheck($node->ip, true);
-                if ($icmpCheck !== false && $icmpCheck !== "通讯正常") {
-                    $message .= "| ".$node->name." | ICMP | ".$icmpCheck." |\r\n";
+                if ($icmpCheck !== false && $icmpCheck !== '通讯正常') {
+                    $message .= '| '.$node->name.' | ICMP | '.$icmpCheck." |\r\n";
                     $sendText = true;
                     $info = true;
                 }
             }
             if ($node->detection_type !== 2) {
                 $tcpCheck = NetworkDetection::networkCheck($node->ip, false, $node->single ? $node->port : null);
-                if ($tcpCheck !== false && $tcpCheck !== "通讯正常") {
-                    $message .= "| ".$node->name." | TCP | ".$tcpCheck." |\r\n";
+                if ($tcpCheck !== false && $tcpCheck !== '通讯正常') {
+                    $message .= '| '.$node->name.' | TCP | '.$tcpCheck." |\r\n";
                     $sendText = true;
                     $info = true;
                 }
@@ -99,7 +99,7 @@ class NodeBlockedDetection extends Command
 
         //只有在出现阻断线路时,才会发出警报
         if ($sendText) {
-            $this->notifyMaster("节点阻断警告", "阻断日志: \r\n\r\n".$message.$additionalMessage);
+            $this->notifyMaster('节点阻断警告', "阻断日志: \r\n\r\n".$message.$additionalMessage);
             Log::info("阻断日志: \r\n".$message.$additionalMessage);
         }
 
@@ -108,16 +108,15 @@ class NodeBlockedDetection extends Command
     }
 
     /**
-     * 通知管理员
+     * 通知管理员.
      *
      * @param  string  $title  消息标题
      * @param  string  $content  消息内容
-     *
      */
     private function notifyMaster(string $title, string $content): void
     {
         $result = PushNotification::send($title, $content);
-        if (!$result && sysConfig('webmaster_email')) {
+        if (! $result && sysConfig('webmaster_email')) {
             $logId = Helpers::addNotificationLog($title, $content, 1, sysConfig('webmaster_email'));
             Mail::to(sysConfig('webmaster_email'))->send(new nodeCrashWarning($logId));
         }

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

@@ -33,7 +33,7 @@ class UserTrafficAbnormalAutoWarning extends Command
             ->where('total', '>', MB * 50)
             ->where('created_at', '>=', date('Y-m-d H:i:s', time() - 3900))
             ->groupBy('user_id')
-            ->selectRaw("user_id, sum(total) as totalTraffic")
+            ->selectRaw('user_id, sum(total) as totalTraffic')
             ->get(); // 只统计100M以上的记录,加快查询速度
         $trafficBanValue = sysConfig('traffic_ban_value');
 
@@ -42,11 +42,11 @@ class UserTrafficAbnormalAutoWarning extends Command
             if ($log->totalTraffic > $trafficBanValue * GB) {
                 $user = $log->user;
                 $traffic = UserHourlyDataFlow::userRecentUsed($user->id)
-                    ->selectRaw("user_id, sum(`u`) as totalU, sum(`d`) as totalD, sum(total) as totalTraffic")
+                    ->selectRaw('user_id, sum(`u`) as totalU, sum(`d`) as totalD, sum(total) as totalTraffic')
                     ->first();
 
-                PushNotification::send("流量异常用户提醒",
-                    "用户**{$user->email}(ID:{$user->id})**,最近1小时**上行流量:".flowAutoShow($traffic->totalU).",下行流量:".flowAutoShow($traffic->totalD).",共计:".flowAutoShow($traffic->totalTraffic)."**。");
+                PushNotification::send('流量异常用户提醒',
+                    "用户**{$user->email}(ID:{$user->id})**,最近1小时**上行流量:".flowAutoShow($traffic->totalU).',下行流量:'.flowAutoShow($traffic->totalD).',共计:'.flowAutoShow($traffic->totalTraffic).'**。');
             }
         }
     }

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

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

+ 3 - 3
app/Console/Commands/fixDailyTrafficLogError.php

@@ -18,7 +18,7 @@ class fixDailyTrafficLogError extends Command
     public function handle(): void
     {
         // set value
-        $this->end = date('Y-m-d 23:59:59', strtotime("-1 days"));
+        $this->end = date('Y-m-d 23:59:59', strtotime('-1 days'));
         $nodeArray = UserDataFlowLog::distinct()->pluck('node_id')->toArray();
 
         Log::info('----------------------------【修复原版本的每日流量计算错误】开始----------------------------');
@@ -33,7 +33,7 @@ class fixDailyTrafficLogError extends Command
         foreach ($nodeArray as $nodeId) {
             $query = UserDataFlowLog::whereNodeId($nodeId)
                 ->whereBetween('log_time',
-                    [strtotime(date('Y-m-d', strtotime("-1 days"))), strtotime($this->end)]);
+                    [strtotime(date('Y-m-d', strtotime('-1 days'))), strtotime($this->end)]);
 
             $u = $query->sum('u');
             $d = $query->sum('d');
@@ -76,7 +76,7 @@ class fixDailyTrafficLogError extends Command
     {
         $query = UserDataFlowLog::whereUserId($user_id)
             ->whereBetween('log_time',
-                [strtotime(date('Y-m-d', strtotime("-1 days"))), strtotime($this->end)]);
+                [strtotime(date('Y-m-d', strtotime('-1 days'))), strtotime($this->end)]);
 
         if ($node_id) {
             $query->whereNodeId($node_id);

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

@@ -46,7 +46,7 @@ function process($id)
     // 用户是否设置了QQ号
     if ($user->qq) {
         $name = QQInfo::getName3($user->qq);
-        // 检测用户注册是否为QQ邮箱
+    // 检测用户注册是否为QQ邮箱
     } elseif (stripos($user->email, '@qq') !== false) {
         // 分离QQ邮箱后缀
         $email = explode('@', $user->email, 2);

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

@@ -18,29 +18,29 @@ class upgradeUserResetTime extends Command
         foreach (User::all() as $user) {
             $reset_time = null;
             if ($user->traffic_reset_day) {
-                $today = date('d');// 今天 日期
+                $today = date('d'); // 今天 日期
                 $last_day = date('t'); //本月最后一天
-                $next_last_day = date('t', strtotime("+1 month"));//下个月最后一天
-                $resetDay = $user->traffic_reset_day;// 用户原本的重置日期
+                $next_last_day = date('t', strtotime('+1 month')); //下个月最后一天
+                $resetDay = $user->traffic_reset_day; // 用户原本的重置日期
                 // 案例:31 29,重置日 大于 本月最后一天
                 if ($resetDay > $last_day) {
                     //往后推一个月
                     $resetDay -= $last_day;
-                    $reset_time = date('Y-m-'.$resetDay, strtotime("+1 month"));
-                    //案例:20<30<31
+                    $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
+                //案例:20<30<31
                 } elseif ($resetDay < $last_day && $resetDay > $today) {
                     $reset_time = date('Y-m-'.$resetDay);
-                    // 本日为重置日
+                // 本日为重置日
                 } elseif ($resetDay === $today) {
-                    $reset_time = date('Y-m-d', strtotime("+1 month"));
-                    //本月已经重置过了
+                    $reset_time = date('Y-m-d', strtotime('+1 month'));
+                //本月已经重置过了
                 } elseif ($resetDay < $today) {
                     //类似第一种情况,向后推一月
                     if ($resetDay > $next_last_day) {
                         $resetDay -= $next_last_day;
-                        $reset_time = date('Y-m-'.$resetDay, strtotime("+1 month"));
+                        $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
                     } else {
-                        $reset_time = date('Y-m-'.$resetDay, strtotime("+1 month"));
+                        $reset_time = date('Y-m-'.$resetDay, strtotime('+1 month'));
                     }
                 }
                 // 用户账号有效期大于重置日期

+ 0 - 1
app/Console/Kernel.php

@@ -27,7 +27,6 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
 
 class Kernel extends ConsoleKernel
 {
-
     /**
      * The Artisan commands provided by your application.
      *

+ 2 - 3
app/Exceptions/Handler.php

@@ -18,7 +18,6 @@ use Throwable;
 
 class Handler extends ExceptionHandler
 {
-
     /**
      * A list of the exception types that are not reported.
      *
@@ -72,10 +71,10 @@ class Handler extends ExceptionHandler
     public function render($request, Throwable $exception)
     {
         // 调试模式下直接返回错误信息,非调试模式下渲染在返回
-        if (!config('app.debug')) {
+        if (! config('app.debug')) {
             switch ($exception) {
                 case $exception instanceof NotFoundHttpException: // 捕获访问异常
-                    Log::info("异常请求:".$request->fullUrl().",IP:".IP::getClientIp());
+                    Log::info('异常请求:'.$request->fullUrl().',IP:'.IP::getClientIp());
 
                     if ($request->ajax()) {
                         return Response::json(['status' => 'fail', 'message' => trans('error.MissingPage')]);

+ 1 - 4
app/Http/Controllers/Admin/AffiliateController.php

@@ -10,15 +10,12 @@ use Illuminate\Http\Request;
 use Response;
 
 /**
- * 推广控制器
+ * 推广控制器.
  *
  * Class AffiliateController
- *
- * @package App\Http\Controllers\Controller
  */
 class AffiliateController extends Controller
 {
-
     // 提现申请列表
     public function index(Request $request)
     {

+ 3 - 4
app/Http/Controllers/Admin/ArticleController.php

@@ -16,7 +16,6 @@ use Session;
 
 class ArticleController extends Controller
 {
-
     // 文章列表
     public function index(Request $request)
     {
@@ -36,9 +35,9 @@ class ArticleController extends Controller
     {
         $data = $request->except('_method', '_token');
         // LOGO
-        if ($request->input('type') !== "4" && $request->hasFile('logo')) {
+        if ($request->input('type') !== '4' && $request->hasFile('logo')) {
             $data['logo'] = 'upload/'.$request->file('logo')->store('images');
-            if (!$data['logo']) {
+            if (! $data['logo']) {
                 Session::flash('errorMsg', 'LOGO不合法');
 
                 return Redirect::back()->withInput();
@@ -79,7 +78,7 @@ class ArticleController extends Controller
         // LOGO
         if ($request->input('type') != 4 && $request->hasFile('logo')) {
             $data['logo'] = 'upload/'.$request->file('logo')->store('images');
-            if (!$data['logo']) {
+            if (! $data['logo']) {
                 Session::flash('errorMsg', 'LOGO不合法');
 
                 return Redirect::back()->withInput();

+ 2 - 4
app/Http/Controllers/Admin/Config/CountryController.php

@@ -13,7 +13,6 @@ use Response;
 
 class CountryController extends Controller
 {
-
     // 添加国家/地区
     public function store(Request $request): JsonResponse
     {
@@ -53,9 +52,8 @@ class CountryController extends Controller
             return Response::json(['status' => 'fail', 'message' => '国家/地区名称不能为空']);
         }
 
-
         $country = Country::find($code);
-        if (!$country) {
+        if (! $country) {
             return Response::json(['status' => 'fail', 'message' => '国家/地区不存在']);
         }
 
@@ -82,7 +80,7 @@ class CountryController extends Controller
     public function destroy($code): ?JsonResponse
     {
         $country = Country::find($code);
-        if (!$country) {
+        if (! $country) {
             return Response::json(['status' => 'fail', 'message' => '国家/地区不存在']);
         }
 

+ 1 - 1
app/Http/Controllers/Admin/Config/SsConfigController.php

@@ -48,7 +48,7 @@ class SsConfigController extends Controller
         }
 
         $config = SsConfig::find($id);
-        if (!$config) {
+        if (! $config) {
             return Response::json(['status' => 'fail', 'message' => '配置不存在']);
         }
 

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

@@ -16,11 +16,9 @@ use Response;
 use Str;
 
 /**
- * 优惠券控制器
+ * 优惠券控制器.
  *
  * Class CouponController
- *
- * @package App\Http\Controllers\Controller
  */
 class CouponController extends Controller
 {
@@ -64,7 +62,7 @@ class CouponController extends Controller
         if ($request->hasFile('logo')) {
             $logo = 'upload/'.$request->file('logo')->store('images');
 
-            if (!$logo) {
+            if (! $logo) {
                 return Redirect::back()->withInput()->withErrors('LOGO不合法');
             }
         }

+ 32 - 12
app/Http/Controllers/Admin/LogsController.php

@@ -35,7 +35,9 @@ class LogsController extends Controller
         $query = Order::with(['user:id,email', 'goods:id,name', 'coupon:id,name,sn']);
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
         if (isset($order_sn)) {
             $query->where('order_sn', 'like', '%'.$order_sn.'%');
@@ -94,7 +96,9 @@ class LogsController extends Controller
         $query = UserDataFlowLog::with(['user', 'node']);
 
         if (isset($port)) {
-            $query->whereHas('user', static function ($q) use ($port) { $q->wherePort($port); });
+            $query->whereHas('user', static function ($q) use ($port) {
+                $q->wherePort($port);
+            });
         }
 
         if (isset($user_id)) {
@@ -102,7 +106,9 @@ class LogsController extends Controller
         }
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
 
         if (isset($nodeId)) {
@@ -162,26 +168,34 @@ class LogsController extends Controller
         $port = $request->input('port');
         $nodeId = $request->input('nodeId');
 
-        $query = NodeOnlineUserIp::with(['node:id,name', 'user:id,email'])->where('created_at', '>=', strtotime("-2 minutes"));
+        $query = NodeOnlineUserIp::with(['node:id,name', 'user:id,email'])->where('created_at', '>=', strtotime('-2 minutes'));
 
         if (isset($ip)) {
             $query->whereIp($ip);
         }
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
 
         if (isset($port)) {
-            $query->whereHas('user', static function ($q) use ($port) { $q->wherePort($port); });
+            $query->whereHas('user', static function ($q) use ($port) {
+                $q->wherePort($port);
+            });
         }
 
         if (isset($nodeId)) {
-            $query->whereHas('node', static function ($q) use ($nodeId) { $q->whereId($nodeId); });
+            $query->whereHas('node', static function ($q) use ($nodeId) {
+                $q->whereId($nodeId);
+            });
         }
 
         if (isset($id)) {
-            $query->whereHas('user', static function ($q) use ($id) { $q->whereId($id); });
+            $query->whereHas('user', static function ($q) use ($id) {
+                $q->whereId($id);
+            });
         }
 
         $onlineIPLogs = $query->groupBy('user_id', 'node_id')->latest()->paginate(20)->appends($request->except('page'));
@@ -209,7 +223,9 @@ class LogsController extends Controller
         $query = UserCreditLog::with('user:id,email')->latest();
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
 
         $view['list'] = $query->paginate(15)->appends($request->except('page'));
@@ -225,7 +241,9 @@ class LogsController extends Controller
         $query = UserBanedLog::with('user:id,email,t')->latest();
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
 
         $view['list'] = $query->paginate(15)->appends($request->except('page'));
@@ -241,7 +259,9 @@ class LogsController extends Controller
         $query = UserDataModifyLog::with(['user:id,email', 'order.goods:id,name']);
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
 
         $view['list'] = $query->latest()->paginate(15)->appends($request->except('page'));
@@ -277,7 +297,7 @@ class LogsController extends Controller
 
         $userList = $query->paginate(15)->appends($request->except('page'));
 
-        $nodeOnlineIPs = NodeOnlineUserIp::with('node:id,name')->where('created_at', '>=', strtotime("-10 minutes"))->latest()->distinct();
+        $nodeOnlineIPs = NodeOnlineUserIp::with('node:id,name')->where('created_at', '>=', strtotime('-10 minutes'))->latest()->distinct();
         // Todo 优化查询
         foreach ($userList as $user) {
             // 最近5条在线IP记录,如果后端设置为60秒上报一次,则为10分钟内的在线IP

+ 3 - 5
app/Http/Controllers/Admin/MarketingController.php

@@ -14,11 +14,9 @@ use Response;
 use RuntimeException;
 
 /**
- * 促销控制器
+ * 促销控制器.
  *
  * Class MarketingController
- *
- * @package App\Http\Controllers\Controller
  */
 class MarketingController extends Controller
 {
@@ -60,7 +58,7 @@ class MarketingController extends Controller
         $title = $request->input('title');
         $content = $request->input('content');
 
-        if (!sysConfig('is_push_bear')) {
+        if (! sysConfig('is_push_bear')) {
             return Response::json(['status' => 'fail', 'message' => '推送失败:请先启用并配置PushBear']);
         }
 
@@ -74,7 +72,7 @@ class MarketingController extends Controller
             ]);
 
             $message = $response->json();
-            if (!$message || !$message['code'] === 0 || $response->failed()) { // 失败
+            if (! $message || ! $message['code'] === 0 || $response->failed()) { // 失败
                 $this->addMarketing(2, $title, $content, -1, $message['message']);
 
                 throw new RuntimeException($message['message']);

+ 8 - 8
app/Http/Controllers/Admin/NodeController.php

@@ -39,7 +39,7 @@ class NodeController extends Controller
         $nodeList = $query->orderByDesc('sort')->orderBy('id')->paginate(15)->appends($request->except('page'));
         foreach ($nodeList as $node) {
             // 在线人数
-            $online_log = $node->onlineLogs()->where('log_time', '>=', strtotime("-5 minutes"))->latest('log_time')->first();
+            $online_log = $node->onlineLogs()->where('log_time', '>=', strtotime('-5 minutes'))->latest('log_time')->first();
             $node->online_users = $online_log->online_user ?? 0;
 
             // 已产生流量
@@ -154,13 +154,13 @@ class NodeController extends Controller
             if (strcmp($ip, $node->server) !== 0) {
                 $node->ip = $ip;
             } else {
-                return Response::json(['status' => 'fail', 'title' => 'IP获取错误', 'message' => $node->name.'IP获取失败',]);
+                return Response::json(['status' => 'fail', 'title' => 'IP获取错误', 'message' => $node->name.'IP获取失败']);
             }
         }
         $data[0] = NetworkDetection::networkCheck($node->ip, true); //ICMP
         $data[1] = NetworkDetection::networkCheck($node->ip, false, $node->single ? $node->port : null); //TCP
 
-        return Response::json(['status' => 'success', 'title' => '['.$node->name.']阻断信息', 'message' => $data,]);
+        return Response::json(['status' => 'success', 'title' => '['.$node->name.']阻断信息', 'message' => $data]);
     }
 
     // 刷新节点地理位置
@@ -187,7 +187,7 @@ class NodeController extends Controller
     public function nodeMonitor($id)
     {
         $node = Node::find($id);
-        if (!$node) {
+        if (! $node) {
             Session::flash('errorMsg', '节点不存在,请重试');
 
             return Redirect::back();
@@ -211,10 +211,10 @@ class NodeController extends Controller
             return Response::json([
                 'status'  => 'success',
                 'message' => [
-                    $result['telecom']['time'] ?: '无',//电信
-                    $result['Unicom']['time'] ?: '无',// 联通
-                    $result['move']['time'] ?: '无',// 移动
-                    $result['HongKong']['time'] ?: '无'// 香港
+                    $result['telecom']['time'] ?: '无', //电信
+                    $result['Unicom']['time'] ?: '无', // 联通
+                    $result['move']['time'] ?: '无', // 移动
+                    $result['HongKong']['time'] ?: '无', // 香港
                 ],
             ]);
         }

+ 3 - 1
app/Http/Controllers/Admin/RuleController.php

@@ -99,7 +99,9 @@ class RuleController extends Controller
             $query->whereUserId($uid);
         }
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) { $q->where('email', 'like', '%'.$email.'%'); });
+            $query->whereHas('user', static function ($q) use ($email) {
+                $q->where('email', 'like', '%'.$email.'%');
+            });
         }
         if ($nodeId) {
             $query->whereNodeId($nodeId);

+ 2 - 2
app/Http/Controllers/Admin/RuleGroupController.php

@@ -127,8 +127,8 @@ class RuleGroupController extends Controller
             RuleGroupNode::whereRuleGroupId($id)->delete();
             if ($nodes) {
                 $ruleGroup->nodes = $nodes;
-                if (!$ruleGroup->save()) {
-                    return Redirect::back()->withErrors("更新错误!");
+                if (! $ruleGroup->save()) {
+                    return Redirect::back()->withErrors('更新错误!');
                 }
 
                 foreach ($nodes as $nodeId) {

+ 3 - 5
app/Http/Controllers/Admin/ShopController.php

@@ -17,11 +17,9 @@ use Response;
 use Session;
 
 /**
- * 商店控制器
+ * 商店控制器.
  *
  * Class ShopController
- *
- * @package App\Http\Controllers\Controller
  */
 class ShopController extends Controller
 {
@@ -61,7 +59,7 @@ class ShopController extends Controller
         if ($request->hasFile('logo')) {
             $logo = 'upload/'.$request->file('logo')->store('images');
 
-            if (!$logo) {
+            if (! $logo) {
                 return Redirect::back()->withInput()->withErrors('LOGO不合法');
             }
         }
@@ -104,7 +102,7 @@ class ShopController extends Controller
         if ($request->hasFile('logo')) {
             $logo = 'upload/'.$request->file('logo')->store('images');
 
-            if (!$logo) {
+            if (! $logo) {
                 return Redirect::back()->withInput()->withErrors('LOGO不合法');
             }
             $data['logo'] = $logo;

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

@@ -10,11 +10,9 @@ use Illuminate\Http\Request;
 use Response;
 
 /**
- * 订阅控制器
+ * 订阅控制器.
  *
  * Class SubscribeController
- *
- * @package App\Http\Controllers\Controller
  */
 class SubscribeController extends Controller
 {

+ 20 - 20
app/Http/Controllers/Admin/SystemController.php

@@ -29,7 +29,7 @@ class SystemController extends Controller
             // 首页LOGO
             if ($request->hasFile('website_home_logo')) {
                 $ret = 'upload/'.$request->file('website_home_logo')->store('images');
-                if (!$ret) {
+                if (! $ret) {
                     Session::flash('errorMsg', 'LOGO不合法');
 
                     return Redirect::back();
@@ -40,7 +40,7 @@ class SystemController extends Controller
             // 站内LOGO
             if ($request->hasFile('website_logo')) {
                 $ret = 'upload/'.$request->file('website_logo')->store('images');
-                if (!$ret) {
+                if (! $ret) {
                     Session::flash('errorMsg', 'LOGO不合法');
 
                     return Redirect::back();
@@ -80,59 +80,59 @@ class SystemController extends Controller
         $name = $request->input('name');
         $value = $request->input('value');
 
-        if (!$name) {
+        if (! $name) {
             return Response::json(['status' => 'fail', 'message' => '设置失败:请求参数异常']);
         }
 
         // 屏蔽异常配置
-        if (!in_array($name, Config::pluck('name')->toArray(), true)) {
+        if (! in_array($name, Config::pluck('name')->toArray(), true)) {
             return Response::json(['status' => 'fail', 'message' => '设置失败:配置不存在']);
         }
 
         // 如果开启用户邮件重置密码,则先设置网站名称和网址
-        if ($value !== '0' && in_array($name, ['is_reset_password', 'is_activate_account', 'expire_warning', 'traffic_warning',], true)) {
+        if ($value !== '0' && in_array($name, ['is_reset_password', 'is_activate_account', 'expire_warning', 'traffic_warning'], true)) {
             $config = Config::find('website_name');
-            if (!$config->value) {
+            if (! $config->value) {
                 return Response::json(['status' => 'fail', 'message' => '设置失败:启用该配置需要先设置【网站名称】']);
             }
 
             $config = Config::find('website_url');
-            if (!$config->value) {
+            if (! $config->value) {
                 return Response::json(['status' => 'fail', 'message' => '设置失败:启用该配置需要先设置【网站地址】']);
             }
         }
 
         // 支付设置判断
-        if ($value !== null && in_array($name, ['is_AliPay', 'is_QQPay', 'is_WeChatPay', 'is_otherPay',], true)) {
+        if ($value !== null && in_array($name, ['is_AliPay', 'is_QQPay', 'is_WeChatPay', 'is_otherPay'], true)) {
             switch ($value) {
                 case 'f2fpay':
-                    if (!sysConfig('f2fpay_app_id') || !sysConfig('f2fpay_private_key') || !sysConfig('f2fpay_public_key')) {
-                        return Response::json(['status' => 'fail', 'message' => '请先设置【支付宝F2F】必要参数',]);
+                    if (! sysConfig('f2fpay_app_id') || ! sysConfig('f2fpay_private_key') || ! sysConfig('f2fpay_public_key')) {
+                        return Response::json(['status' => 'fail', 'message' => '请先设置【支付宝F2F】必要参数']);
                     }
                     break;
                 case 'codepay':
-                    if (!sysConfig('codepay_url') || !sysConfig('codepay_id') || !sysConfig('codepay_key')) {
+                    if (! sysConfig('codepay_url') || ! sysConfig('codepay_id') || ! sysConfig('codepay_key')) {
                         return Response::json(['status' => 'fail', 'message' => '请先设置【码支付】必要参数']);
                     }
                     break;
                 case 'epay':
-                    if (!sysConfig('epay_url') || !sysConfig('epay_mch_id') || !sysConfig('epay_key')) {
+                    if (! sysConfig('epay_url') || ! sysConfig('epay_mch_id') || ! sysConfig('epay_key')) {
                         return Response::json(['status' => 'fail', 'message' => '请先设置【易支付】必要参数']);
                     }
                     break;
                 case 'payjs':
-                    if (!sysConfig('payjs_mch_id') || !sysConfig('payjs_key')) {
+                    if (! sysConfig('payjs_mch_id') || ! sysConfig('payjs_key')) {
                         return Response::json(['status' => 'fail', 'message' => '请先设置【PayJs】必要参数']);
                     }
                     break;
                 case 'bitpayx':
-                    if (!sysConfig('bitpay_secret')) {
+                    if (! sysConfig('bitpay_secret')) {
                         return Response::json(['status' => 'fail', 'message' => '请先设置【麻瓜宝】必要参数']);
                     }
                     break;
                 case 'paypal':
-                    if (!sysConfig('paypal_username') || !sysConfig('paypal_password') || !sysConfig('paypal_secret')) {
-                        return Response::json(['status' => 'fail', 'message' => '请先设置【PayPal】必要参数',]);
+                    if (! sysConfig('paypal_username') || ! sysConfig('paypal_password') || ! sysConfig('paypal_secret')) {
+                        return Response::json(['status' => 'fail', 'message' => '请先设置【PayPal】必要参数']);
                     }
                     break;
                 default:
@@ -178,14 +178,14 @@ class SystemController extends Controller
             }
             switch (sysConfig('is_notification')) {
                 case 'serverChan':
-                    if (!$result['errno']) {
-                        return Response::json(['status' => 'success', 'message' => '发送成功,请查看手机是否收到推送消息',]);
+                    if (! $result['errno']) {
+                        return Response::json(['status' => 'success', 'message' => '发送成功,请查看手机是否收到推送消息']);
                     }
 
-                    return Response::json(['status' => 'fail', 'message' => $result ? $result['errmsg'] : '未知',]);
+                    return Response::json(['status' => 'fail', 'message' => $result ? $result['errmsg'] : '未知']);
                 case 'bark':
                     if ($result['code'] === 200) {
-                        return Response::json(['status' => 'success', 'message' => '发送成功,请查看手机是否收到推送消息',]);
+                        return Response::json(['status' => 'success', 'message' => '发送成功,请查看手机是否收到推送消息']);
                     }
 
                     return Response::json(['status' => 'fail', 'message' => $result['message']]);

+ 10 - 13
app/Http/Controllers/Admin/TicketController.php

@@ -16,15 +16,12 @@ use Mail;
 use Response;
 
 /**
- * 工单控制器
+ * 工单控制器.
  *
  * Class TicketController
- *
- * @package App\Http\Controllers\Controller
  */
 class TicketController extends Controller
 {
-
     // 工单列表
     public function index(Request $request)
     {
@@ -53,7 +50,7 @@ class TicketController extends Controller
 
         $user = User::find($id) ?: User::whereEmail($email)->first();
 
-        if (!$user) {
+        if (! $user) {
             return Response::json(['status' => 'fail', 'message' => '用户不存在']);
         }
 
@@ -92,7 +89,7 @@ class TicketController extends Controller
     // 回复工单
     public function update(Request $request, $id)
     {
-        $content = substr(str_replace(["atob", "eval"], "", clean($request->input('content'))), 0, 300);
+        $content = substr(str_replace(['atob', 'eval'], '', clean($request->input('content'))), 0, 300);
 
         $obj = new TicketReply();
         $obj->ticket_id = $id;
@@ -105,11 +102,11 @@ class TicketController extends Controller
             $ticket = Ticket::with('user')->find($id);
             Ticket::whereId($id)->update(['status' => 1]);
 
-            $title = "工单回复提醒";
-            $content = "标题:".$ticket->title."<br>管理员回复:".$content;
+            $title = '工单回复提醒';
+            $content = '标题:'.$ticket->title.'<br>管理员回复:'.$content;
 
             // 发通知邮件
-            if (!Auth::getUser()->is_admin) {
+            if (! Auth::getUser()->is_admin) {
                 if (sysConfig('webmaster_email')) {
                     $logId = Helpers::addNotificationLog($title, $content, 1, sysConfig('webmaster_email'));
                     Mail::to(sysConfig('webmaster_email'))->send(new replyTicket($logId, $title, $content));
@@ -131,17 +128,17 @@ class TicketController extends Controller
     public function destroy($id)
     {
         $ticket = Ticket::with('user')->whereId($id)->first();
-        if (!$ticket) {
+        if (! $ticket) {
             return Response::json(['status' => 'fail', 'message' => '关闭失败']);
         }
 
         $ret = Ticket::whereId($id)->update(['status' => 2]);
-        if (!$ret) {
+        if (! $ret) {
             return Response::json(['status' => 'fail', 'message' => '关闭失败']);
         }
 
-        $title = "工单关闭提醒";
-        $content = "工单【".$ticket->title."】已关闭";
+        $title = '工单关闭提醒';
+        $content = '工单【'.$ticket->title.'】已关闭';
 
         // 发邮件通知用户
         $logId = Helpers::addNotificationLog($title, $content, 1, $ticket->user->email);

+ 10 - 10
app/Http/Controllers/Admin/ToolsController.php

@@ -25,7 +25,7 @@ class ToolsController extends Controller
             }
 
             // 反解析处理
-            $content = str_replace("\n", ",", $content);
+            $content = str_replace("\n", ',', $content);
             $content = explode(',', $content);
             $txt = '';
             foreach ($content as $item) {
@@ -80,11 +80,11 @@ class ToolsController extends Controller
                     'enable'          => 1,
                     'method'          => $method,
                     'obfs'            => $obfs,
-                    'obfs_param'      => empty($obfs_param) ? "" : $obfs_param,
+                    'obfs_param'      => empty($obfs_param) ? '' : $obfs_param,
                     'passwd'          => $passwd,
                     'port'            => $port,
                     'protocol'        => $protocol,
-                    'protocol_param'  => empty($protocol_param) ? "" : $protocol_param,
+                    'protocol_param'  => empty($protocol_param) ? '' : $protocol_param,
                     'transfer_enable' => $transfer_enable,
                     'user'            => date('Ymd').'_IMPORT_'.$port,
                 ];
@@ -115,7 +115,7 @@ class ToolsController extends Controller
             $filePath = public_path('downloads/decompile.json');
         }
 
-        if (!file_exists($filePath)) {
+        if (! file_exists($filePath)) {
             exit('文件不存在,请检查目录权限');
         }
 
@@ -126,7 +126,7 @@ class ToolsController extends Controller
     public function import(Request $request)
     {
         if ($request->isMethod('POST')) {
-            if (!$request->hasFile('uploadFile')) {
+            if (! $request->hasFile('uploadFile')) {
                 Session::flash('errorMsg', '请选择要上传的文件');
 
                 return Redirect::back();
@@ -141,7 +141,7 @@ class ToolsController extends Controller
                 return Redirect::back();
             }
 
-            if (!$file->isValid()) {
+            if (! $file->isValid()) {
                 Session::flash('errorMsg', '产生未知错误,请重新上传');
 
                 return Redirect::back();
@@ -154,7 +154,7 @@ class ToolsController extends Controller
             // 读取文件内容
             $data = file_get_contents($save_path.'/'.$new_name);
             $data = json_decode($data, true);
-            if (!$data) {
+            if (! $data) {
                 Session::flash('errorMsg', '内容格式解析异常,请上传符合SSR(R)配置规范的JSON文件');
 
                 return Redirect::back();
@@ -202,7 +202,7 @@ class ToolsController extends Controller
     public function analysis()
     {
         $file = storage_path('app/ssserver.log');
-        if (!file_exists($file)) {
+        if (! file_exists($file)) {
             Session::flash('analysisErrorMsg', $file.' 不存在,请先创建文件');
 
             return view('admin.tools.analysis');
@@ -219,12 +219,12 @@ class ToolsController extends Controller
                 }
 
                 preg_match('/TCP request (\w+\.){2}\w+/', $log, $tcp_matches);
-                if (!empty($tcp_matches)) {
+                if (! empty($tcp_matches)) {
                     $url[] = str_replace('TCP request ', '[TCP] ', $tcp_matches[0]);
                 } else {
                     preg_match('/UDP data to (25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)\.(25[0-5]|2[0-4]\d|[0-1]\d{2}|[1-9]?\d)/',
                         $log, $udp_matches);
-                    if (!empty($udp_matches)) {
+                    if (! empty($udp_matches)) {
                         $url[] = str_replace('UDP data to ', '[UDP] ', $udp_matches[0]);
                     }
                 }

+ 12 - 13
app/Http/Controllers/Admin/UserController.php

@@ -87,17 +87,17 @@ class UserController extends Controller
 
         // 临近过期提醒
         if ($expireWarning) {
-            $query->whereBetween('expired_at', [date('Y-m-d'), date('Y-m-d', strtotime("+".sysConfig('expire_days')." days"))]);
+            $query->whereBetween('expired_at', [date('Y-m-d'), date('Y-m-d', strtotime('+'.sysConfig('expire_days').' days'))]);
         }
 
         // 当前在线
         if ($online) {
-            $query->where('t', '>=', strtotime("-10 minutes"));
+            $query->where('t', '>=', strtotime('-10 minutes'));
         }
 
         // 不活跃用户
         if ($request->input('unActive')) {
-            $query->whereBetween('t', [1, strtotime("-".sysConfig('expire_days')." days"),])->whereEnable(1);
+            $query->whereBetween('t', [1, strtotime('-'.sysConfig('expire_days').' days')])->whereEnable(1);
         }
 
         // 1小时内流量异常用户
@@ -112,7 +112,7 @@ class UserController extends Controller
                 $user->expireWarning = -1; // 已过期
             } elseif ($user->expired_at === date('Y-m-d')) {
                 $user->expireWarning = 0; // 今天过期
-            } elseif ($user->expired_at > date('Y-m-d') && $user->expired_at <= date('Y-m-d', strtotime("+30 days"))) {
+            } elseif ($user->expired_at > date('Y-m-d') && $user->expired_at <= date('Y-m-d', strtotime('+30 days'))) {
                 $user->expireWarning = 1; // 最近一个月过期
             } else {
                 $user->expireWarning = 2; // 大于一个月过期
@@ -151,8 +151,8 @@ class UserController extends Controller
             $data['port'] = $data['port'] ?? Helpers::getPort();
             $data['passwd'] = $data['passwd'] ?? Str::random();
             $data['vmess_id'] = $request->input('uuid') ?? Str::uuid();
-            $data['expired_at'] = $data['expired_at'] ?? date('Y-m-d', strtotime("+365 days"));
-            $data['remark'] = str_replace(["atob", "eval"], "", $data['remark']);
+            $data['expired_at'] = $data['expired_at'] ?? date('Y-m-d', strtotime('+365 days'));
+            $data['remark'] = str_replace(['atob', 'eval'], '', $data['remark']);
             $data['reg_ip'] = IP::getClientIp();
             $data['reset_time'] = $data['reset_time'] > date('Y-m-d') ? $data['reset_time'] : null;
             $user = User::create($data);
@@ -169,7 +169,6 @@ class UserController extends Controller
             return Response::json(['status' => 'fail', 'message' => $e->getMessage()]);
         }
 
-
         return Response::json(['status' => 'fail', 'message' => '添加失败']);
     }
 
@@ -196,8 +195,8 @@ class UserController extends Controller
             $data['vmess_id'] = $request->input('uuid') ?? Str::uuid();
             $data['transfer_enable'] *= GB;
             $data['enable'] = $data['status'] < 0 ? 0 : $data['enable'];
-            $data['expired_at'] = $data['expired_at'] ?? date('Y-m-d', strtotime("+365 days"));
-            $data['remark'] = str_replace(["atob", "eval"], "", $data['remark']);
+            $data['expired_at'] = $data['expired_at'] ?? date('Y-m-d', strtotime('+365 days'));
+            $data['remark'] = str_replace(['atob', 'eval'], '', $data['remark']);
 
             // 只有admin才有权限操作管理员属性
             if (Auth::getUser()->is_admin === 1) {
@@ -206,7 +205,7 @@ class UserController extends Controller
 
             // 非演示环境才可以修改管理员密码
             $password = $request->input('password');
-            if (!empty($password) && !(env('APP_DEMO') && $id === 1)) {
+            if (! empty($password) && ! (env('APP_DEMO') && $id === 1)) {
                 $data['password'] = $password;
             }
 
@@ -281,15 +280,15 @@ class UserController extends Controller
         $id = $request->input('user_id');
 
         $user = User::find($id);
-        if (!$user) {
-            return Response::json(['status' => 'fail', 'message' => "用户不存在"]);
+        if (! $user) {
+            return Response::json(['status' => 'fail', 'message' => '用户不存在']);
         }
 
         // 存储当前管理员ID,并将当前登录信息改成要切换的用户的身份信息
         Session::put('admin', Auth::id());
         Auth::login($user);
 
-        return Response::json(['status' => 'success', 'message' => "身份切换成功"]);
+        return Response::json(['status' => 'success', 'message' => '身份切换成功']);
     }
 
     // 重置用户流量

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

@@ -34,7 +34,7 @@ class UserGroupController extends Controller
     // 添加用户分组
     public function store(Request $request): RedirectResponse
     {
-        $validator = Validator::make($request->all(), ['name' => 'required', 'nodes' => 'required',]);
+        $validator = Validator::make($request->all(), ['name' => 'required', 'nodes' => 'required']);
 
         if ($validator->fails()) {
             return Redirect::back()->withInput()->withErrors($validator->errors());

+ 15 - 14
app/Http/Controllers/AdminController.php

@@ -28,32 +28,30 @@ use Response;
 use Str;
 
 /**
- * 管理员控制器
+ * 管理员控制器.
  *
  * Class AdminController
- *
- * @package App\Http\Controllers
  */
 class AdminController extends Controller
 {
     public function index()
     {
-        $past = strtotime("-".sysConfig('expire_days')." days");
+        $past = strtotime('-'.sysConfig('expire_days').' days');
 
         $view['expireDays'] = sysConfig('expire_days');
         $view['totalUserCount'] = User::count(); // 总用户数
-        $view['todayRegister'] = User::whereDate('created_at', date('Y-m-d'))->count();// 今日注册用户
+        $view['todayRegister'] = User::whereDate('created_at', date('Y-m-d'))->count(); // 今日注册用户
         $view['enableUserCount'] = User::whereEnable(1)->count(); // 有效用户数
         $view['activeUserCount'] = User::where('t', '>=', $past)->count(); // 活跃用户数
-        $view['unActiveUserCount'] = User::whereEnable(1)->whereBetween('t', [1, $past,])->count(); // 不活跃用户数
-        $view['onlineUserCount'] = User::where('t', '>=', strtotime("-10 minutes"))->count(); // 10分钟内在线用户数
+        $view['unActiveUserCount'] = User::whereEnable(1)->whereBetween('t', [1, $past])->count(); // 不活跃用户数
+        $view['onlineUserCount'] = User::where('t', '>=', strtotime('-10 minutes'))->count(); // 10分钟内在线用户数
         $view['expireWarningUserCount'] = User::whereBetween('expired_at',
-            [date('Y-m-d'), date('Y-m-d', strtotime("+".sysConfig('expire_days')." days"))])->count(); // 临近过期用户数
+            [date('Y-m-d'), date('Y-m-d', strtotime('+'.sysConfig('expire_days').' days'))])->count(); // 临近过期用户数
         $view['largeTrafficUserCount'] = User::whereRaw('(u + d) >= 107374182400')->where('status', '<>', -1)->count(); // 流量超过100G的用户
-        $view['flowAbnormalUserCount'] = count((new UserHourlyDataFlow)->trafficAbnormal());// 1小时内流量异常用户
+        $view['flowAbnormalUserCount'] = count((new UserHourlyDataFlow)->trafficAbnormal()); // 1小时内流量异常用户
         $view['nodeCount'] = Node::count();
         $view['unnormalNodeCount'] = Node::whereStatus(0)->count();
-        $view['flowCount'] = flowAutoShow(NodeDailyDataFlow::where('created_at', '>=', date('Y-m-d', strtotime("-30 days")))->sum('total'));
+        $view['flowCount'] = flowAutoShow(NodeDailyDataFlow::where('created_at', '>=', date('Y-m-d', strtotime('-30 days')))->sum('total'));
         $view['todayFlowCount'] = flowAutoShow(NodeDailyDataFlow::where('created_at', '>=', date('Y-m-d'))->sum('total'));
         $view['totalFlowCount'] = flowAutoShow(NodeDailyDataFlow::sum('total'));
         $view['totalCredit'] = User::where('credit', '<>', 0)->sum('credit') / 100;
@@ -76,7 +74,7 @@ class AdminController extends Controller
         if ($request->isMethod('POST')) {
             $new_password = $request->input('new_password');
 
-            if (!Hash::check($request->input('old_password'), Auth::getUser()->password)) {
+            if (! Hash::check($request->input('old_password'), Auth::getUser()->password)) {
                 return Redirect::back()->withErrors('旧密码错误,请重新输入');
             }
 
@@ -85,7 +83,7 @@ class AdminController extends Controller
             }
 
             $ret = Auth::getUser()->update(['password' => $new_password]);
-            if (!$ret) {
+            if (! $ret) {
                 return Redirect::back()->withErrors('修改失败');
             }
 
@@ -116,7 +114,7 @@ class AdminController extends Controller
             $obj->invitee_id = 0;
             $obj->code = strtoupper(substr(md5(microtime().Str::random(6)), 8, 12));
             $obj->status = 0;
-            $obj->dateline = date('Y-m-d H:i:s', strtotime("+".sysConfig('admin_invite_days')." days"));
+            $obj->dateline = date('Y-m-d H:i:s', strtotime('+'.sysConfig('admin_invite_days').' days'));
             $obj->save();
         }
 
@@ -169,5 +167,8 @@ class AdminController extends Controller
         return view('admin.config.config', $view);
     }
 
-    public function getPort(): int { return Helpers::getPort(); }
+    public function getPort(): int
+    {
+        return Helpers::getPort();
+    }
 }

+ 5 - 6
app/Http/Controllers/Api/WebApi/BaseController.php

@@ -20,7 +20,6 @@ use Response;
 
 class BaseController
 {
-
     // 上报节点心跳信息
     public function setNodeStatus(Request $request, $id): JsonResponse
     {
@@ -40,7 +39,7 @@ class BaseController
         $obj->log_time = time();
         $obj->save();
 
-        if (!$obj->id) {
+        if (! $obj->id) {
             return $this->returnData('生成节点心跳信息失败');
         }
 
@@ -71,7 +70,7 @@ class BaseController
         $inputArray = $request->all();
         $onlineCount = 0;
         foreach ($inputArray as $input) {
-            if (!Arr::has($input, ['ip', 'uid'])) {
+            if (! Arr::has($input, ['ip', 'uid'])) {
                 return $this->returnData('上报节点在线用户IP信息失败,请检查字段');
             }
 
@@ -83,7 +82,7 @@ class BaseController
             $obj->created_at = time();
             $obj->save();
 
-            if (!$obj->id) {
+            if (! $obj->id) {
                 return $this->returnData('生成节点在线用户IP信息失败');
             }
             $onlineCount++;
@@ -106,7 +105,7 @@ class BaseController
     public function setUserTraffic(Request $request, $id): JsonResponse
     {
         foreach ($request->all() as $input) {
-            if (!Arr::exists($input, 'uid')) {
+            if (! Arr::exists($input, 'uid')) {
                 return $this->returnData('上报用户流量日志失败,请检查字段');
             }
 
@@ -122,7 +121,7 @@ class BaseController
             $log->log_time = time();
             $log->save();
 
-            if (!$log->id) {
+            if (! $log->id) {
                 return $this->returnData('生成用户流量日志失败');
             }
             $user = User::find($log->user_id);

+ 20 - 20
app/Http/Controllers/Api/WebApi/V2RayController.php

@@ -16,26 +16,26 @@ class V2RayController extends BaseController
         $nodeDv = NodeCertificate::whereDomain($node->v2_host)->first();
 
         return $this->returnData('获取节点信息成功', 'success', 200, [
-                'id'              => $node->id,
-                'is_udp'          => $node->is_udp ? true : false,
-                'speed_limit'     => $node->speed_limit,
-                'client_limit'    => $node->client_limit,
-                'push_port'       => $node->push_port,
-                'redirect_url'    => sysConfig('redirect_url'),
-                'secret'          => $node->auth->secret,
-                'key'             => $nodeDv->key ?? '',
-                'pem'             => $nodeDv->pem ?? '',
-                'v2_license'      => sysConfig('v2ray_license'),
-                'v2_alter_id'     => $node->v2_alter_id,
-                'v2_port'         => $node->v2_port,
-                'v2_method'       => $node->v2_method,
-                'v2_net'          => $node->v2_net,
-                'v2_type'         => $node->v2_type,
-                'v2_host'         => $node->v2_host,
-                'v2_path'         => $node->v2_path,
-                'v2_tls'          => $node->v2_tls ? true : false,
-                'v2_tls_provider' => $node->tls_provider ?: sysConfig('v2ray_tls_provider'),
-            ]
+            'id'              => $node->id,
+            'is_udp'          => $node->is_udp ? true : false,
+            'speed_limit'     => $node->speed_limit,
+            'client_limit'    => $node->client_limit,
+            'push_port'       => $node->push_port,
+            'redirect_url'    => sysConfig('redirect_url'),
+            'secret'          => $node->auth->secret,
+            'key'             => $nodeDv->key ?? '',
+            'pem'             => $nodeDv->pem ?? '',
+            'v2_license'      => sysConfig('v2ray_license'),
+            'v2_alter_id'     => $node->v2_alter_id,
+            'v2_port'         => $node->v2_port,
+            'v2_method'       => $node->v2_method,
+            'v2_net'          => $node->v2_net,
+            'v2_type'         => $node->v2_type,
+            'v2_host'         => $node->v2_host,
+            'v2_path'         => $node->v2_path,
+            'v2_tls'          => $node->v2_tls ? true : false,
+            'v2_tls_provider' => $node->tls_provider ?: sysConfig('v2ray_tls_provider'),
+        ]
         );
     }
 

+ 15 - 16
app/Http/Controllers/Api/WebApi/VNetController.php

@@ -7,28 +7,27 @@ use Illuminate\Http\JsonResponse;
 
 class VNetController extends BaseController
 {
-
     // 获取节点信息
     public function getNodeInfo($id): JsonResponse
     {
         $node = Node::find($id);
 
         return $this->returnData('获取节点信息成功', 'success', 200, [
-                'id'           => $node->id,
-                'method'       => $node->method,
-                'protocol'     => $node->protocol,
-                'obfs'         => $node->obfs,
-                'obfs_param'   => $node->obfs_param ?? '',
-                'is_udp'       => $node->is_udp,
-                'speed_limit'  => $node->speed_limit,
-                'client_limit' => $node->client_limit,
-                'single'       => $node->single,
-                'port'         => (string) $node->port,
-                'passwd'       => $node->passwd ?? '',
-                'push_port'    => $node->push_port,
-                'secret'       => $node->auth->secret,
-                'redirect_url' => sysConfig('redirect_url'),
-            ]
+            'id'           => $node->id,
+            'method'       => $node->method,
+            'protocol'     => $node->protocol,
+            'obfs'         => $node->obfs,
+            'obfs_param'   => $node->obfs_param ?? '',
+            'is_udp'       => $node->is_udp,
+            'speed_limit'  => $node->speed_limit,
+            'client_limit' => $node->client_limit,
+            'single'       => $node->single,
+            'port'         => (string) $node->port,
+            'passwd'       => $node->passwd ?? '',
+            'push_port'    => $node->push_port,
+            'secret'       => $node->auth->secret,
+            'redirect_url' => sysConfig('redirect_url'),
+        ]
         );
     }
 

+ 29 - 32
app/Http/Controllers/AuthController.php

@@ -30,11 +30,9 @@ use Str;
 use Validator;
 
 /**
- * 认证控制器
+ * 认证控制器.
  *
  * Class AuthController
- *
- * @package App\Http\Controllers
  */
 class AuthController extends Controller
 {
@@ -65,17 +63,17 @@ class AuthController extends Controller
             }
 
             // 验证账号并创建会话
-            if (!Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
+            if (! Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
                 return Redirect::back()->withInput()->withErrors(trans('auth.login_error'));
             }
             $user = Auth::getUser();
 
-            if (!$user) {
+            if (! $user) {
                 return Redirect::back()->withInput()->withErrors(trans('auth.login_error'));
             }
 
             // 校验普通用户账号状态
-            if (!$user->is_admin) {
+            if (! $user->is_admin) {
                 if ($user->status < 0) {
                     Auth::logout(); // 强制销毁会话,因为Auth::attempt的时候会产生会话
 
@@ -119,7 +117,7 @@ class AuthController extends Controller
     {
         switch (sysConfig('is_captcha')) {
             case 1: // 默认图形验证码
-                if (!Captcha::check($request->input('captcha'))) {
+                if (! Captcha::check($request->input('captcha'))) {
                     return Redirect::back()->withInput()->withErrors(trans('auth.captcha_error'));
                 }
                 break;
@@ -160,7 +158,7 @@ class AuthController extends Controller
     }
 
     /**
-     * 添加用户登录日志
+     * 添加用户登录日志.
      *
      * @param  int  $userId  用户ID
      * @param  string  $ip  IP地址
@@ -170,7 +168,7 @@ class AuthController extends Controller
         $ipLocation = IP::getIPInfo($ip);
 
         if (empty($ipLocation) || empty($ipLocation['country'])) {
-            Log::warning("获取IP信息异常:".$ip);
+            Log::warning('获取IP信息异常:'.$ip);
         }
 
         $log = new UserLoginLog();
@@ -185,7 +183,6 @@ class AuthController extends Controller
         $log->save();
     }
 
-
     // 退出
     public function logout(): RedirectResponse
     {
@@ -238,7 +235,7 @@ class AuthController extends Controller
             Session::forget('register_token');
 
             // 是否开启注册
-            if (!sysConfig('is_register')) {
+            if (! sysConfig('is_register')) {
                 return Redirect::back()->withErrors(trans('auth.register_close'));
             }
 
@@ -264,12 +261,12 @@ class AuthController extends Controller
 
             // 注册前发送激活码
             if (sysConfig('is_activate_account') == 1) {
-                if (!$verify_code) {
+                if (! $verify_code) {
                     return Redirect::back()->withInput($request->except('verify_code'))->withErrors(trans('auth.captcha_null'));
                 }
 
                 $verifyCode = VerifyCode::whereAddress($email)->whereCode($verify_code)->whereStatus(0)->first();
-                if (!$verifyCode) {
+                if (! $verifyCode) {
                     return Redirect::back()->withInput($request->except('verify_code'))->withErrors(trans('auth.captcha_overtime'));
                 }
 
@@ -307,7 +304,7 @@ class AuthController extends Controller
             $uid = Helpers::addUser($email, $password, $transfer_enable, sysConfig('default_days'), $inviter_id);
 
             // 注册失败,抛出异常
-            if (!$uid) {
+            if (! $uid) {
                 return Redirect::back()->withInput()->withErrors(trans('auth.register_fail'));
             }
             // 更新昵称
@@ -376,17 +373,17 @@ class AuthController extends Controller
                         return Redirect::back()->withErrors(trans('auth.email_banned'));
                     }
 
-                    return Response::json(['status' => 'fail', 'message' => trans('auth.email_banned'),]);
+                    return Response::json(['status' => 'fail', 'message' => trans('auth.email_banned')]);
                 }
                 break;
             //白名单
             case 2:
-                if (!in_array(strtolower($emailSuffix[1]), $emailFilterList, true)) {
+                if (! in_array(strtolower($emailSuffix[1]), $emailFilterList, true)) {
                     if ($returnType) {
                         return Redirect::back()->withErrors(trans('auth.email_invalid'));
                     }
 
-                    return Response::json(['status' => 'fail', 'message' => trans('auth.email_invalid'),]);
+                    return Response::json(['status' => 'fail', 'message' => trans('auth.email_invalid')]);
                 }
                 break;
             default:
@@ -394,14 +391,14 @@ class AuthController extends Controller
                     return Redirect::back()->withErrors(trans('auth.email_invalid'));
                 }
 
-                return Response::json(['status' => 'fail', 'message' => trans('auth.email_invalid'),]);
+                return Response::json(['status' => 'fail', 'message' => trans('auth.email_invalid')]);
         }
 
         return false;
     }
 
     /**
-     * 获取AFF
+     * 获取AFF.
      *
      * @param  string|null  $code  邀请码
      * @param  int|null  $aff  URL中的aff参数
@@ -410,7 +407,7 @@ class AuthController extends Controller
      */
     private function getAff($code = null, $aff = null): array
     {
-        $data = ['inviter_id' => null, 'code_id' => 0];// 邀请人ID 与 邀请码ID
+        $data = ['inviter_id' => null, 'code_id' => 0]; // 邀请人ID 与 邀请码ID
 
         // 有邀请码先用邀请码,用谁的邀请码就给谁返利
         if ($code) {
@@ -422,7 +419,7 @@ class AuthController extends Controller
         }
 
         // 没有用邀请码或者邀请码是管理员生成的,则检查cookie或者url链接
-        if (!$data['inviter_id']) {
+        if (! $data['inviter_id']) {
             // 检查一下cookie里有没有aff
             $cookieAff = \Request::hasCookie('register_aff') ? \Request::cookie('register_aff') : 0;
             if ($cookieAff) {
@@ -468,13 +465,13 @@ class AuthController extends Controller
             $email = $request->input('email');
 
             // 是否开启重设密码
-            if (!sysConfig('is_reset_password')) {
+            if (! sysConfig('is_reset_password')) {
                 return Redirect::back()->withErrors(trans('auth.reset_password_close', ['email' => sysConfig('webmaster_email')]));
             }
 
             // 查找账号
             $user = User::whereEmail($email)->first();
-            if (!$user) {
+            if (! $user) {
                 return Redirect::back()->withErrors(trans('auth.email_notExist'));
             }
 
@@ -507,7 +504,7 @@ class AuthController extends Controller
     // 重设密码
     public function reset(Request $request, $token)
     {
-        if (!$token) {
+        if (! $token) {
             return Redirect::route('login');
         }
 
@@ -531,7 +528,7 @@ class AuthController extends Controller
             // 校验账号
             $verify = Verify::type(1)->whereToken($token)->first();
             $user = $verify->user;
-            if (!$verify) {
+            if (! $verify) {
                 return Redirect::route('login');
             }
 
@@ -548,7 +545,7 @@ class AuthController extends Controller
             }
 
             // 更新密码
-            if (!$user->update(['password' => $password])) {
+            if (! $user->update(['password' => $password])) {
                 return Redirect::back()->withErrors(trans('auth.reset_password_fail'));
             }
 
@@ -560,7 +557,7 @@ class AuthController extends Controller
         }
 
         $verify = Verify::type(1)->whereToken($token)->first();
-        if (!$verify) {
+        if (! $verify) {
             return Redirect::route('login');
         }
 
@@ -638,13 +635,13 @@ class AuthController extends Controller
     // 激活账号
     public function active($token)
     {
-        if (!$token) {
+        if (! $token) {
             return Redirect::route('login');
         }
 
         $verify = Verify::type(1)->with('user')->whereToken($token)->first();
         $user = $verify->user;
-        if (!$verify) {
+        if (! $verify) {
             return Redirect::route('login');
         }
 
@@ -677,7 +674,7 @@ class AuthController extends Controller
         }
 
         // 更新账号状态
-        if (!$user->update(['status' => 1])) {
+        if (! $user->update(['status' => 1])) {
             Session::flash('errorMsg', trans('auth.active_fail'));
 
             return Redirect::back();
@@ -712,7 +709,7 @@ class AuthController extends Controller
         $email = $request->input('email');
 
         if ($validator->fails()) {
-            return Response::json(['status' => 'fail', 'message' => $validator->getMessageBag()->first(),]);
+            return Response::json(['status' => 'fail', 'message' => $validator->getMessageBag()->first()]);
         }
         $ip = IP::getClientIP();
 
@@ -767,7 +764,7 @@ class AuthController extends Controller
     // 切换语言
     public function switchLang($locale): RedirectResponse
     {
-        Session::put("locale", $locale);
+        Session::put('locale', $locale);
 
         return Redirect::back();
     }

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

@@ -45,7 +45,7 @@ class Controller extends BaseController
             }
 
             $pos *= $base;
-            while (!feof($fp)) {
+            while (! feof($fp)) {
                 array_unshift($lines, fgets($fp));
             }
         }
@@ -54,7 +54,7 @@ class Controller extends BaseController
     }
 
     /**
-     * 计算文件行数
+     * 计算文件行数.
      *
      * @param $file
      *
@@ -64,7 +64,7 @@ class Controller extends BaseController
     {
         $fp = fopen($file, 'rb');
         $i = 0;
-        while (!feof($fp)) {
+        while (! feof($fp)) {
             //每次读取2M
             if ($data = fread($fp, 1024 * 1024 * 2)) {
                 //计算读取到的行数
@@ -94,9 +94,9 @@ class Controller extends BaseController
             $directory = date('Ymd');
             $path = '/assets/images/qrcode/'.$directory.'/';
             // 检查是否有该文件夹,如果没有就创建,并给予最高权限
-            if (!file_exists(public_path($path))
-                && !mkdir($concurrentDirectory = public_path($path), 0755, true)
-                && !is_dir($concurrentDirectory)) {
+            if (! file_exists(public_path($path))
+                && ! mkdir($concurrentDirectory = public_path($path), 0755, true)
+                && ! is_dir($concurrentDirectory)) {
                 throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
             }
 
@@ -113,7 +113,7 @@ class Controller extends BaseController
     }
 
     /**
-     * 节点信息
+     * 节点信息.
      *
      * @param  int  $uid  用户ID
      * @param  int  $nodeId  节点ID
@@ -126,7 +126,7 @@ class Controller extends BaseController
         $user = User::find($uid);
         $node = Node::find($nodeId);
         $scheme = null;
-        $group = sysConfig('website_name');// 分组名称
+        $group = sysConfig('website_name'); // 分组名称
         $host = $node->is_relay ? $node->relay_server : ($node->server ?: $node->ip);
         $data = null;
         switch ($node->type) {
@@ -135,16 +135,16 @@ class Controller extends BaseController
                 if ($infoType !== 1) {
                     // 生成v2ray scheme
                     $data = $this->v2raySubUrl($node->name, $host, $node->v2_port, $user->vmess_id, $node->v2_alter_id,
-                        $node->v2_net, $node->v2_type, $node->v2_host, $node->v2_path, $node->v2_tls ? "tls" : "");
+                        $node->v2_net, $node->v2_type, $node->v2_host, $node->v2_path, $node->v2_tls ? 'tls' : '');
                 } 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;
+                    $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;
                 }
                 break;
             case 3:
                 if ($infoType !== 1) {
                     $data = $this->trojanSubUrl($user->passwd, $host, $node->port, $node->name);
                 } else {
-                    $data = "备注:".$node->name.PHP_EOL."服务器:".$host.PHP_EOL."密码:".$user->passwd.PHP_EOL."端口:".$node->port.PHP_EOL;
+                    $data = '备注:'.$node->name.PHP_EOL.'服务器:'.$host.PHP_EOL.'密码:'.$user->passwd.PHP_EOL.'端口:'.$node->port.PHP_EOL;
                 }
                 break;
             case 1:
@@ -175,7 +175,7 @@ class Controller extends BaseController
                         $protocol_param, $node->name, $group, $node->is_udp);
                 } else {
                     // 生成文本配置信息
-                    $data = "服务器:".$host.PHP_EOL."IPv6:".$node->ipv6.PHP_EOL."服务器端口:".$port.PHP_EOL."密码:".$passwd.PHP_EOL."加密:".$method.PHP_EOL.($node->compatible ? '' : "协议:".$protocol.PHP_EOL."协议参数:".$protocol_param.PHP_EOL."混淆:".$obfs.PHP_EOL."混淆参数:".$node->obfs_param.PHP_EOL);
+                    $data = '服务器:'.$host.PHP_EOL.'IPv6:'.$node->ipv6.PHP_EOL.'服务器端口:'.$port.PHP_EOL.'密码:'.$passwd.PHP_EOL.'加密:'.$method.PHP_EOL.($node->compatible ? '' : '协议:'.$protocol.PHP_EOL.'协议参数:'.$protocol_param.PHP_EOL.'混淆:'.$obfs.PHP_EOL.'混淆参数:'.$node->obfs_param.PHP_EOL);
                 }
                 break;
             default:
@@ -187,18 +187,18 @@ class Controller extends BaseController
     public function v2raySubUrl($name, $host, $port, $uuid, $alter_id, $net, $type, $domain, $path, $tls): string
     {
         return 'vmess://'.base64url_encode(json_encode([
-                "v"    => "2",
-                "ps"   => $name,
-                "add"  => $host,
-                "port" => $port,
-                "id"   => $uuid,
-                "aid"  => $alter_id,
-                "net"  => $net,
-                "type" => $type,
-                "host" => $domain,
-                "path" => $path,
-                "tls"  => $tls ? "tls" : "",
-            ], JSON_PRETTY_PRINT));
+            'v'    => '2',
+            'ps'   => $name,
+            'add'  => $host,
+            'port' => $port,
+            'id'   => $uuid,
+            'aid'  => $alter_id,
+            'net'  => $net,
+            'type' => $type,
+            'host' => $domain,
+            'path' => $path,
+            'tls'  => $tls ? 'tls' : '',
+        ], JSON_PRETTY_PRINT));
     }
 
     public function trojanSubUrl($password, $domain, $port, $remark): string
@@ -249,8 +249,8 @@ class Controller extends BaseController
         return [
             'trafficDaily'  => json_encode($dailyData),
             'trafficHourly' => json_encode($hourlyData),
-            'monthDays'     => json_encode(range(1, date("j"), 1)),// 本月天数
-            'dayHours'      => json_encode(range(0, date("G") + 1, 1))// 本日小时
+            'monthDays'     => json_encode(range(1, date('j'), 1)), // 本月天数
+            'dayHours'      => json_encode(range(0, date('G') + 1, 1)), // 本日小时
         ];
     }
 }

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

@@ -50,7 +50,7 @@ abstract class AbstractPayment
     }
 
     /**
-     *  Alipay式数据MD5签名
+     *  Alipay式数据MD5签名.
      *
      * @param  array  $data  需要加密的数组
      * @param  string  $key  尾部的密钥

+ 0 - 1
app/Http/Controllers/Gateway/EPay.php

@@ -69,7 +69,6 @@ class EPay extends AbstractPayment
             'key' => sysConfig('epay_key'),
         ]);
 
-
         if ($response->ok()) {
             return Response::json(['status' => 'success', 'data' => $response->json()]);
         }

+ 8 - 8
app/Http/Controllers/Gateway/F2Fpay.php

@@ -46,13 +46,13 @@ class F2Fpay extends AbstractPayment
         try {
             $result = (new Client(Client::ALIPAY, self::$aliConfig))->pay(Client::ALI_CHANNEL_QR, $data);
         } catch (InvalidArgumentException $e) {
-            Log::error("【支付宝当面付】输入信息错误: ".$e->getMessage());
+            Log::error('【支付宝当面付】输入信息错误: '.$e->getMessage());
             exit;
         } catch (ClassNotFoundException $e) {
-            Log::error("【支付宝当面付】未知类型: ".$e->getMessage());
+            Log::error('【支付宝当面付】未知类型: '.$e->getMessage());
             exit;
         } catch (Exception $e) {
-            Log::error("【支付宝当面付】错误: ".$e->getMessage());
+            Log::error('【支付宝当面付】错误: '.$e->getMessage());
             exit;
         }
 
@@ -70,19 +70,19 @@ class F2Fpay extends AbstractPayment
 
         try {
             $result = (new Client(Client::ALIPAY, self::$aliConfig))->tradeQuery($data);
-            Log::info("【支付宝当面付】回调验证查询:".var_export($result, true));
+            Log::info('【支付宝当面付】回调验证查询:'.var_export($result, true));
         } catch (InvalidArgumentException $e) {
-            Log::error("【支付宝当面付】回调信息错误: ".$e->getMessage());
+            Log::error('【支付宝当面付】回调信息错误: '.$e->getMessage());
             exit;
         } catch (ClassNotFoundException $e) {
-            Log::error("【支付宝当面付】未知类型: ".$e->getMessage());
+            Log::error('【支付宝当面付】未知类型: '.$e->getMessage());
             exit;
         } catch (Exception $e) {
-            Log::error("【支付宝当面付】错误: ".$e->getMessage());
+            Log::error('【支付宝当面付】错误: '.$e->getMessage());
             exit;
         }
 
-        if ($result['code'] == 10000 && $result['msg'] === "Success") {
+        if ($result['code'] == 10000 && $result['msg'] === 'Success') {
             if ($_POST['trade_status'] === 'TRADE_FINISHED' || $_POST['trade_status'] === 'TRADE_SUCCESS') {
                 $payment = Payment::whereTradeNo($request->input('out_trade_no'))->first();
                 if ($payment) {

+ 3 - 2
app/Http/Controllers/Gateway/Local.php

@@ -1,6 +1,5 @@
 <?php
 
-
 namespace App\Http\Controllers\Gateway;
 
 use App\Components\Helpers;
@@ -28,5 +27,7 @@ class Local extends AbstractPayment
         return Response::json(['status' => 'success', 'message' => '购买完成!']);
     }
 
-    public function notify($request): void { }
+    public function notify($request): void
+    {
+    }
 }

+ 4 - 5
app/Http/Controllers/Gateway/PayPal.php

@@ -1,6 +1,5 @@
 <?php
 
-
 namespace App\Http\Controllers\Gateway;
 
 use App\Models\Payment;
@@ -51,7 +50,7 @@ class PayPal extends AbstractPayment
 
         try {
             $response = $this->provider->setExpressCheckout($data);
-            if (!$response['paypal_link']) {
+            if (! $response['paypal_link']) {
                 Log::error('Paypal处理错误:'.var_export($response, true));
 
                 return Response::json(['status' => 'fail', 'message' => '创建订单失败,请使用其他方式或通知管理员!']);
@@ -60,7 +59,7 @@ class PayPal extends AbstractPayment
 
             return Response::json(['status' => 'success', 'url' => $response['paypal_link'], 'message' => '创建订单成功!']);
         } catch (Exception $e) {
-            Log::error("【PayPal】错误: ".$e->getMessage());
+            Log::error('【PayPal】错误: '.$e->getMessage());
             exit;
         }
     }
@@ -101,7 +100,7 @@ class PayPal extends AbstractPayment
             $payment_status = $this->provider->doExpressCheckoutPayment($data, $token, $PayerID);
             $status = $payment_status['PAYMENTINFO_0_PAYMENTSTATUS'];
 
-            if (!strcasecmp($status, 'Completed') || !strcasecmp($status, 'Processed')) {
+            if (! strcasecmp($status, 'Completed') || ! strcasecmp($status, 'Processed')) {
                 Log::info("Order $payment->order_id has been paid successfully!");
                 $payment->order->update(['status' => 1]);
             } else {
@@ -133,6 +132,6 @@ class PayPal extends AbstractPayment
                 }
             }
         }
-        exit("fail");
+        exit('fail');
     }
 }

+ 10 - 12
app/Http/Controllers/PaymentController.php

@@ -22,11 +22,9 @@ use Log;
 use Response;
 
 /**
- * 支付控制器
+ * 支付控制器.
  *
  * Class PaymentController
- *
- * @package App\Http\Controllers
  */
 class PaymentController extends Controller
 {
@@ -36,7 +34,7 @@ class PaymentController extends Controller
     {
         self::$method = $request->input('method');
 
-        Log::info(self::$method."回调接口[POST]:".self::$method.var_export($request->all(), true));
+        Log::info(self::$method.'回调接口[POST]:'.self::$method.var_export($request->all(), true));
         self::getClient()->notify($request);
 
         return 0;
@@ -60,7 +58,7 @@ class PaymentController extends Controller
             case 'epay':
                 return new EPay();
             default:
-                Log::error("未知支付:".self::$method);
+                Log::error('未知支付:'.self::$method);
 
                 return false;
         }
@@ -97,13 +95,13 @@ class PaymentController extends Controller
         $goods = Goods::find($goods_id);
         // 充值余额
         if ($credit) {
-            if (!is_numeric($credit) || $credit <= 0) {
+            if (! is_numeric($credit) || $credit <= 0) {
                 return Response::json(['status' => 'fail', 'message' => '充值余额不合规']);
             }
             $amount = $credit;
-            // 购买服务
+        // 购买服务
         } elseif ($goods_id && self::$method) {
-            if (!$goods || !$goods->status) {
+            if (! $goods || ! $goods->status) {
                 return Response::json(['status' => 'fail', 'message' => '订单创建失败:商品已下架']);
             }
             $amount = $goods->price;
@@ -119,7 +117,7 @@ class PaymentController extends Controller
             //非余额付款下,检查在线支付是否开启
             if (self::$method !== 'credit') {
                 // 判断是否开启在线支付
-                if (!sysConfig('is_onlinePay')) {
+                if (! sysConfig('is_onlinePay')) {
                     return Response::json(['status' => 'fail', 'message' => '订单创建失败:系统并未开启在线支付功能']);
                 }
 
@@ -142,7 +140,7 @@ class PaymentController extends Controller
             // 使用优惠券 TODO 代码整合至 CouponService
             if ($coupon_sn) {
                 $coupon = Coupon::whereStatus(0)->whereIn('type', [1, 2])->whereSn($coupon_sn)->first();
-                if (!$coupon) {
+                if (! $coupon) {
                     return Response::json(['status' => 'fail', 'message' => '订单创建失败:优惠券不存在']);
                 }
 
@@ -179,7 +177,7 @@ class PaymentController extends Controller
             $order->save();
 
             // 使用优惠券,减少可使用次数
-            if (!empty($coupon)) {
+            if (! empty($coupon)) {
                 if ($coupon->usable_times > 0) {
                     Coupon::whereId($coupon->id)->decrement('usable_times', 1);
                 }
@@ -202,7 +200,7 @@ class PaymentController extends Controller
     {
         $order = Order::find($request->input('id'));
         if ($order) {
-            if (!$order->update(['status' => -1])) {
+            if (! $order->update(['status' => -1])) {
                 return Response::json(['status' => 'fail', 'message' => '关闭订单失败']);
             }
         } else {

+ 1 - 2
app/Http/Controllers/User/AffiliateController.php

@@ -12,7 +12,6 @@ use Response;
 
 class AffiliateController extends Controller
 {
-
     // 推广返利
     public function referral()
     {
@@ -50,7 +49,7 @@ class AffiliateController extends Controller
         $commission = ReferralLog::uid()->whereStatus(0)->sum('commission');
         $commission /= 100;
         if ($commission < sysConfig('referral_money')) {
-            return Response::json(['status' => 'fail', 'message' => '申请失败:满'.sysConfig('referral_money').'元才可以提现,继续努力吧',]);
+            return Response::json(['status' => 'fail', 'message' => '申请失败:满'.sysConfig('referral_money').'元才可以提现,继续努力吧']);
         }
 
         $ref = new ReferralApply();

+ 6 - 6
app/Http/Controllers/User/SubscribeController.php

@@ -25,7 +25,7 @@ class SubscribeController extends Controller
 
         // 检查订阅码是否有效
         $subscribe = UserSubscribe::whereCode($code)->first();
-        if (!$subscribe) {
+        if (! $subscribe) {
             exit($this->infoGenerator('使用的订阅链接错误!请重新从官网获取!'));
         }
 
@@ -35,7 +35,7 @@ class SubscribeController extends Controller
 
         // 检查用户是否有效
         $user = $subscribe->user;
-        if (!$user) {
+        if (! $user) {
             exit($this->infoGenerator('错误订阅链接,账号不存在!请前往官网重新获取订阅链接'));
         }
 
@@ -123,10 +123,10 @@ class SubscribeController extends Controller
         switch ($this->subType) {
             case 2:
                 $result = 'vmess://'.base64url_encode(json_encode([
-                        "v"   => "2", "ps" => $text, "add" => "0.0.0.0", "port" => 0, "id" => 0,
-                        "aid" => 0, "net" => "tcp", "type" => "none", "host" => "", "path" => "/",
-                        'tls' => "tls",
-                    ], JSON_PRETTY_PRINT));
+                    'v'   => '2', 'ps' => $text, 'add' => '0.0.0.0', 'port' => 0, 'id' => 0,
+                    'aid' => 0, 'net' => 'tcp', 'type' => 'none', 'host' => '', 'path' => '/',
+                    'tls' => 'tls',
+                ], JSON_PRETTY_PRINT));
                 break;
             case 3:
                 $result = 'trojan://0@0.0.0.0:0?peer=0.0.0.0#'.rawurlencode($text);

+ 23 - 23
app/Http/Controllers/UserController.php

@@ -37,18 +37,16 @@ use Str;
 use Validator;
 
 /**
- * 用户控制器
+ * 用户控制器.
  *
  * Class UserController
- *
- * @package App\Http\Controllers
  */
 class UserController extends Controller
 {
     public function index()
     {
         $user = Auth::getUser();
-        if (!$user) {
+        if (! $user) {
             return redirect()->route('login');
         }
         $totalTransfer = $user->transfer_enable;
@@ -78,7 +76,7 @@ class UserController extends Controller
     {
         $user = Auth::getUser();
         // 系统开启登录加积分功能才可以签到
-        if (!sysConfig('is_checkin')) {
+        if (! sysConfig('is_checkin')) {
             return Response::json(['status' => 'fail', 'message' => '系统未开启签到功能']);
         }
 
@@ -89,7 +87,7 @@ class UserController extends Controller
 
         $traffic = random_int((int) sysConfig('min_rand_traffic'), (int) sysConfig('max_rand_traffic')) * MB;
 
-        if (!(new UserService())->incrementData($traffic)) {
+        if (! (new UserService())->incrementData($traffic)) {
             return Response::json(['status' => 'fail', 'message' => '签到失败,系统异常']);
         }
 
@@ -136,7 +134,7 @@ class UserController extends Controller
             $node->hk = round($data->pluck('hk')->filter()->avg(), 2);
 
             // 节点在线状态
-            $node->offline = !in_array($node->id, $onlineNode, true);
+            $node->offline = ! in_array($node->id, $onlineNode, true);
         }
         $view['nodeList'] = $nodeList ?? [];
 
@@ -165,7 +163,7 @@ class UserController extends Controller
 
             // 修改密码
             if ($old_password && $new_password) {
-                if (!Hash::check($old_password, $user->password)) {
+                if (! Hash::check($old_password, $user->password)) {
                     return Redirect::back()->withErrors('旧密码错误,请重新输入');
                 }
 
@@ -178,7 +176,7 @@ class UserController extends Controller
                     return Redirect::back()->withErrors('演示环境禁止修改管理员密码');
                 }
 
-                if (!$user->update(['password' => $new_password])) {
+                if (! $user->update(['password' => $new_password])) {
                     return Redirect::back()->withErrors('修改失败');
                 }
 
@@ -187,7 +185,7 @@ class UserController extends Controller
             }
 
             if ($passwd) {
-                if (!$user->update(['passwd' => $passwd])) {
+                if (! $user->update(['passwd' => $passwd])) {
                     return Redirect::back()->withErrors('修改失败');
                 }
 
@@ -199,7 +197,7 @@ class UserController extends Controller
                 return Redirect::back()->withErrors('修改失败,昵称不能为空值');
             }
 
-            if (!$user->update(['username' => $username, 'wechat' => $wechat, 'qq' => $qq])) {
+            if (! $user->update(['username' => $username, 'wechat' => $wechat, 'qq' => $qq])) {
                 return Redirect::back()->withErrors('修改失败');
             }
 
@@ -304,7 +302,7 @@ class UserController extends Controller
         $user = Auth::getUser();
         $title = $request->input('title');
         $content = clean($request->input('content'));
-        $content = str_replace(["atob", "eval"], "", $content);
+        $content = str_replace(['atob', 'eval'], '', $content);
 
         if (empty($title) || empty($content)) {
             return Response::json(['status' => 'fail', 'message' => '请输入标题和内容']);
@@ -318,8 +316,8 @@ class UserController extends Controller
         $obj->save();
 
         if ($obj->id) {
-            $emailTitle = "新工单提醒";
-            $content = "标题:【".$title."】<br>用户:".$user->email."<br>内容:".$content;
+            $emailTitle = '新工单提醒';
+            $content = '标题:【'.$title.'】<br>用户:'.$user->email.'<br>内容:'.$content;
 
             // 发邮件通知管理员
             if (sysConfig('webmaster_email')) {
@@ -344,7 +342,7 @@ class UserController extends Controller
 
         if ($request->isMethod('POST')) {
             $content = clean($request->input('content'));
-            $content = str_replace(["atob", "eval"], "", $content);
+            $content = str_replace(['atob', 'eval'], '', $content);
             $content = substr($content, 0, 300);
 
             if (empty($content)) {
@@ -366,8 +364,8 @@ class UserController extends Controller
                 $ticket->status = 0;
                 $ticket->save();
 
-                $title = "工单回复提醒";
-                $content = "标题:【".$ticket->title."】<br>用户回复:".$content;
+                $title = '工单回复提醒';
+                $content = '标题:【'.$ticket->title.'】<br>用户回复:'.$content;
 
                 // 发邮件通知管理员
                 if (sysConfig('webmaster_email')) {
@@ -433,7 +431,7 @@ class UserController extends Controller
         $obj->invitee_id = 0;
         $obj->code = strtoupper(mb_substr(md5(microtime().Str::random()), 8, 12));
         $obj->status = 0;
-        $obj->dateline = date('Y-m-d H:i:s', strtotime("+".sysConfig('user_invite_days')." days"));
+        $obj->dateline = date('Y-m-d H:i:s', strtotime('+'.sysConfig('user_invite_days').' days'));
         $obj->save();
         if ($obj) {
             $user->update(['invite_num' => $user->invite_num - 1]);
@@ -455,7 +453,7 @@ class UserController extends Controller
         }
 
         $coupon = Coupon::whereSn($coupon_sn)->whereIn('type', [1, 2])->first();
-        if (!$coupon) {
+        if (! $coupon) {
             return Response::json(['status' => 'fail', 'title' => '优惠券不存在', 'message' => '请确认优惠券是否输入正确!']);
         }
 
@@ -563,7 +561,7 @@ class UserController extends Controller
         } catch (Exception $e) {
             DB::rollBack();
 
-            Log::error("更换订阅地址异常:".$e->getMessage());
+            Log::error('更换订阅地址异常:'.$e->getMessage());
 
             return Response::json(['status' => 'fail', 'message' => '更换失败'.$e->getMessage()]);
         }
@@ -572,7 +570,7 @@ class UserController extends Controller
     // 转换成管理员的身份
     public function switchToAdmin(): JsonResponse
     {
-        if (!Session::has('admin')) {
+        if (! Session::has('admin')) {
             return Response::json(['status' => 'fail', 'message' => '非法请求']);
         }
 
@@ -580,7 +578,7 @@ class UserController extends Controller
         $user = Auth::loginUsingId(Session::get('admin'));
         Session::forget('admin');
         if ($user) {
-            return Response::json(['status' => 'success', 'message' => "身份切换成功"]);
+            return Response::json(['status' => 'success', 'message' => '身份切换成功']);
         }
 
         return Response::json(['status' => 'fail', 'message' => '身份切换失败']);
@@ -591,7 +589,9 @@ class UserController extends Controller
     {
         $validator = Validator::make($request->all(), [
             'coupon_sn' => [
-                'required', Rule::exists('coupon', 'sn')->where(static function ($query) { $query->whereType(3)->whereStatus(0); }),
+                'required', Rule::exists('coupon', 'sn')->where(static function ($query) {
+                    $query->whereType(3)->whereStatus(0);
+                }),
             ],
         ], ['coupon_sn.required' => '券码不能为空', 'coupon_sn.exists' => '该券不可用']);
 

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

@@ -9,7 +9,7 @@ use Illuminate\Http\Request;
 class Affiliate
 {
     /**
-     * 返利识别
+     * 返利识别.
      *
      * @param  Request  $request
      * @param  Closure  $next

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

@@ -16,7 +16,7 @@ class Authenticate extends Middleware
      */
     protected function redirectTo($request)
     {
-        if (!$request->expectsJson()) {
+        if (! $request->expectsJson()) {
             return route('login');
         }
     }

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

@@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware
      * @var array
      */
     protected $except = [
-        "callback/notify",
+        'callback/notify',
     ];
 }

+ 4 - 4
app/Http/Middleware/WebApi.php

@@ -24,21 +24,21 @@ class WebApi
         $key = $request->header('key');
         $time = $request->header('timestamp');
 
-        if (!isset($key)) {// 未提供 key
+        if (! isset($key)) {// 未提供 key
             return $this->returnData('Your key is null!');
         }
 
-        if (!isset($id)) {// 未提供 node
+        if (! isset($id)) {// 未提供 node
             return $this->returnData('Your Node Id is null!');
         }
 
         $node = Node::find($id);
-        if (!$node) {// node不存在
+        if (! $node) {// node不存在
             return $this->returnData('Unknown Node!');
         }
 
         $nodeAuth = NodeAuth::whereNodeId($id)->first();
-        if (!$nodeAuth || $key !== $nodeAuth->key) {// key不存在/不匹配
+        if (! $nodeAuth || $key !== $nodeAuth->key) {// key不存在/不匹配
             return $this->returnData('Token is invalid!');
         }
 

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

@@ -10,7 +10,7 @@ use Redirect;
 class isAdmin
 {
     /**
-     * 校验是否为管理员身份
+     * 校验是否为管理员身份.
      *
      * @param  Request  $request
      * @param  Closure  $next
@@ -19,7 +19,7 @@ class isAdmin
      */
     public function handle(Request $request, Closure $next)
     {
-        if (!Auth::getUser()->is_admin) {
+        if (! Auth::getUser()->is_admin) {
             return Redirect::route('home');
         }
 

+ 8 - 9
app/Http/Middleware/isForbidden.php

@@ -11,9 +11,8 @@ use Response;
 
 class isForbidden
 {
-
     /**
-     * 限制机器人、指定IP访问
+     * 限制机器人、指定IP访问.
      *
      * @param  Request  $request
      * @param  Closure  $next
@@ -24,15 +23,15 @@ class isForbidden
     {
         // 拒绝机器人访问
         if (sysConfig('is_forbid_robot') && Agent::isRobot()) {
-            Log::info("识别到机器人访问(".IP::getClientIp().")");
+            Log::info('识别到机器人访问('.IP::getClientIp().')');
 
             return Response::view('auth.error', ['message' => trans('error.ForbiddenRobot')], 403);
         }
 
         // 拒绝通过订阅链接域名访问网站,防止网站被探测
         if (false !== strpos(sysConfig('subscribe_domain'), $request->getHost())
-            && !str_contains(sysConfig('subscribe_domain'), sysConfig('website_url'))) {
-            Log::info("识别到通过订阅链接访问,强制跳转至百度(".IP::getClientIp().")");
+            && ! str_contains(sysConfig('subscribe_domain'), sysConfig('website_url'))) {
+            Log::info('识别到通过订阅链接访问,强制跳转至百度('.IP::getClientIp().')');
 
             return redirect('https://www.baidu.com');
         }
@@ -41,15 +40,15 @@ class isForbidden
         $ipLocation = IP::getIPInfo($ip);
 
         // 拒绝无IP请求
-        if (!$ipLocation || empty(array_filter($ipLocation))) {
+        if (! $ipLocation || empty(array_filter($ipLocation))) {
             return Response::view('auth.error', ['message' => trans('error.ForbiddenAccess')], 403);
         }
 
-        if (!in_array($ipLocation['country'], ['本机地址', '局域网']) && sysConfig('forbid_mode')) {
+        if (! in_array($ipLocation['country'], ['本机地址', '局域网']) && sysConfig('forbid_mode')) {
             // 拒绝大陆IP访问
             switch (sysConfig('forbid_mode')) {
                 case 'ban_mainland':
-                    if (in_array($ipLocation['country'], ['China', '中国']) && !in_array($ipLocation['province'], ['香港', '澳门', '台湾', '台湾省'])) {
+                    if (in_array($ipLocation['country'], ['China', '中国']) && ! in_array($ipLocation['province'], ['香港', '澳门', '台湾', '台湾省'])) {
                         Log::info('识别到大陆IP,拒绝访问:'.$ip);
 
                         return Response::view('auth.error', ['message' => trans('error.ForbiddenChina')], 403);
@@ -63,7 +62,7 @@ class isForbidden
                     }
                     break;
                 case 'ban_oversea':
-                    if (!in_array($ipLocation['country'], ['China', '中国', 'Taiwan', 'Hong Kong', 'Macao'])) {
+                    if (! in_array($ipLocation['country'], ['China', '中国', 'Taiwan', 'Hong Kong', 'Macao'])) {
                         Log::info('识别到海外IP,拒绝访问:'.$ip.' - '.$ipLocation['country']);
 
                         return Response::view('auth.error', ['message' => trans('error.ForbiddenOversea')], 403);

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

@@ -9,7 +9,7 @@ use Redirect;
 class isLogin
 {
     /**
-     * 校验是否已登录
+     * 校验是否已登录.
      *
      * @param  Request  $request
      * @param  Closure  $next

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

@@ -8,7 +8,7 @@ use Illuminate\Http\Request;
 class isMaintenance
 {
     /**
-     * 校验是否开启维护模式
+     * 校验是否开启维护模式.
      *
      * @param  Request  $request
      * @param  Closure  $next

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

@@ -11,7 +11,7 @@ use Response;
 class isSecurity
 {
     /**
-     * 是否需要安全码才访问(仅用于登录页)
+     * 是否需要安全码才访问(仅用于登录页).
      *
      * @param           $request
      * @param  Closure  $next
@@ -25,9 +25,9 @@ class isSecurity
         $cacheKey = 'SecurityLogin_'.ip2long($ip);
         $websiteSecurityCode = sysConfig('website_security_code');
 
-        if ($websiteSecurityCode && !Cache::has($cacheKey)) {
+        if ($websiteSecurityCode && ! Cache::has($cacheKey)) {
             if ($code !== $websiteSecurityCode) {
-                Log::info("拒绝非安全入口访问(".$ip.")");
+                Log::info('拒绝非安全入口访问('.$ip.')');
 
                 return Response::view(
                     'auth.error',

+ 1 - 1
app/Http/Requests/Admin/NodeRequest.php

@@ -12,7 +12,7 @@ class NodeRequest extends FormRequest
             'type'           => 'required|between:1,3',
             'name'           => 'required',
             'country_code'   => 'required',
-            'server'         => 'required_if:is_ddns,1|nullable|ends_with:'.implode(",", config('domains')),
+            'server'         => 'required_if:is_ddns,1|nullable|ends_with:'.implode(',', config('domains')),
             'push_port'      => 'numeric|between:0,65535',
             'traffic_rate'   => 'required|numeric|min:0',
             'level'          => 'required|numeric|between:0,255',

+ 1 - 1
app/Jobs/VNet/reloadNode.php

@@ -47,7 +47,7 @@ class reloadNode implements ShouldQueue
                 //			'redirect_url'   => (string) sysConfig('redirect_url')
             ]);
 
-            if (!$ret) {
+            if (! $ret) {
                 $allSuccess = false;
             }
         }

+ 1 - 1
app/Models/Article.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
 
 /**
- * 文章
+ * 文章.
  */
 class Article extends Model
 {

+ 1 - 1
app/Models/Config.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 系统配置
+ * 系统配置.
  */
 class Config extends Model
 {

+ 1 - 1
app/Models/Country.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 国家/地区
+ * 国家/地区.
  */
 class Country extends Model
 {

+ 1 - 1
app/Models/Coupon.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\SoftDeletes;
 
 /**
- * 优惠券
+ * 优惠券.
  */
 class Coupon extends Model
 {

+ 1 - 1
app/Models/CouponLog.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 优惠券使用日志
+ * 优惠券使用日志.
  */
 class CouponLog extends Model
 {

+ 1 - 1
app/Models/EmailFilter.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 邮箱后缀过滤
+ * 邮箱后缀过滤.
  */
 class EmailFilter extends Model
 {

+ 1 - 1
app/Models/Label.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\HasMany;
 
 /**
- * 标签
+ * 标签.
  */
 class Label extends Model
 {

+ 1 - 1
app/Models/Level.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 等级
+ * 等级.
  */
 class Level extends Model
 {

+ 1 - 1
app/Models/Node.php

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 
 /**
- * 节点配置信息
+ * 节点配置信息.
  */
 class Node extends Model
 {

+ 1 - 1
app/Models/NodeAuth.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 节点授权密钥
+ * 节点授权密钥.
  */
 class NodeAuth extends Model
 {

+ 1 - 1
app/Models/NodeCertificate.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 伪装域名证书
+ * 伪装域名证书.
  */
 class NodeCertificate extends Model
 {

+ 2 - 2
app/Models/NodeHeartBeat.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 节点负载信息
+ * 节点负载信息.
  */
 class NodeHeartBeat extends Model
 {
@@ -14,6 +14,6 @@ class NodeHeartBeat extends Model
 
     public function scopeRecently($query)
     {
-        return $query->where('log_time', '>=', strtotime("-10 minutes"))->latest('log_time');
+        return $query->where('log_time', '>=', strtotime('-10 minutes'))->latest('log_time');
     }
 }

+ 1 - 1
app/Models/NodeLabel.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 节点标签
+ * 节点标签.
  */
 class NodeLabel extends Model
 {

+ 1 - 1
app/Models/NodeOnlineLog.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 节点用户在线情况
+ * 节点用户在线情况.
  */
 class NodeOnlineLog extends Model
 {

+ 1 - 1
app/Models/NodeOnlineUserIp.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 节点在线用户IP信息
+ * 节点在线用户IP信息.
  */
 class NodeOnlineUserIp extends Model
 {

+ 1 - 1
app/Models/NodeRule.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 节点审计规则关联
+ * 节点审计规则关联.
  */
 class NodeRule extends Model
 {

+ 1 - 1
app/Models/NotificationLog.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 推送通知日志
+ * 推送通知日志.
  */
 class NotificationLog extends Model
 {

+ 8 - 5
app/Models/Order.php

@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
 use Illuminate\Database\Eloquent\Relations\HasOne;
 
 /**
- * 订单
+ * 订单.
  */
 class Order extends Model
 {
@@ -43,7 +43,7 @@ class Order extends Model
 
     public function scopeRecentUnPay($query)
     {
-        return $query->whereStatus(0)->where('created_at', '<=', date("Y-m-d H:i:s", strtotime("-15 minutes")));
+        return $query->whereStatus(0)->where('created_at', '<=', date('Y-m-d H:i:s', strtotime('-15 minutes')));
     }
 
     public function scopeUserPrepay($query, $uid = null)
@@ -58,12 +58,16 @@ class Order extends Model
 
     public function scopeActivePlan($query)
     {
-        return $query->active()->with('goods')->whereHas('goods', static function ($list) { $list->whereType(2); });
+        return $query->active()->with('goods')->whereHas('goods', static function ($list) {
+            $list->whereType(2);
+        });
     }
 
     public function scopeActivePackage($query)
     {
-        return $query->active()->with('goods')->whereHas('goods', static function ($list) { $list->whereType(1); });
+        return $query->active()->with('goods')->whereHas('goods', static function ($list) {
+            $list->whereType(1);
+        });
     }
 
     public function scopeUserActivePlan($query, $uid = null)
@@ -99,7 +103,6 @@ class Order extends Model
         return $status_label;
     }
 
-
     public function getOriginAmountAttribute($value)
     {
         return $value / 100;

+ 1 - 1
app/Models/Payment.php

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 支付单
+ * 支付单.
  */
 class Payment extends Model
 {

+ 1 - 1
app/Models/PaymentCallback.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 支付回调日志
+ * 支付回调日志.
  */
 class PaymentCallback extends Model
 {

+ 1 - 1
app/Models/ProductsPool.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 产品名称池
+ * 产品名称池.
  */
 class ProductsPool extends Model
 {

+ 1 - 1
app/Models/ReferralApply.php

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 返利申请
+ * 返利申请.
  */
 class ReferralApply extends Model
 {

+ 1 - 1
app/Models/ReferralLog.php

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 返利日志
+ * 返利日志.
  */
 class ReferralLog extends Model
 {

+ 1 - 1
app/Models/Rule.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 审计规则
+ * 审计规则.
  */
 class Rule extends Model
 {

+ 1 - 1
app/Models/RuleGroup.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 审计规则分组
+ * 审计规则分组.
  */
 class RuleGroup extends Model
 {

+ 1 - 1
app/Models/RuleGroupNode.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 审计规则分组节点关联
+ * 审计规则分组节点关联.
  */
 class RuleGroupNode extends Model
 {

+ 1 - 1
app/Models/RuleLog.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 触发审计规则日志
+ * 触发审计规则日志.
  */
 class RuleLog extends Model
 {

+ 1 - 1
app/Models/SsConfig.php

@@ -5,7 +5,7 @@ namespace App\Models;
 use Illuminate\Database\Eloquent\Model;
 
 /**
- * 配置信息
+ * 配置信息.
  */
 class SsConfig extends Model
 {

+ 1 - 1
app/Models/Ticket.php

@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 工单
+ * 工单.
  */
 class Ticket extends Model
 {

+ 1 - 1
app/Models/TicketReply.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 工单回复
+ * 工单回复.
  */
 class TicketReply extends Model
 {

+ 1 - 1
app/Models/User.php

@@ -11,7 +11,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
 use Illuminate\Notifications\Notifiable;
 
 /**
- * 用户信息
+ * 用户信息.
  */
 class User extends Authenticatable
 {

+ 1 - 1
app/Models/UserBanedLog.php

@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 /**
- * 用户封禁日志
+ * 用户封禁日志.
  */
 class UserBanedLog extends Model
 {

Some files were not shown because too many files changed in this diff