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