diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php index bf694c9..5fa7e23 100644 --- a/application/api/controller/Index.php +++ b/application/api/controller/Index.php @@ -8,6 +8,7 @@ use app\api\model\Job; use app\api\model\JobCollect; use app\api\model\JobKeyword; use app\common\model\Inform; +use app\common\model\Label; use app\common\model\User; use fast\Tree; use app\common\controller\Wechat; @@ -187,6 +188,17 @@ class Index extends Api } } $where .= "job_name like '%{$keyword}%'"; + $wherela = "title like '%{$keyword}%'"; + $ids = Label::where($wherela)->field('id')->column('id'); //标签所有id + if(!empty($ids)){ + // 标签搜索 + $label_findinset = []; + foreach ($ids as $label_id){ + $label_findinset[] = "find_in_set({$label_id},label_ids)"; + } + $label_where = implode(' or ',$label_findinset); + $where = "($where or ($label_where))"; + } } $where .= $where ? ' and ' : ''; $where .= "putdata = '0'";