From 87e94df5f7cfaae3f11341318fd9f82bd285b21b Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Thu, 28 Sep 2023 09:43:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E6=88=B7=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/system/merchant/MerchantRepository.php | 6 +++--- app/controller/admin/system/merchant/Merchant.php | 2 +- app/validate/admin/MerchantValidate.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/common/repositories/system/merchant/MerchantRepository.php b/app/common/repositories/system/merchant/MerchantRepository.php index 16d32f24..e38ee0a0 100644 --- a/app/common/repositories/system/merchant/MerchantRepository.php +++ b/app/common/repositories/system/merchant/MerchantRepository.php @@ -256,8 +256,8 @@ class MerchantRepository extends BaseRepository $merchantCategoryRepository = app()->make(MerchantCategoryRepository::class); $adminRepository = app()->make(MerchantAdminRepository::class); - if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id'])) - throw new ValidateException('商户分类不存在'); + // if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id'])) + // throw new ValidateException('商户分类不存在'); if ($adminRepository->fieldExists('account', $data['mer_account'])) throw new ValidateException('账号已存在'); @@ -267,7 +267,7 @@ class MerchantRepository extends BaseRepository $margin = app()->make(MerchantTypeRepository::class)->get($data['type_id']); $data['is_margin'] = $margin['is_margin'] ?? -1; $data['margin'] = $margin['margin'] ?? 0; - + return Db::transaction(function () use ($data, $make) { $account = $data['mer_account']; $password = $data['mer_password']; diff --git a/app/controller/admin/system/merchant/Merchant.php b/app/controller/admin/system/merchant/Merchant.php index f37929f7..b5313a6a 100644 --- a/app/controller/admin/system/merchant/Merchant.php +++ b/app/controller/admin/system/merchant/Merchant.php @@ -148,7 +148,7 @@ class Merchant extends BaseController return app('json')->fail('请输入正确的手机号'); // if (!$data['category_id'] || !$merchantCategoryRepository->exists($data['category_id'])) // return app('json')->fail('商户分类不存在'); - + $newUid = Db::name('User')->where('account', $data['mer_phone'])->value('uid', -1); $merId = Db::name('Merchant')->where('uid', $newUid)->value('mer_id', 0); if ($newUid != -1 && $id != $merId) { diff --git a/app/validate/admin/MerchantValidate.php b/app/validate/admin/MerchantValidate.php index 20496c4f..3bc6da5c 100644 --- a/app/validate/admin/MerchantValidate.php +++ b/app/validate/admin/MerchantValidate.php @@ -33,7 +33,7 @@ class MerchantValidate extends Validate * @var array */ protected $rule = [ - 'category_id|商户分类' => '', + // 'category_id|商户分类' => '', 'type_id|店铺类型' => 'integer', 'mer_name|商户名称' => 'require|max:32', 'mer_account|商户账号' => 'require|alphaNum|min:4|max:16',