This commit is contained in:
aozhiwei 2024-10-08 14:14:24 +08:00
parent c1d1458166
commit cfe7d17c53
2 changed files with 62 additions and 0 deletions

View File

@ -15,6 +15,7 @@ require_once('services/BattleDataService.php');
require_once('services/TameBattleDataService.php');
require_once('services/RoomBattleDataService.php');
require_once('services/FormulaService.php');
require_once('services/BattleBoxService.php');
require_once('mt/RankSeason.php');
require_once('mt/Robot.php');
require_once('mt/Skill.php');
@ -1308,6 +1309,13 @@ class BattleController extends BaseAuthedController {
$r->setPx(DEC_BATTLE_TICKET . $roomUuid, 1, 1000 * 3600);
}
public function requestAllocBoxNumNew() {
$boxNum = services\BattleBoxService::allocBox();
myself()->_rspData(array(
'box_num' => $boxNum
));
}
public function requestAllocBoxNum()
{
if (!myself()->_switchIsOpen('bigEventBoxDrop')) {

View File

@ -0,0 +1,54 @@
<?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, $lastTime)
{
$key = self::DAILY_PHASE_DROP_LAST_TIME_KEY . $phase . ':' . $lastTime;
$r = $this->_getRedis($key);
$time = $r->get($key);
return empty($time) ? 0 : $time;
}
private static function getDailyPhaseDropTotalNum($phase, $lastTime)
{
$key = self::DAILY_PHASE_DROP_TOTAL_KEY . $phase . ':' . $lastTime;
$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);
}
}
}