From 4dcccc2896e793175ed777482b0bfb533297ad4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Mon, 13 Oct 2025 15:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A2=E5=8C=85=E6=B7=BB=E5=8A=A0=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=20=E5=92=8C=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/Redpacket.php | 3 ++- application/common/service/RedpacketService.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/application/common/model/Redpacket.php b/application/common/model/Redpacket.php index 0796a9e..0b272bb 100644 --- a/application/common/model/Redpacket.php +++ b/application/common/model/Redpacket.php @@ -97,7 +97,8 @@ class Redpacket extends Model 'status' => $data['countdown'] > 0 ? self::STATUS_PENDING : self::STATUS_ACTIVE, 'start_time' => $startTime, 'end_time' => $endTime, - 'createtime' => time() + 'createtime' => time(), + 'remark' => $data['remark'] ?? '大吉大利,红包拿来啦!' ]; $redpacketId = $this->insertGetId($redpacketData); diff --git a/application/common/service/RedpacketService.php b/application/common/service/RedpacketService.php index 69e95ca..ed7b564 100644 --- a/application/common/service/RedpacketService.php +++ b/application/common/service/RedpacketService.php @@ -450,6 +450,10 @@ class RedpacketService return ['code' => 0, 'msg' => '用户ID不能为空', 'data' => null]; } + if (empty($data['room_id'])) { + return ['code' => 0, 'msg' => '房间ID不能为空', 'data' => null]; + } + if (!in_array($data['type'], [Redpacket::TYPE_NORMAL, Redpacket::TYPE_PASSWORD])) { return ['code' => 0, 'msg' => '红包类型错误', 'data' => null]; }