From bd91f7c65c41712146091754d04f4011169a9273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Fri, 14 Nov 2025 17:36:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=82=B9=E6=AD=8C?= =?UTF-8?q?=20=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/SingerSong.php | 12 ++++++++++++ application/api/model/SingerSong.php | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/application/api/controller/SingerSong.php b/application/api/controller/SingerSong.php index 71067bb..58fcf79 100644 --- a/application/api/controller/SingerSong.php +++ b/application/api/controller/SingerSong.php @@ -133,6 +133,18 @@ class SingerSong extends BaseCom } + //点歌各类型各个总数 + public function singerSongCount() + { + $room_id = input('room_id', 0); + if (!$room_id) { + return V(0, '请选择房间'); + } + $reslut = model('SingerSong')->singerSongCount($room_id); + return V($reslut['code'], $reslut['msg'], $reslut['data']); + } + + //歌曲置顶 public function singerSongTop() { diff --git a/application/api/model/SingerSong.php b/application/api/model/SingerSong.php index fdf780d..c84aaba 100644 --- a/application/api/model/SingerSong.php +++ b/application/api/model/SingerSong.php @@ -231,6 +231,27 @@ class SingerSong extends Model } + /* + * 点歌各类型各个总数 + * @param type 类型 1:已点列表,2:今日列表,3:昨日列表,4:本周列表,5:本月列表 + * @param room_id 房间id + */ + public function singerSongCount($room_id) + { + $where = [ + 'room_id' => $room_id + ]; + $res = [ + 'total' => db::name('vs_song_log')->where($where)->count(), + 'today' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d')), time()])->count(), + 'yesterday' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d', strtotime("-1 day"))), strtotime(date('Y-m-d'))])->count(), + 'week' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-d', strtotime("-1 week"))), time()])->count(), + 'month' => db::name('vs_song_log')->where($where)->where('createtime', 'between time', [strtotime(date('Y-m-01')), strtotime(date('Y-m-t'))])->count() + ]; + return $res; + } + + /* * 歌手等级收礼升级 * @param user_id 用户id