refactor: 操作日志分页接口添加操作人筛选条件
This commit is contained in:
@@ -15,14 +15,18 @@ class OperateLog
|
||||
{
|
||||
$param = request()->param([
|
||||
'title',
|
||||
'operator',
|
||||
'created_at',
|
||||
'page/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']);
|
||||
}])
|
||||
})
|
||||
->withSearch(['title', 'created_at'], [
|
||||
'title' => $param['title'] ?? null,
|
||||
'created_at' => $param['created_at'] ?? null
|
||||
|
||||
Reference in New Issue
Block a user