供应商\经销商重新入驻时地址回显

This commit is contained in:
weiz 2024-05-21 16:46:07 +08:00
parent 69e56e0dbc
commit 3631046506

@ -45,17 +45,24 @@ class IndexController extends BaseApiController{
$shop_user_id= $this->get_x_token(); $shop_user_id= $this->get_x_token();
$post['shop_user_id']=$shop_user_id; $post['shop_user_id']=$shop_user_id;
$find=Db::name('user_auth_shop')->where('shop_uid',$post['shop_user_id'])->find(); $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($post['city_name']) && !empty($post['area_name'])){
if(empty($city)){ $city = Db::name('geo_city')->field('province_code,city_code')->where('city_name', 'like', '%' . $post['city_name'] . '%')->find();
$post['province_id'] = ''; if(empty($city)){
$post['city_id'] = ''; $post['province_id'] = '';
$post['area_id'] = ''; $post['city_id'] = '';
}else{ $post['area_id'] = '';
$post['province_id'] = $city['province_code']; }else{
$post['city_id'] = $city['city_code']; $post['province_id'] = $city['province_code'];
$area = Db::name('geo_area')->field('area_code')->where('city_code', $city['city_code'])->where('area_name', 'like', '%' . $post['area_name'] . '%')->find(); $post['city_id'] = $city['city_code'];
$post['area_id'] = !empty($area) ? $area['area_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'] : '';
}
}else{
$post['province_id'] = '';
$post['city_id'] = '';
$post['area_id'] = '';
}
if($post['is_merchant_type']==1){ if($post['is_merchant_type']==1){
if($find){ if($find){
$res=MerchantLogic::edit($post); $res=MerchantLogic::edit($post);
@ -124,6 +131,10 @@ class IndexController extends BaseApiController{
$res=Merchant::where('mer_id',$id)->find(); $res=Merchant::where('mer_id',$id)->find();
if($res){ if($res){
$res['type_name']=DictData::where('type_value','merchat_type')->where('value',$res['type_id'])->value('name'); $res['type_name']=DictData::where('type_value','merchat_type')->where('value',$res['type_id'])->value('name');
$city = Db::name('geo_city')->where('city_code',$res['city_id'])->find();
$area = Db::name('geo_area')->where('area_code',$res['area_id'])->find();
$res['city_name'] = !empty($city) ? $city['city_name'] : '';
$res['area_name'] = !empty($area) ? $area['area_name'] : '';
} }
return $this->success('ok',$res?->toArray()); return $this->success('ok',$res?->toArray());
} }
@ -131,6 +142,10 @@ class IndexController extends BaseApiController{
$res=Supplier::where('id',$id)->find(); $res=Supplier::where('id',$id)->find();
if($res){ if($res){
$res['type_name']=DictData::where('type_value','merchat_type')->where('value',$res['type_id'])->value('name'); $res['type_name']=DictData::where('type_value','merchat_type')->where('value',$res['type_id'])->value('name');
$city = Db::name('geo_city')->where('city_code',$res['city_id'])->find();
$area = Db::name('geo_area')->where('area_code',$res['area_id'])->find();
$res['city_name'] = !empty($city) ? $city['city_name'] : '';
$res['area_name'] = !empty($area) ? $area['area_name'] : '';
} }
return $this->success('ok',$res?->toArray()); return $this->success('ok',$res?->toArray());
} }