红包 抢完销毁
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user