diff --git a/application/common/controller/Push.php b/application/common/controller/Push.php index 6134743..067a200 100644 --- a/application/common/controller/Push.php +++ b/application/common/controller/Push.php @@ -75,6 +75,8 @@ class Push const PUSH_ROOM_PAN_XLH_PROGRESS = 8000; //小时榜 const PUSH_ROOM_PAN_HOUR_PROGRESS = 8001; + //红包 + const PUSH_ROOM_PAN_RED_PROGRESS = 8002; public $user_id, $room_id, $topic_room, $topic_client; @@ -307,6 +309,12 @@ class Push $this->push(self::PUSH_ROOM_PAN_HOUR_PROGRESS, $topic, $data); } + //红包来了 + public function redpacketArrive($data){ + $topic = 'qx_redpacket_arrive'; + $this->push(self::PUSH_ROOM_PAN_RED_PROGRESS, $topic, $data); + } + // =========================================秘地使用结束===================================================== diff --git a/application/common/model/Redpacket.php b/application/common/model/Redpacket.php index 3d2ea7e..9a11f87 100644 --- a/application/common/model/Redpacket.php +++ b/application/common/model/Redpacket.php @@ -2,6 +2,7 @@ namespace app\common\model; +use app\common\controller\Push; use think\Model; use think\Db; @@ -124,11 +125,14 @@ class Redpacket extends Model $data['nickname'] = Db::name('user')->where('id', $data['user_id'])->value('nickname'); $data['avatar'] = Db::name('user')->where('id', $data['user_id'])->value('avatar'); $data['redpacket_id'] = $redpacketId; + $data['start_time'] = $startTime; $text = [ 'redpacketInfo' => $data, 'text' => '' ]; model('api/Chat')->sendMsg(1060,$data['room_id'],$text); + $push = new Push(UID, $data['room_id']); + $push->redpacketArrive($data); return ['code' => 1, 'msg' => '发红包成功', 'data' => $redpacketId];