Merge pull request #8 from tlerbao/master
登录日志新增数据搜索功能,修改路由Path单词用反了的问题
This commit is contained in:
commit
db18e71906
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace catchAdmin\system\controller;
|
namespace catchAdmin\system\controller;
|
||||||
|
|
||||||
use catcher\base\CatchController;
|
use catcher\base\CatchController;
|
||||||
@ -17,7 +18,7 @@ class LoginLog extends CatchController
|
|||||||
*/
|
*/
|
||||||
public function list(Log $log)
|
public function list(Log $log)
|
||||||
{
|
{
|
||||||
return CatchResponse::paginate($log->paginate());
|
return CatchResponse::paginate($log->getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace catchAdmin\system\model;
|
namespace catchAdmin\system\model;
|
||||||
|
|
||||||
use catcher\traits\db\BaseOptionsTrait;
|
use catcher\traits\db\BaseOptionsTrait;
|
||||||
|
use catchAdmin\system\model\search\LoginLogSearch;
|
||||||
|
|
||||||
class LoginLog extends \think\Model
|
class LoginLog extends \think\Model
|
||||||
{
|
{
|
||||||
use BaseOptionsTrait;
|
use BaseOptionsTrait, LoginLogSearch;
|
||||||
|
|
||||||
protected $name = 'login_log';
|
protected $name = 'login_log';
|
||||||
|
|
||||||
protected $field = [
|
protected $field = [
|
||||||
'id', //
|
'id', //
|
||||||
'login_name', // 用户名
|
'login_name', // 用户名
|
||||||
'login_ip', // 登录地点ip
|
'login_ip', // 登录地点ip
|
||||||
'browser', // 浏览器
|
'browser', // 浏览器
|
||||||
'os', // 操作系统
|
'os', // 操作系统
|
||||||
'login_at', // 登录时间
|
'login_at', // 登录时间
|
||||||
'status', // 1 成功 2 失败
|
'status', // 1 成功 2 失败
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function getList()
|
||||||
|
{
|
||||||
|
return $this->catchSearch()
|
||||||
|
->order('id', 'desc')
|
||||||
|
->paginate();
|
||||||
|
}
|
||||||
}
|
}
|
21
catch/system/model/search/LoginLogSearch.php
Normal file
21
catch/system/model/search/LoginLogSearch.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace catchAdmin\system\model\search;
|
||||||
|
|
||||||
|
trait LoginLogSearch
|
||||||
|
{
|
||||||
|
public function searchLoginNameAttr($query, $value, $data)
|
||||||
|
{
|
||||||
|
return $query->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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user