From 9539bc069e24ac1b37b95e18573b50f23d804b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 2 Jan 2026 16:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=81=E7=A4=BC=E5=A4=B1=E8=B4=A5=20?= =?UTF-8?q?=E5=9B=9E=E6=BB=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/GiveGift.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index 19f0f5c4..4c810497 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -90,6 +90,7 @@ class GiveGift extends Model //判断是否有足够的金币 $user_waller = db::name('user_wallet')->where(['user_id'=>$uid])->find(); if ($user_waller['coin'] < $all_gift_price) { + Db::rollback(); return ['code' => 0, 'msg' => '用户金币不足', 'data' => null]; } //扣除用户金币并记录日志 @@ -109,9 +110,11 @@ class GiveGift extends Model //背包礼物是否充足 $user_gift_pack = db::name('vs_user_gift_pack')->where(['user_id'=>$uid,'gid'=>$gid])->find(); if (empty($user_gift_pack)) { + Db::rollback(); return ['code' => 0, 'msg' => '用户背包礼物不足', 'data' => null]; } if ($user_gift_pack['num'] < $num * count($toarray)) { + Db::rollback(); return ['code' => 0, 'msg' => '用户背包礼物不足', 'data' => null]; } //扣除背包礼物并记录日志