//产品列表数量
$goodsSum = count($goodsList);
//当前小时是多少分钟
$hourMinute = (int)date('H')*60;
//当时分钟
$minute = (int)date('i')+$hourMinute;
// dump($config);
// echo '产品数量'.$goodsSum."\r";
// echo '当时分钟'.$minute."\n";
//获取当前分钟除以(产品数量与轮流时间的和)的余数
$minuteRemainder = $minute%($goodsSum*$config['bannerTime']);
// echo '余数'.$minuteRemainder."\r";
if($minuteRemainder == 0 || $minuteRemainder < (int)$config['bannerTime']){
$List = $goodsList[0];
}else{
$Id =intval($minuteRemainder/$config['bannerTime']);
$List = $goodsList[$Id];
}
return $List;
这里是按分钟的,按秒可以以秒来计算