From bb1dd9b207d4d9401743c4fc5a0fb87841c18e69 Mon Sep 17 00:00:00 2001 From: tlerbao Date: Sat, 18 Jul 2020 17:12:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=97=A5=E5=BF=97=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=95=B0=E6=8D=AE=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/controller/LoginLog.php | 3 ++- catch/system/model/LoginLog.php | 23 ++++++++++++++------ catch/system/model/search/LoginLogSearch.php | 21 ++++++++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 catch/system/model/search/LoginLogSearch.php diff --git a/catch/system/controller/LoginLog.php b/catch/system/controller/LoginLog.php index 5b45351..5377313 100644 --- a/catch/system/controller/LoginLog.php +++ b/catch/system/controller/LoginLog.php @@ -1,4 +1,5 @@ paginate()); + return CatchResponse::paginate($log->getList()); } /** diff --git a/catch/system/model/LoginLog.php b/catch/system/model/LoginLog.php index 13ebf37..34829c9 100644 --- a/catch/system/model/LoginLog.php +++ b/catch/system/model/LoginLog.php @@ -1,21 +1,30 @@ catchSearch() + ->order('id', 'desc') + ->paginate(); + } +} diff --git a/catch/system/model/search/LoginLogSearch.php b/catch/system/model/search/LoginLogSearch.php new file mode 100644 index 0000000..de32308 --- /dev/null +++ b/catch/system/model/search/LoginLogSearch.php @@ -0,0 +1,21 @@ +whereLike('login_name', $value); + } + + public function searchLoginIpAttr($query, $value, $data) + { + return $query->whereLike('login_ip', $value); + } + + public function searchLoginAtAttr($query, $value, $data) + { + return $query->whereTime('login_at', 'between', $value); + } +}