select(['time_stamp'])->from('base_unique')->where(['type'=>1])->asArray()->one(); $where=['and', ['=','time_stamp',$time_stamp['time_stamp']], ['=','area_id',$params['area_id']], ['>=','run_date',$params['start_date']], ['<','run_date',$params['end_date']], ]; if($params['search_more']!=''){//名称,商圈,品牌 $where[]=[ 'or', ['like','hotel_name',$params['search_more']], ['like','business_area',$params['search_more']], ['like','brand',$params['search_more']], ]; } if($params['hotel_label']!=''){//设施服务 #处理拼接的标签,取出单标签like匹配字段 $labels=explode(',',$params['hotel_label']); $label_where=['and']; foreach($labels as $val){ $tmp_hotel_label=$hotel_select_list[3]['list'][$val]['name']; $label_where[]=['like','hotel_label',$tmp_hotel_label]; } $where[]=$label_where; } if($params['brand']!='0'){//品牌 $brand=explode(',',$params['brand']); $brand_where=['or']; foreach($brand as $val){ $tmp_hotel_brand=$hotel_select_list[2]['list'][$val]['name']; $brand_where[]=['like','brand',$tmp_hotel_brand]; } $where[]=$brand_where; } if($params['star_type']!='0') {#星级及类型 if($params['star_type']=='1' || $params['star_type']=='2') {//星级 if($params['star_type']=='1'){ $where[]=['=','star_level','39']; }else{ $where[]=['=','star_level','38']; } }else{//酒店类型 $where[]=['=','hotel_type',$hotel_select_list['1']['list'][$params['star_type']]['name']]; } } $result=self::find() ->from('hotel') ->where($where) ->asArray() ->all(); return $result; } }