refactor(admin): 优化 ChangeLog 列表的搜索条件
- 将 'url' 字段的搜索条件从 '=' 改为 '%like%',提高搜索灵活性 - 优化 'mark' 字段的搜索条件,使用 '%like%' 提升搜索体验
This commit is contained in:
parent
03cc208b1d
commit
7379406cb9
@ -1,66 +1,67 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\admin\lists;
|
namespace app\admin\lists;
|
||||||
|
|
||||||
|
|
||||||
use app\admin\lists\BaseAdminDataLists;
|
use app\admin\lists\BaseAdminDataLists;
|
||||||
use app\common\model\ChangeLog;
|
use app\common\model\ChangeLog;
|
||||||
use app\common\lists\ListsSearchInterface;
|
use app\common\lists\ListsSearchInterface;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ChangeLog列表
|
* ChangeLog列表
|
||||||
* Class ChangeLogLists
|
* Class ChangeLogLists
|
||||||
* @package app\admin\lists
|
* @package app\admin\lists
|
||||||
*/
|
*/
|
||||||
class ChangeLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
class ChangeLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 设置搜索条件
|
* @notes 设置搜索条件
|
||||||
* @return \string[][]
|
* @return \string[][]
|
||||||
* @author admin
|
* @author admin
|
||||||
* @date 2025/01/06 10:03
|
* @date 2025/01/06 10:03
|
||||||
*/
|
*/
|
||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['model', 'link_id', 'nums', 'pm', 'url'],
|
'=' => ['model', 'link_id', 'nums', 'pm'],
|
||||||
'%like%' => ['mark'],
|
'%like%' => ['mark','url'],
|
||||||
];
|
|
||||||
}
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取列表
|
/**
|
||||||
* @return array
|
* @notes 获取列表
|
||||||
* @throws \think\db\exception\DataNotFoundException
|
* @return array
|
||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\DbException
|
||||||
* @author admin
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
* @date 2025/01/06 10:03
|
* @author admin
|
||||||
*/
|
* @date 2025/01/06 10:03
|
||||||
public function lists(): array
|
*/
|
||||||
{
|
public function lists(): array
|
||||||
return ChangeLog::where($this->searchWhere)
|
{
|
||||||
->field(['id', 'model', 'link_id', 'nums', 'pm', 'url', 'mark'])
|
return ChangeLog::where($this->searchWhere)
|
||||||
->limit($this->limitOffset, $this->limitLength)
|
->field(['id', 'model', 'link_id', 'nums', 'pm', 'url', 'mark'])
|
||||||
->order(['id' => 'desc'])
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->select()
|
->order(['id' => 'desc'])
|
||||||
->toArray();
|
->select()
|
||||||
}
|
->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @notes 获取数量
|
/**
|
||||||
* @return int
|
* @notes 获取数量
|
||||||
* @author admin
|
* @return int
|
||||||
* @date 2025/01/06 10:03
|
* @author admin
|
||||||
*/
|
* @date 2025/01/06 10:03
|
||||||
public function count(): int
|
*/
|
||||||
{
|
public function count(): int
|
||||||
return ChangeLog::where($this->searchWhere)->count();
|
{
|
||||||
}
|
return ChangeLog::where($this->searchWhere)->count();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user