diff --git a/application/api/controller/RoomHourRanking.php b/application/api/controller/RoomHourRanking.php new file mode 100644 index 0000000..2bf5057 --- /dev/null +++ b/application/api/controller/RoomHourRanking.php @@ -0,0 +1,51 @@ +order('id', 'desc')->value('open_time'); + return V(1, '获取成功', ['open_time' => $open_time]); + } + + //房间小时榜玩法 + public function room_hour_ranking_play() + { + $introd = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('introd'); + return V(1, '获取成功', ['introd' => $introd]); + } + + //房间小时榜 + public function room_hour_ranking() + { + //判断是否开启 + $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.room_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,sum(b.total_price) as total_price,c.label_icon') + ->where('b.from',2) + ->where('b.createtime', 'between', [$start_time, time()]) + ->order('total_price', 'desc') + ->limit(20) + ->select(); + if($profit){ + foreach ($profit as $k => $v) { + $xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']); + $profit[$k]['xlh_status'] = $xlh_status['xlh_status']; + } + } + return V(1, '获取成功', $profit); + } +} \ No newline at end of file