Browse Source

Fix #137 orwhere使用错误造成的误判 & 补全翻译文件

兔姬桑 4 năm trước cách đây
mục cha
commit
c256c8e8e7

+ 3 - 2
app/Console/Commands/AutoJob.php

@@ -167,8 +167,9 @@ class AutoJob extends Command
 
         // 被封禁 / 过期xx天 的账号自动释放端口
         User::where('port', '<>', 0)
-            ->whereStatus(-1)
-            ->orWhere('expired_at', '<=', date('Y-m-d', strtotime('-'.config('tasks.release_port').' days')))
+            ->where(function ($query) {
+                $query->whereStatus(-1)->orWhere('expired_at', '<=', date('Y-m-d', strtotime('-'.config('tasks.release_port').' days')));
+            })
             ->update(['port' => 0]);
     }
 }

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

@@ -20,11 +20,13 @@ class TicketController extends Controller
     {
         $email = $request->input('email');
 
-        $query = Ticket::whereAdminId(Auth::id())->orwhere('admin_id');
+        $query = Ticket::where(function ($query) {
+            $query->whereAdminId(Auth::id())->orwhere('admin_id');
+        });
 
         if (isset($email)) {
-            $query->whereHas('user', static function ($q) use ($email) {
-                $q->where('email', 'like', '%'.$email.'%');
+            $query->whereHas('user', function ($query) use ($email) {
+                $query->where('email', 'like', '%'.$email.'%');
             });
         }
 

+ 3 - 2
app/Models/Node.php

@@ -81,8 +81,9 @@ class Node extends Model
     {
         return User::activeUser()
             ->where('level', '>=', $this->attributes['level'])
-            ->whereNull('user_group_id')
-            ->orwhereIn('user_group_id', $this->userGroups->pluck('id')->toArray())
+            ->where(function ($query) {
+                $query->whereIn('user_group_id', $this->userGroups->pluck('id'))->orWhereNull('user_group_id');
+            })
             ->get();
     }
 

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

@@ -9,6 +9,7 @@ return [
             'disable'   => 'The account activation subsystem has been disabled, you can login directly!',
             'throttle'  => 'Anti-bots Shield Active! Please do not send multiple activate from at short amount of times! If you have any questions, please contact :email',
         ],
+        'sent'      => 'Activation link has been sent to your email, please check the mailbox (the email may be in the Trash)',
         'promotion' => ['0' => 'Account has not been activated,Please', '1' => 'before login!'],
     ],
     'aup'             => 'Acceptable Use Policy',

+ 1 - 0
resources/lang/zh-CN/auth.php

@@ -9,6 +9,7 @@ return [
             'disable'   => '本站关闭了账号激活子系统,您可以直接去登录!',
             'throttle'  => '您已触发本站激活请求限制机制,请勿频繁操作!如有问题,请联系:email',
         ],
+        'sent'      => '激活链接已发送至您的邮箱,请稍作等待或查看垃圾箱',
         'promotion' => ['0' => '账号尚未激活,请点击', '1' => '启动激活程序!'],
     ],
     'aup'             => '可接受使用条款',

+ 3 - 3
resources/views/admin/node/auth.blade.php

@@ -34,9 +34,9 @@
                         <tr>
                             <td> {{$auth->node_id}} </td>
                             <td> {{$auth->node->type_label}} </td>
-                            <td> {{Str::limit($auth->node->name, 20) ?? '【节点已删除】'}} </td>
-                            <td> {{$auth->node->server ?? '【节点已删除】'}} </td>
-                            <td> {{$auth->node->ip ?? '【节点已删除】'}} </td>
+                            <td> {{Str::limit($auth->node->name, 20) ?? ''}} </td>
+                            <td> {{$auth->node->server ?? ''}} </td>
+                            <td> {{$auth->node->ip ?? ''}} </td>
                             <td><span class="badge badge-lg badge-info"> {{$auth->key}} </span></td>
                             <td><span class="badge badge-lg badge-info"> {{$auth->secret}} </span></td>
                             <td>