修改商品地址存储
This commit is contained in:
parent
461be6d915
commit
3d0804037b
@ -221,8 +221,11 @@ class MerchantRepository extends BaseRepository
|
||||
if($data['type_id'] == 0){
|
||||
$data['type_id'] = '';
|
||||
}
|
||||
$find=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||
$data['geo_address']=$find;
|
||||
$data['geo_address'] = [
|
||||
'area_id' => $data['area_id'],
|
||||
'street_id' => $data['street_id'],
|
||||
'village_id' => $data['village_id'],
|
||||
];
|
||||
return $data;
|
||||
// return $this->form($id, $data);
|
||||
}
|
||||
@ -260,10 +263,6 @@ class MerchantRepository extends BaseRepository
|
||||
|
||||
$merchant = $this->dao->create($data);
|
||||
$merchant['merchant_admin']=$make->createMerchantAccount($merchant, $account, $password);
|
||||
$address_id = Db::name('merchant_address')->insertGetId(['mer_id'=>$merchant->mer_id,'street_id'=>$data['street_id'],'area_id'=>$data['area_id'],'village_id'=>$data['village_id']]);
|
||||
if($data['area_id'] && $data['village_id']){
|
||||
Db::name('merchant_address')->where('id',$address_id)->update(['area_id'=>$data['area_id'],'village_id'=>$data['village_id']]);
|
||||
}
|
||||
app()->make(ShippingTemplateRepository::class)->createDefault($merchant->mer_id);
|
||||
app()->make(ProductCopyRepository::class)->defaulCopyNum($merchant->mer_id);
|
||||
return $merchant;
|
||||
|
@ -148,16 +148,7 @@ class Merchant extends BaseController
|
||||
$data['margin'] = $margin['margin'];
|
||||
$data['is_margin'] = $margin['is_margin'];
|
||||
$datas=$data;
|
||||
unset($datas['area_id'],$datas['street_id'],$datas['village_id']);
|
||||
$this->repository->update($id, $datas);
|
||||
$adds=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||
if($adds){
|
||||
$adds1=['area_id'=>$data['area_id'],'street_id'=>$data['street_id'],'village_id'=>$data['village_id']];
|
||||
Db::name('merchant_address')->where('mer_id',$id)->update($adds1);
|
||||
}else{
|
||||
$adds1=['mer_id'=>$id,'area_id'=>$data['area_id'],'street_id'=>$data['street_id'],'village_id'=>$data['village_id']];
|
||||
Db::name('merchant_address')->insert($adds1);
|
||||
}
|
||||
return app('json')->success('编辑成功');
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user