From 4aa75aaf3b73dfbc9be85a1b9529b403cf0342ae Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 31 Oct 2023 11:02:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/community/CommunityRepository.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/common/repositories/community/CommunityRepository.php b/app/common/repositories/community/CommunityRepository.php index 5a2f662b..0aa6277e 100644 --- a/app/common/repositories/community/CommunityRepository.php +++ b/app/common/repositories/community/CommunityRepository.php @@ -31,6 +31,7 @@ use crmeb\services\QrcodeService; use FormBuilder\Factory\Elm; use think\exception\ValidateException; use think\facade\Db; +use think\facade\Log; use think\facade\Route; class CommunityRepository extends BaseRepository @@ -699,7 +700,7 @@ class CommunityRepository extends BaseRepository if ($value) { $attrValue = ProductAttrValue::where('unique', $value['product_attr_unique'])->find(); if($attrValue){ - if($attrValue['mer_id']){ + if($attrValue['mer_id']<=0){ throw new ValidateException('商户id不能为0'); } $insert[] = [ @@ -755,7 +756,7 @@ class CommunityRepository extends BaseRepository $cartRepo = app()->make(StoreCartRepository::class); $cartIds = []; foreach ($community['resale'] as $item) { - if($item['mer_id']){ + if($item['mer_id']<=0){ throw new ValidateException('商户id不能为0'); } $data = [ @@ -778,7 +779,8 @@ class CommunityRepository extends BaseRepository return $cartIds; } catch (\Exception $exception) { StoreCart::rollback(); - throw new ValidateException('下单出错'); + Log::error('加入购物车出错' . $exception->getMessage().'line'.$exception->getLine()); + throw new ValidateException( $exception->getMessage()); } } @@ -807,7 +809,7 @@ class CommunityRepository extends BaseRepository $cartRepo = app()->make(StoreCartRepository::class); $cartIds = []; foreach ($community['entrust'] as $item) { - if($item['mer_id']){ + if($item['mer_id']<=0){ throw new ValidateException('商户id不能为0'); } $data = [ @@ -830,6 +832,7 @@ class CommunityRepository extends BaseRepository return $cartIds; } catch (\Exception $exception) { StoreCart::rollback(); + Log::error('加入购物车出错' . $exception->getMessage().'line'.$exception->getLine()); throw new ValidateException('下单出错'); } }