Files
midi-php/application/cron/controller/RoomHourRanking.php
2025-09-29 16:27:36 +08:00

55 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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;
}
//获取前一个小时的房间排行
}
}