|
@@ -209,28 +209,27 @@ class SurveyController extends Controller {
|
|
|
// if(!$result){
|
|
|
// return ['errcode' => CodeEnum::CODE_ERROR, 'errmsg' => '验证码错误'];
|
|
|
// }
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
$list = [];
|
|
|
foreach ($survey as $key=>$value) {
|
|
|
$filter = json_decode($value['filter'],true);
|
|
|
foreach ($filter as $key=>$value1) {
|
|
|
-
|
|
|
if(!empty($value1)){
|
|
|
$str = join('|',(array)$value1);
|
|
|
-
|
|
|
- if(strpos($str,$data[$key]) > -1){
|
|
|
- $list[] = [
|
|
|
- 'id'=>$value['id'],
|
|
|
- 'title'=>$value['title'],
|
|
|
- 'content'=>$value['content']
|
|
|
- ];
|
|
|
- continue;
|
|
|
- }
|
|
|
+ if(array_key_exists($key,$data) && !empty($data[$key])){
|
|
|
+ if(strpos($str,(string)$data[$key]) !== false){
|
|
|
+ $list[] = [
|
|
|
+ 'id'=>$value['id'],
|
|
|
+ 'title'=>$value['title'],
|
|
|
+ 'content'=>$value['content']
|
|
|
+ ];
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//去重复
|
|
|
$cengci = [];
|
|
|
foreach ($list as $value) {
|
|
@@ -241,16 +240,17 @@ class SurveyController extends Controller {
|
|
|
}
|
|
|
}
|
|
|
$cengci = array_values($cengci);
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
$query = Policy::find()->select('id,title,author,content,created_at');
|
|
|
|
|
|
if(!empty($cengci)){
|
|
|
foreach ($cengci as $value) {
|
|
|
$query->orWhere(new \yii\db\Expression('FIND_IN_SET("'.$value['title'].'", cengci)'));
|
|
|
}
|
|
|
+ $list = $query->all();
|
|
|
}
|
|
|
-
|
|
|
- $list = $query->all();
|
|
|
+
|
|
|
|
|
|
return ['data'=>$list,'cengci'=>$cengci];
|
|
|
|