From 0b224701f43027246e4632a54da0d2d1a4c291a8 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 13 Sep 2023 17:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=87=AA=E5=8A=A8=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/merchant/MerchantIntentionRepository.php | 12 ++++++++---- .../api/store/merchant/MerchantIntention.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) 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('提交成功');