房间小时榜

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

@@ -0,0 +1,55 @@
<?php
namespace app\cron\controller;
use think\Db;
use function fast\e;
class RoomHourRanking
{
/*
* 运行函数
*/
function index()
{
echo "小时榜 开始发礼物:\n";
$this->send_gift();//小时榜 送礼物
echo "发礼物结束 \n";
}
public function send_gift()
{
//获取上一个小时的开始时间和结束时间
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00'));
//是否全局飘瓶
$is_public_server = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('is_public_server');
if ($is_public_server == 1) {
//全局飘瓶时间段
$xlh_time_range = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('broadcast_times');
if($xlh_time_range){
if($xlh_time_range == 25){
$is_piao = 1;
}else{
//当前小时的前一个小时24小时计时法0-23
$pre_hour = date('H', strtotime('-1 hour'));
//当前的前一个小时是否在 $xlh_time_range中
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
$is_piao = 1;
} else {
$is_piao = 0;
}
}
}else{
$is_piao = 0;
}
}else{
$is_piao = 0;
}
//获取前一个小时的房间排行
}
}