From fb5d12d93ce09a7a8e4f0248e81736323469bffc Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Sun, 28 Jan 2024 15:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=94=AF=E4=BB=98=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=B4=BB=E5=8A=A8=E5=95=86=E5=93=81=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/StoreActivityDao.php | 12 +++++++----- .../store/order/StoreOrderRepository.php | 3 +-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/common/dao/store/StoreActivityDao.php b/app/common/dao/store/StoreActivityDao.php index 0c6b973e..3f7615d8 100755 --- a/app/common/dao/store/StoreActivityDao.php +++ b/app/common/dao/store/StoreActivityDao.php @@ -23,6 +23,7 @@ use app\common\repositories\store\product\SpuRepository; use think\db\Query; use think\exception\ValidateException; use think\facade\Db; +use think\facade\Log; /** * @@ -147,18 +148,19 @@ class StoreActivityDao extends BaseDao if (empty($productIds)) { return; } - $find = StoreActivityOrderProduct::where('user_id', $order['uid'])->where('status', 1)->find(); + // $find = StoreActivityOrderProduct::where('user_id', $order['uid'])->where('status', 1)->find(); foreach ($productIds as $productId) { - if (!empty($find['product_id']) && $find['product_id'] == $productId && $activityId == 2) { - throw new ValidateException('活动商品限购1个'); - } + // if (!empty($find['product_id']) && $find['product_id'] == $productId && $activityId == 2) { + // throw new ValidateException('活动商品限购1个'); + // } $model = new StoreActivityOrderProduct(); $model->user_id = $order['uid']; $model->activity_id = $activityId; $model->product_id = $productId; $model->number = 1; if (!$model->save()) { - throw new ValidateException('活动商品数据保存失败'); + Log::error('活动商品数据保存失败productId'.$productId); + // throw new ValidateException('活动商品数据保存失败'); } } } diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index bf82f02d..34bd645e 100755 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -164,8 +164,7 @@ class StoreOrderRepository extends BaseRepository Db::commit(); } catch (Exception $e) { Db::rollback(); - halt($e); - throw new ValidateException('余额支付失败'); + throw new ValidateException('余额支付失败'.$e->getMessage()); } return app('json')->status('success', '余额支付成功', ['order_id' => $groupOrder['group_order_id']]);