From c256c8e8e7ed9b4fde2011791f09d9004056a0cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=94=E5=A7=AC=E6=A1=91?= Date: Wed, 27 Jan 2021 00:52:11 -0500 Subject: [PATCH] =?UTF-8?q?Fix=20#137=20orwhere=E4=BD=BF=E7=94=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=80=A0=E6=88=90=E7=9A=84=E8=AF=AF=E5=88=A4=20&=20?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/AutoJob.php | 5 +++-- app/Http/Controllers/Admin/TicketController.php | 8 +++++--- app/Models/Node.php | 5 +++-- resources/lang/en/auth.php | 1 + resources/lang/zh-CN/auth.php | 1 + resources/views/admin/node/auth.blade.php | 6 +++--- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/Console/Commands/AutoJob.php b/app/Console/Commands/AutoJob.php index 0cdb5cb0..e9b2b563 100644 --- a/app/Console/Commands/AutoJob.php +++ b/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]); } } diff --git a/app/Http/Controllers/Admin/TicketController.php b/app/Http/Controllers/Admin/TicketController.php index 77f3a17b..57da1e7a 100644 --- a/app/Http/Controllers/Admin/TicketController.php +++ b/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.'%'); }); } diff --git a/app/Models/Node.php b/app/Models/Node.php index a523a359..6f8a455e 100644 --- a/app/Models/Node.php +++ b/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(); } diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 1cd3690d..118399d2 100644 --- a/resources/lang/en/auth.php +++ b/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', diff --git a/resources/lang/zh-CN/auth.php b/resources/lang/zh-CN/auth.php index 6650413f..5432e515 100644 --- a/resources/lang/zh-CN/auth.php +++ b/resources/lang/zh-CN/auth.php @@ -9,6 +9,7 @@ return [ 'disable' => '本站关闭了账号激活子系统,您可以直接去登录!', 'throttle' => '您已触发本站激活请求限制机制,请勿频繁操作!如有问题,请联系:email', ], + 'sent' => '激活链接已发送至您的邮箱,请稍作等待或查看垃圾箱', 'promotion' => ['0' => '账号尚未激活,请点击', '1' => '启动激活程序!'], ], 'aup' => '可接受使用条款', diff --git a/resources/views/admin/node/auth.blade.php b/resources/views/admin/node/auth.blade.php index 3d17fba8..3848beb6 100644 --- a/resources/views/admin/node/auth.blade.php +++ b/resources/views/admin/node/auth.blade.php @@ -34,9 +34,9 @@ {{$auth->node_id}} {{$auth->node->type_label}} - {{Str::limit($auth->node->name, 20) ?? '【节点已删除】'}} - {{$auth->node->server ?? '【节点已删除】'}} - {{$auth->node->ip ?? '【节点已删除】'}} + {{Str::limit($auth->node->name, 20) ?? ''}} + {{$auth->node->server ?? ''}} + {{$auth->node->ip ?? ''}} {{$auth->key}} {{$auth->secret}}