pluck('province'); $data = array(); foreach ($provinces as $province) { $data[$province] = CityModel::where("province", $province)->pluck('city'); } $message->setResponse($data); } /** * 城市搜索 * @param SearchMessage $message */ public function search(SearchMessage $message) { $keyword = $message->getKeyword(); $citys = CityModel::where("city", "like", "%{$keyword}%")->get(); $message->setResponse($citys); } }