更新接口
This commit is contained in:
parent
0deecd4a21
commit
8520003374
@ -74,7 +74,7 @@ class ProductRepository extends BaseRepository
|
|||||||
['params',[]],
|
['params',[]],
|
||||||
];
|
];
|
||||||
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
protected $admin_filed = 'Product.product_id,Product.mer_id,brand_id,spec_type,unit_name,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,U.rank,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,star,ficti,integral_total,integral_price_total,sys_labels,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
||||||
protected $filed = 'Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
protected $filed = 'Product.bar_code,Product.product_id,Product.mer_id,brand_id,unit_name,spec_type,mer_status,rate,reply_count,store_info,cate_id,Product.image,slider_image,Product.store_name,Product.keyword,Product.sort,Product.is_show,Product.sales,Product.price,extension_type,refusal,cost,ot_price,stock,is_gift_bag,Product.care_count,Product.status,is_used,Product.create_time,Product.product_type,old_product_id,integral_total,integral_price_total,mer_labels,Product.is_good,Product.is_del,type,param_temp_id,mer_svip_status,svip_price,svip_price_type';
|
||||||
|
|
||||||
const NOTIC_MSG = [
|
const NOTIC_MSG = [
|
||||||
1 => [
|
1 => [
|
||||||
|
@ -215,9 +215,10 @@ class MerchantRepository extends BaseRepository
|
|||||||
if($data['type_id'] == 0){
|
if($data['type_id'] == 0){
|
||||||
$data['type_id'] = '';
|
$data['type_id'] = '';
|
||||||
}
|
}
|
||||||
$find=Db::name('merchant_address')->where('mer_id')->value('street_id');
|
$find=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||||
$data['geo_street']=$find;
|
$data['geo_address']=$find;
|
||||||
return $this->form($id, $data);
|
return $data;
|
||||||
|
// return $this->form($id, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,8 +118,8 @@ class Merchant extends BaseController
|
|||||||
{
|
{
|
||||||
if (!$this->repository->exists($id))
|
if (!$this->repository->exists($id))
|
||||||
return app('json')->fail('数据不存在');
|
return app('json')->fail('数据不存在');
|
||||||
|
return app('json')->success($this->repository->updateForm($id));
|
||||||
return app('json')->success(formToData($this->repository->updateForm($id)));
|
// return app('json')->success(formToData($this->repository->updateForm($id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,19 +147,17 @@ class Merchant extends BaseController
|
|||||||
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
$margin = $this->repository->checkMargin($id, $data['type_id']);
|
||||||
$data['margin'] = $margin['margin'];
|
$data['margin'] = $margin['margin'];
|
||||||
$data['is_margin'] = $margin['is_margin'];
|
$data['is_margin'] = $margin['is_margin'];
|
||||||
$geo_street=$data['geo_street'];//添加商圈
|
$datas=$data;
|
||||||
unset($data['geo_street']);
|
unset($datas['area_id'],$datas['street_id'],$datas['village_id']);
|
||||||
$this->repository->update($id, $data);
|
$this->repository->update($id, $datas);
|
||||||
if ($geo_street){
|
$adds=Db::name('merchant_address')->where('mer_id',$id)->find();
|
||||||
$adds=Db::name('merchant_address')->where('mer_id',$id)->find();
|
|
||||||
if($adds){
|
if($adds){
|
||||||
$adds1=['area_id'=>$geo_street[0],'street_id'=>$geo_street[1],'village_id'=>$geo_street[2]];
|
$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);
|
Db::name('merchant_address')->where('mer_id',$id)->update($adds1);
|
||||||
}else{
|
}else{
|
||||||
$adds1=['mer_id'=>$id,'area_id'=>$geo_street[0],'street_id'=>$geo_street[1],'village_id'=>$geo_street[2]];
|
$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);
|
Db::name('merchant_address')->insert($adds1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return app('json')->success('编辑成功');
|
return app('json')->success('编辑成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +187,7 @@ class Merchant extends BaseController
|
|||||||
*/
|
*/
|
||||||
public function checkParam(MerchantValidate $validate, $isUpdate = false)
|
public function checkParam(MerchantValidate $validate, $isUpdate = false)
|
||||||
{
|
{
|
||||||
$data = $this->request->params([['area_id',0],['street_id',0],['village_id',0],['geo_street',0],['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid']);
|
$data = $this->request->params([['area_id',0],['street_id',0],['village_id',0],['category_id', 0], ['type_id', 0], 'mer_name', 'commission_rate', 'real_name', 'mer_phone', 'mer_keyword', 'mer_address', 'mark', ['sort', 0], ['status', 0], ['is_audit', 0], ['is_best', 0], ['is_bro_goods', 0], ['is_bro_room', 0], ['is_trader', 0],'sub_mchid']);
|
||||||
if (!$isUpdate) {
|
if (!$isUpdate) {
|
||||||
$data += $this->request->params(['mer_account', 'mer_password']);
|
$data += $this->request->params(['mer_account', 'mer_password']);
|
||||||
}else {
|
}else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user