refactor: 操作日志分页接口添加操作人筛选条件
This commit is contained in:
@@ -15,14 +15,18 @@ class OperateLog
|
|||||||
{
|
{
|
||||||
$param = request()->param([
|
$param = request()->param([
|
||||||
'title',
|
'title',
|
||||||
|
'operator',
|
||||||
'created_at',
|
'created_at',
|
||||||
'page/d',
|
'page/d',
|
||||||
'size/d'
|
'size/d'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$logs = SysOperateLog::with(['user' => function($query) {
|
$logs = SysOperateLog::hasWhere('user', function($query) use($param) {
|
||||||
|
if (!empty($param['operator'])) {
|
||||||
|
$query->where('username', 'like', "{$param['operator']}");
|
||||||
|
}
|
||||||
$query->field(['id', 'username']);
|
$query->field(['id', 'username']);
|
||||||
}])
|
})
|
||||||
->withSearch(['title', 'created_at'], [
|
->withSearch(['title', 'created_at'], [
|
||||||
'title' => $param['title'] ?? null,
|
'title' => $param['title'] ?? null,
|
||||||
'created_at' => $param['created_at'] ?? null
|
'created_at' => $param['created_at'] ?? null
|
||||||
|
|||||||
Reference in New Issue
Block a user