This commit is contained in:
mkm 2023-11-04 19:39:53 +08:00
parent e34bd3df99
commit 4621219000

View File

@ -336,7 +336,7 @@ class MerchantIntention extends BaseController
'name',
'code',
'images',
'merchant_category_id',
'merchant_category_name',
'mer_type_id',
'social_credit_code',
'area_id',
@ -352,8 +352,17 @@ class MerchantIntention extends BaseController
if (!$check) throw new ValidateException('验证码不正确');
}
if (!app()->make(MerchantCategoryRepository::class)->get($data['merchant_category_id'])) throw new ValidateException('商户分类不存在');
if ($data['mer_type_id'] && !app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id']))
if ($data['mer_type_id'] && !app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id'])) {
throw new ValidateException('店铺类型不存在');
}
if ($data['merchant_category_name'] == '') {
throw new ValidateException('商户分类,不能为空');
}
$merchant_category_id=Db::name('merchant_category')->where('category_name',$data['merchant_category_name'])->value('merchant_category_id');
if(!$merchant_category_id){
throw new ValidateException('没有对应的商户分类,请联系工作人员添加');
}
$data['merchant_category_id']=$merchant_category_id;
unset($data['code']);
return $data;
}
@ -392,4 +401,3 @@ class MerchantIntention extends BaseController
return app('json')->success($lst);
}
}