房间小时榜相关
This commit is contained in:
104
application/adminapi/controller/RoomHourRanking.php
Normal file
104
application/adminapi/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use think\Db;
|
||||
|
||||
class RoomHourRanking
|
||||
{
|
||||
|
||||
//房间小时榜列表
|
||||
public function room_hour_ranking()
|
||||
{
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 20);
|
||||
$search_ranking = input('search_ranking', '');
|
||||
$search_stime = input('search_stime', '');
|
||||
$search_etime = input('search_etime', '');
|
||||
$where = [];
|
||||
if ($search_ranking) {
|
||||
$where[] = ['room_name', 'like', '%' . $search_ranking . '%'];
|
||||
}
|
||||
if ($search_stime) {
|
||||
$where[] = ['stime', '>=', $search_stime];
|
||||
}
|
||||
if ($search_etime) {
|
||||
$where[] = ['etime', '<=', $search_etime];
|
||||
}
|
||||
$count = db::name('vs_hour_ranking')->where($where)->count();
|
||||
$list = db::name('vs_hour_ranking')->where($where)->page($page, $page_limit)->order('id desc')->select();
|
||||
if($list){
|
||||
foreach ($list as &$v){
|
||||
$v['room_name'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('room_name');
|
||||
$v['user_id'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('user_id');
|
||||
if($v['user_id']){
|
||||
$v['nickname'] = db::name('vs_user')->where(['id'=>$v['user_id']])->value('nickname');
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'lists' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
//房间小时榜配置
|
||||
public function room_hour_ranking_config()
|
||||
{
|
||||
$list = db::name('vs_hour_ranking_config')->order('id', 'desc')->find();
|
||||
return V(1,"成功", $list);
|
||||
}
|
||||
|
||||
//房间小时榜配置修改
|
||||
public function room_hour_ranking_config_edit()
|
||||
{
|
||||
$data = input('post.');
|
||||
$data['is_open_red_pack'] = 0;//暂时不开启
|
||||
$data['createtime'] = time();
|
||||
$data['updatetime'] = time();
|
||||
|
||||
$res = db::name('vs_hour_ranking_config')->insert($data);
|
||||
if ($res) {
|
||||
return V(1, "成功");
|
||||
} else {
|
||||
return V(0, "失败");
|
||||
}
|
||||
}
|
||||
|
||||
//时间段对应关系
|
||||
public function time_period_correspondence()
|
||||
{
|
||||
$list = [
|
||||
[25 => '全时段'],
|
||||
[0 => '00:00-01:00'],
|
||||
[1 => '01:00-02:00'],
|
||||
[2 => '02:00-03:00'],
|
||||
[3 => '03:00-04:00'],
|
||||
[4 => '04:00-05:00'],
|
||||
[5 => '05:00-06:00'],
|
||||
[6 => '06:00-07:00'],
|
||||
[7 => '07:00-08:00'],
|
||||
[8 => '08:00-09:00'],
|
||||
[9 => '09:00-10:00'],
|
||||
[10 => '10:00-11:00'],
|
||||
[11 => '11:00-12:00'],
|
||||
[12 => '12:00-13:00'],
|
||||
[13 => '13:00-14:00'],
|
||||
[14 => '14:00-15:00'],
|
||||
[15 => '15:00-16:00'],
|
||||
[16 => '16:00-17:00'],
|
||||
[17 => '17:00-18:00'],
|
||||
[18 => '18:00-19:00'],
|
||||
[19 => '19:00-20:00'],
|
||||
[20 => '20:00-21:00'],
|
||||
[21 => '21:00-22:00'],
|
||||
[22 => '22:00-23:00'],
|
||||
[23 => '23:00-00:00'],
|
||||
];
|
||||
return V(1,"成功", $list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user