房间小时榜

This commit is contained in:
2025-09-29 16:27:36 +08:00
parent a19338ab17
commit ba9e883e0c
4 changed files with 131 additions and 33 deletions

View File

@@ -26,39 +26,9 @@ class RoomHourRanking extends BaseCom
{
$page = input('page', 1);
$page_limit = input('page_limit', 20);
//判断是否开启
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
if ($open_time = 0) {
return V(0, '排行榜暂未开启');
}
//当前小时开始时间
$start_time = strtotime(date('Y-m-d H:00:00'));
$profit = db::name('vs_room')->alias('a')
->join('vs_give_gift b', 'a.id = b.from_id','left')
->join('vs_room_label c', 'a.label_id = c.id','left')
->field('a.id as room_id,a.room_name,a.label_id,a.room_cover,IFNULL(sum(b.total_price), 0) as total_price,c.label_icon')
->where('a.room_status', 1) // 只统计正常状态的房间
->where('a.apply_status', 2) // 只统计审核通过的房间
->where('b.from', 2)
->where('b.createtime', 'between', [$start_time, time()])
->group('a.id')
->order('total_price', 'desc')
->page($page, $page_limit)
->select();
if($profit){
foreach ($profit as &$v) {
if($v['room_id'] > 0){
$xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']);
$v['xlh_status'] = $xlh_status['xlh_status'];
}else{
$v['xlh_status'] = 0;
}
}
}
return V(1, '获取成功', $profit);
$reslut = model('RoomHourRanking')->room_hour_ranking($page, $page_limit);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//房间小时榜
@@ -72,6 +42,12 @@ class RoomHourRanking extends BaseCom
// return V(0, '排行榜暂未开启');
}
//是否开启巡乐会
$is_open_xlh = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('is_open_xlh');
//是否开启红包(下面的不要删掉)
// $is_open_red_pack = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('is_open_red_pack');
$is_open_red_pack = 0 ;
//当前小时开始时间
$start_time = strtotime(date('Y-m-d H:00:00'));
@@ -107,7 +83,7 @@ class RoomHourRanking extends BaseCom
foreach ($rooms as &$room) {
$room['total_price'] = isset($gift_map[$room['room_id']]) ? $gift_map[$room['room_id']] : 0;
if($room['room_id'] > 0){
if($room['room_id'] > 0 && $is_open_xlh == 1){
$xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($room['room_id']);
$room['xlh_status'] = $xlh_status['xlh_status'];
}else{