商户申请接口、后台修改

This commit is contained in:
彭桃 2023-02-17 13:54:46 +08:00
parent 268613a101
commit d5ccd8a04b
3 changed files with 13 additions and 5 deletions

View File

@ -104,6 +104,7 @@ class MerchantIntentionRepository extends BaseRepository
$create = $data['create_mer'] == 1;
unset($data['create_mer']);
$intention = $this->search(['mer_intention_id' => $id])->find();
if (!$intention)
throw new ValidateException('信息不存在');
if ($intention->status)
@ -129,7 +130,11 @@ class MerchantIntentionRepository extends BaseRepository
'is_bro_goods' => $config['broadcast_goods_type'] == 1 ? 0 : 1,
'mer_password' => $password,
'is_margin' => $margin['is_margin'] ?? -1,
'margin' => $margin['margin'] ?? 0
'margin' => $margin['margin'] ?? 0,
'area_id' => $intention['area_id'] ?? 0,
'geo_street' => $intention['street_id'] ?? 0,
'village_id' => $intention['village_id'] ?? 0,
'is_nmsc' => $intention['is_nmsc'] ?? 0,
];
if ($data['status'] == 1) {
$data['fail_msg'] = '';

View File

@ -120,8 +120,9 @@ class MerchantRepository extends BaseRepository
$merchantTypeRepository = app()->make(MerchantTypeRepository::class);
$options = $merchantTypeRepository->getOptions();
$margin = $merchantTypeRepository->getMargin();
$formData['geo_street']=Db::name('merchant_address')->where('mer_id',$id)->find();
$config = systemConfig(['broadcast_room_type', 'broadcast_goods_type']);
$rule = [
Elm::input('mer_name', '商户名称')->required(),
Elm::select('category_id', '商户分类')->options(function () use ($make) {
@ -252,8 +253,10 @@ class MerchantRepository extends BaseRepository
$merchant = $this->dao->create($data);
$make->createMerchantAccount($merchant, $account, $password);
$adds=['mer_id'=>$merchant->mer_id,'area_id'=>$data['geo_street'][0],'street_id'=>$data['geo_street'][1],'village_id'=>$data['geo_street'][2]];
Db::name('merchant_address')->insert($adds);
$address_id = Db::name('merchant_address')->insertGetId(['mer_id'=>$merchant->mer_id,'street_id'=>$data['geo_street']]);
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;

View File

@ -106,7 +106,7 @@ class MerchantIntention extends BaseController
protected function checkParams()
{
$data = $this->request->params(['phone', 'mer_name', 'name', 'code', 'images', 'merchant_category_id', 'mer_type_id']);
$data = $this->request->params(['phone', 'mer_name', 'name', 'code', 'images', 'merchant_category_id', 'mer_type_id','area_id','street_id','village_id','is_nmsc']);
app()->make(MerchantIntentionValidate::class)->check($data);
$check = app()->make(SmsService::class)->checkSmsCode($data['phone'], $data['code'], 'intention');
$data['mer_type_id'] = (int)$data['mer_type_id'];