From 2c5d80dc456bfed77e2dac1834512fe65b3628f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 12 Nov 2025 19:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=AD=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/SingerSong.php | 14 +++++++ application/api/model/SingerSong.php | 47 +++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/application/api/controller/SingerSong.php b/application/api/controller/SingerSong.php index 97dbbd1..1cfe006 100644 --- a/application/api/controller/SingerSong.php +++ b/application/api/controller/SingerSong.php @@ -114,4 +114,18 @@ class SingerSong extends BaseCom return V($reslut['code'], $reslut['msg'], $reslut['data']); } + + //点歌列表 + public function singerSongList() + { + $room_id = input('room_id', 0); + if (!$room_id) { + return V(0, '请选择房间'); + } + $type = input('type', 1);//1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表 + $reslut = model('SingerSong')->singerSongList($room_id,$type); + return V($reslut['code'], $reslut['msg'], $reslut['data']); + } + + } \ No newline at end of file diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index a75bee5..53be3be 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -167,4 +167,51 @@ class SingerSong extends Model return ['code' => 0, 'msg' => $res['msg']]; } } + + + /* + * 点歌列表 + * @param room_id 房间id + * @param type 类型 1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表 + */ + public function singerSongList($room_id,$type) + { + $where = [ + 'room_id' => $room_id + ]; + switch ($type) { + case 2: + $where['createtime'] = ['between time',[strtotime(date('Y-m-d')),time()]]; + break; + case 3: + $where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 day"))),strtotime(date('Y-m-d'))]]; + $where['status'] = 2; + break; + case 4: + $where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 week"))),time()]]; + $where['status'] = 2; + break; + case 5: + $where['createtime'] = ['between time',[strtotime(date('Y-m-d',strtotime("-1 month"))),time()]]; + $where['status'] = 2; + break; + case 1: + default: + $where['status'] = ['in','1,0']; + break; + } + $res = db::name('vs_song_log')->where($where)->order('sort desc')->select(); + if ($res) { + foreach ($res as $k => $v) { + $res[$k]['boss_nickname'] = db::name('user')->where(['id' => $v['user_id']])->value('nickname'); + $res[$k]['song_name'] = db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('song_name'); + $res[$k]['gift_name'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('gift_name'); + $res[$k]['gift_price'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('gift_price'); + $res[$k]['base_image'] = db::name('vs_gift')->where(['gid' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_id')])->value('base_image'); + $res[$k]['gift_num'] = db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('gift_num'); + $res[$k]['nickname'] = db::name('user')->where(['id' => db::name('vs_singer_song')->where(['id' => $v['singer_song_id']])->value('user_id')])->value('nickname'); + } + } + return ['code' => 1, 'msg' => '获取成功', 'data' => $res]; + } } \ No newline at end of file