select('id', 'name', 'address', 'latitude', 'longitude')->where(['id' => $hospital])->first(); $canshu = []; $canshu[]=$sex; $sql = ''; if (isset($combo_price)) { $price_list = [ "1" => [0, 299], "2" => [300, 999], "3" => [1000, 1499], "4" => [1500, 2999], "5" => [3000, 999999], ]; $sql = " and (a.price>=? and a.price<=?) "; $canshu[] = $price_list[$combo_price][0]; $canshu[] = $price_list[$combo_price][1]; } if (isset($combo_type)) { $sql = $sql . " and a.type_id=? "; $canshu[] = $combo_type; } if (isset($combo_crowd)) { $sql = $sql . " and a.crowd_id=? "; $canshu[] = $combo_crowd; } if (isset($combo_sort)) { if ($combo_sort == 1) { $sql = $sql . " "; } if ($combo_sort == 2) { $sql = $sql . " "; } if ($combo_sort == 3) { $sql = $sql . " order by a.price"; } if ($combo_sort == 4) { $sql = $sql . " order by a.price desc"; } } $combos = DB::select("select * from combos as a LEFT JOIN ( select combo_id as c_id,count(*) as count from orders where status in(2,4) group by combo_id ) as b on a.combo_id=b.c_id where a.status=1 and a.sex=?" . $sql, $canshu); foreach ($combos as $key => $combo) { $combo->count=$combo->count?$combo->count:0; $tags = json_decode($combo->tags, true); $combo->tags2 = json_decode($combo->tags2, true); foreach ($tags as $k => $tag) { $tags[$k] = ['text' => $tag, 'text_color' => '#47ABD8', 'color' => '#EBF5FC' ]; } $combo->tag = $tags; $combo->tag[] = [ 'text' => $combo->item_count . '个项目', 'text_color' => '#34C292', 'color' => '#E9F8F3', ]; } $hospital_info = $hospital; return \Yz::Return(true, '获取成功', [ 'list' => $combos, 'hospital' => $hospital_info ]); } }