From 66aee47ba38128883e6001b75d931a51afba34a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Tue, 9 Sep 2025 16:15:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=81=E7=A4=BC=E5=8A=A0=E9=94=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Room.php | 3 +++ application/api/model/GiveGift.php | 16 +++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/application/api/controller/Room.php b/application/api/controller/Room.php index f5188a8..5c1eba4 100644 --- a/application/api/controller/Room.php +++ b/application/api/controller/Room.php @@ -149,6 +149,8 @@ class Room extends BaseCom //直播间送礼 public function room_give_gift() { + $key_name = "api:room:gift:" . $this->uid; + redis_lock_exit($key_name); $room_id = input('room_id', 0); $gift_id = input('gift_id', 0); $gift_num = input('gift_num', 0); @@ -158,6 +160,7 @@ class Room extends BaseCom $heart_id = input('heart_id', 0); $reslut = model('Room')->room_gift($this->uid, $to_uid, $gift_id, $gift_num, $type, $room_id, $pit_number,$heart_id); + redis_unlock($key_name); return V($reslut['code'], $reslut['msg'], $reslut['data']); } diff --git a/application/api/model/GiveGift.php b/application/api/model/GiveGift.php index fd67c2c..999dbe4 100644 --- a/application/api/model/GiveGift.php +++ b/application/api/model/GiveGift.php @@ -575,13 +575,19 @@ class GiveGift extends Model //增加房间火热值hot_value $gift_totalaa = $gift_total * get_system_config_value('coin_charm_exp'); - Db::name('vs_room') - ->where(['id' => $from_id, 'apply_status' => 2]) - ->inc('hot_value', $gift_totalaa) - ->inc('today_hot_value', $gift_totalaa) - ->update(); +// Db::name('vs_room') +// ->where(['id' => $from_id, 'apply_status' => 2]) +// ->inc('hot_value', $gift_totalaa) +// ->inc('today_hot_value', $gift_totalaa) +// ->update(); // Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->setInc('hot_value',$gift_totalaa); // Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->setInc('today_hot_value',$gift_totalaa); + $hot_value = db::name('vs_room')->where('id', $from_id)->field('id,hot_value,today_hot_value')->find(); + if($hot_value){ + $hhot_value = $hot_value['hot_value'] + $gift_totalaa; + $today_hot_value = $hot_value['today_hot_value'] + $gift_totalaa; + db::name('vs_room')->where('id', $hot_value['id'])->update(['hot_value' =>$hhot_value,'today_hot_value'=>$today_hot_value]); + } $roomtype = Db::name('vs_room')->where(['id' => $from_id])->value('type_id'); if($roomtype == 6){