红包 抢完销毁

This commit is contained in:
2025-10-16 10:16:20 +08:00
parent beb87cf3fd
commit 774107e28f
2 changed files with 14 additions and 0 deletions

View File

@@ -111,6 +111,18 @@ class RedpacketService
$amount = floatval($result[1]);
$isFinished = $result[2] == 1; // Lua脚本返回是否抢完
//给前端推送销毁这个红包
// redis 记录该红包是否已经推送过了 只推送一次
$redisKey = "redpacket:{$redpacketId}:is_finished";
if (!$redis->get($redisKey)) {
$redis->set($redisKey, 1);
$text = [
'redpacket_id' => $redpacketId,
'text' => '抢完了,请销毁该红包'
];
model('api/Chat')->sendMsg(1061,$redpacket['room_id'],$text);
}
// Lua脚本执行成功记录到数据库
Db::startTrans();