房间内点歌 总数

This commit is contained in:
2025-11-14 17:36:20 +08:00
parent 6db7935df2
commit bd91f7c65c
2 changed files with 33 additions and 0 deletions

View File

@@ -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