From d7c48a5ae05d37402c696bc944dcbd43ed8b4f9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Sat, 11 Oct 2025 18:09:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=BA=A2=E5=8C=85=20=E6=8E=A8?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/Chat.php | 2 ++ application/common/model/Redpacket.php | 10 +++++++++- application/common/service/RedpacketService.php | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/application/api/model/Chat.php b/application/api/model/Chat.php index 6830fab..7ee1a97 100644 --- a/application/api/model/Chat.php +++ b/application/api/model/Chat.php @@ -119,6 +119,8 @@ class Chat extends Model //清空个人魅力 // ClearUserCharm = 1059, + //发红包 + // RedPacket = 1060, diff --git a/application/common/model/Redpacket.php b/application/common/model/Redpacket.php index 219d281..32e4543 100644 --- a/application/common/model/Redpacket.php +++ b/application/common/model/Redpacket.php @@ -117,8 +117,16 @@ class Redpacket extends Model // 设置过期时间 $redis->expireAt($redisKey, $endTime + 3600); // 结束后保留1小时 - Db::commit(); + + //给前端推送信息 + $data['nickname'] = Db::name('user')->where('id', $data['user_id'])->value('nickname'); + $text = [ + 'redpacketInfo' => $data, + 'text' => '' + ]; + model('api/Chat')->sendMsg(1060,$data['room_id'],$text); + return ['code' => 1, 'msg' => '发红包成功', 'data' => $redpacketId]; } catch (\Exception $e) { diff --git a/application/common/service/RedpacketService.php b/application/common/service/RedpacketService.php index 14b8de5..69e95ca 100644 --- a/application/common/service/RedpacketService.php +++ b/application/common/service/RedpacketService.php @@ -232,7 +232,8 @@ class RedpacketService 'left_amount' => $redpacket['left_amount'], 'left_count' => $redpacket['left_count'], 'coin_type' => $redpacket['coin_type'], - 'status' => $redpacket['status'] + 'status' => $redpacket['status'], + 'nickname' => Db::name('user')->where('id', $redpacket['user_id'])->value('nickname') ], 'my_record' => $myRecord ? [ 'amount' => $myRecord['amount'],