diff --git a/app/common/repositories/system/merchant/MerchantIntentionRepository.php b/app/common/repositories/system/merchant/MerchantIntentionRepository.php index 07aa6898..22beb08d 100644 --- a/app/common/repositories/system/merchant/MerchantIntentionRepository.php +++ b/app/common/repositories/system/merchant/MerchantIntentionRepository.php @@ -101,7 +101,11 @@ class MerchantIntentionRepository extends BaseRepository public function updateStatus($id, $data) { - $create = $data['create_mer'] == 1; + $create = ($data['create_mer'] == 1 || $data['create_mer'] == -1); + $autoCreate = 0; + if ($data['create_mer'] == -1) { + $autoCreate = 1; + } unset($data['create_mer']); $intention = $this->search(['mer_intention_id' => $id])->find(); if (!$intention) @@ -135,7 +139,7 @@ class MerchantIntentionRepository extends BaseRepository 'is_margin' => $margin['is_margin'] ?? -1, 'margin' => $margin['margin'] ?? 0, 'uid' => $intention['uid'], - 'reg_admin_id' => request()->adminId(), + 'reg_admin_id' => $autoCreate ? 0: request()->adminId(), ]; $data['fail_msg'] = ''; $smsData = [ @@ -154,13 +158,13 @@ class MerchantIntentionRepository extends BaseRepository 'site' => systemConfig('site_name'), ]; } - Db::transaction(function () use ($config, $intention, $data, $create,$margin,$merData,$smsData) { + Db::transaction(function () use ($config, $intention, $data, $create,$margin,$merData,$smsData,$autoCreate) { if ($data['status'] == 1) { if ($create) { $merchant = app()->make(MerchantRepository::class)->createMerchant($merData); $data['mer_id'] = $merchant->mer_id; $data['uid'] = $intention['uid']; - $data['reg_admin_id'] = $merchant['merchant_admin']['merchant_admin_id']; + $data['reg_admin_id'] = $autoCreate ? 0: $merchant['merchant_admin']['merchant_admin_id']; // 写入商户客服表 $store_service_data['mer_id'] = $merchant->mer_id; $store_service_data['uid'] = $intention['uid']; diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index 8aa78651..04274a56 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -86,7 +86,7 @@ class MerchantIntention extends BaseController // throw new ValidateException('申请商户入驻任务失败,请联系平台'); // } $cdata['status'] = 1; - $cdata['create_mer'] = 1; + $cdata['create_mer'] = -1; $cdata['fail_msg'] ='自动审核通过'; $this->repository->updateStatus($intention->mer_intention_id, $cdata); return app('json')->success('提交成功');