game2006api/webapp/services/BattleBoxService.php
aozhiwei b85a1903e0 1
2024-10-08 14:51:35 +08:00

55 lines
1.4 KiB
PHP

<?php
namespace services;
require_once('mt/Parameter.php');
class BattleBoxService {
const DAILY_PHASE_DROP_LAST_TIME_KEY = ':';
const DAILY_PHASE_DROP_TOTAL_KEY = ':';
public static function allocBox()
{
if (!myself()->_switchIsOpen('bigEventBoxDrop')) {
return 0;
}
$currPhase = self::getCurrentPhase();
}
public static function getCurrentPhase()
{
return 0;
}
private static function getDailyPhaseDropLastTime($phase, $time)
{
$key = self::DAILY_PHASE_DROP_LAST_TIME_KEY . $phase . ':' . $time;
$r = $this->_getRedis($key);
$lastTime = $r->get($key);
return empty($lastTime) ? 0 : $lastTime;
}
private static function getDailyPhaseDropTotalNum($phase, $time)
{
$key = self::DAILY_PHASE_DROP_TOTAL_KEY . $phase . ':' . $time;
$r = $this->_getRedis($key);
$num = $r->get($key);
return empty($num) ? 0 : $num;
}
private static function incAlreadyTodayAllocBoxNum($val)
{
$key = 'box_daily_already_alloc_num:' . myself()->_getNowDaySeconds();
$r = $this->_getRedis($key);
$num = intval($r->get($key));
if (empty($num)) {
$r->setPx($key, $val, 1000 * 3600 * 24 * 7);
} else {
$r->setPx($key, $num + $val, 1000 * 3600 * 24 * 7);
}
}
}