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.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,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 $v) { $xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']); $v['xlh_status'] = $xlh_status['xlh_status']; // $v['xlh_status'] = 1; } } return V(1, '获取成功', $profit); } }