From b564693e57687a0ce7bb1d65cd875af736c9b1ce Mon Sep 17 00:00:00 2001
From: 郭静帆 <gjfan@bronet.cn>
Date: Fri, 28 May 2021 10:09:13 +0800
Subject: [PATCH] 本月额外收入

---
 application/api/controller/Index.php | 12 ++++++++++++
 1 file changed, 12 insertions(+), 0 deletions(-)

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'";
--
libgit2 0.24.0