更新搜索

This commit is contained in:
yaooo 2023-11-07 14:56:19 +08:00
parent c347014afb
commit 9578e08be3
1 changed files with 9 additions and 3 deletions

View File

@ -45,6 +45,7 @@ class ProjectTask extends Model
function list($param) {
$where = array();
$whereOr = array();
$whereOrKeyword = array();
$map1 = [];
$map2 = [];
$map3 = [];
@ -77,17 +78,22 @@ class ProjectTask extends Model
$where[] = ['title|content', 'like', '%' . $param['keywords'] . '%'];
}
if (!empty($param['keyword'])) {
$where[] = ['title|content', 'like', '%' . $param['keyword'] . '%'];
$project_ids = Db::name('Project')->where('name', 'like', '%' . $param['keyword'] . '%')->column('id');
$map5[] = ['title', 'like', '%' . $param['keyword'] . '%'];
$map6[] = ['project_id', 'in', $project_ids];
$whereOrKeyword =[$map5, $map6];
}
$where[] = ['delete_time', '=', 0];
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$list = Db::name('ProjectTask')
->where(function ($query) use ($whereOr) {
if (!empty($whereOr))
$query->whereOr($whereOr);
})
->where(function ($query) use ($whereOrKeyword) {
if (!empty($whereOrKeyword))
$query->whereOr($whereOrKeyword);
})
->where($where)
->withoutField('content,md_content')
->order('flow_status asc')