jsonSuccess($trees); } /** * @api {POST} /api/seller/area/province 地区-省 * @apiVersion 0.1.0 * @apiGroup 店主 * * @apiSuccessExample {json} 返回结果 * { * "code":200, * "message":"", * "data":[ * { * "id":1, * "name":"北京", * "parent_id":"0", * "type":"province" * }, * ] * } */ public function province(Request $request) { $province = ProvinceCityArea::where('parent_id', 0)->get(); return $this->jsonSuccess($province); } /** * @api {POST} /api/seller/area/city 地区-市 * @apiVersion 0.1.0 * @apiGroup 店主 * * @apiParam {String} parent_id 省级id * * @apiSuccessExample {json} 返回结果 * { * "code":200, * "message":"", * "data":[ * { * "id":1, * "name":"北京", * "parent_id":"0", * "type":"province" * }, * ] * } */ public function city(Request $request) { $parentId = $request->input('parent_id'); $province = ProvinceCityArea::where('parent_id', $parentId)->where('type', 'city')->get(); return $this->jsonSuccess($province); } /** * @api {POST} /api/seller/area/area 地区-县/区 * @apiVersion 0.1.0 * @apiGroup 店主 * * @apiParam {String} parent_id 市级id * * @apiSuccessExample {json} 返回结果 * { * "code":200, * "message":"", * "data":[ * { * "id":1, * "name":"北京", * "parent_id":"0", * "type":"province" * }, * ] * } */ public function area(Request $request) { $parentId = $request->input('parent_id'); $province = ProvinceCityArea::where('parent_id', $parentId)->where('type', 'area')->get(); return $this->jsonSuccess($province); } }