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