diff --git a/app/api/controller/shop/IndexController.php b/app/api/controller/shop/IndexController.php index 9785c36..fb50fb3 100644 --- a/app/api/controller/shop/IndexController.php +++ b/app/api/controller/shop/IndexController.php @@ -45,6 +45,17 @@ class IndexController extends BaseApiController{ $shop_user_id= $this->get_x_token(); $post['shop_user_id']=$shop_user_id; $find=Db::name('user_auth_shop')->where('shop_uid',$post['shop_user_id'])->find(); + $city = Db::name('geo_city')->field('province_code,city_code')->where('city_name', 'like', '%' . $post['city_name'] . '%')->find(); + if(empty($city)){ + $post['province_id'] = ''; + $post['city_id'] = ''; + $post['area_id'] = ''; + }else{ + $post['province_id'] = $city['province_code']; + $post['city_id'] = $city['city_code']; + $area = Db::name('geo_area')->field('area_code')->where('city_code', $city['city_code'])->where('area_name', 'like', '%' . $post['area_name'] . '%')->find(); + $post['area_id'] = !empty($area) ? $area['area_code'] : ''; + } if($post['is_merchant_type']==1){ if($find){ $res=MerchantLogic::edit($post);