Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2024-10-09 17:49:30 +08:00
commit 350102484e
2 changed files with 29 additions and 0 deletions

View File

@ -237,4 +237,16 @@ class BattleBoxService {
}
}
public static function incDropTotalNum($phase, $time, $val)
{
$key = self::DAILY_PHASE_DROP_TOTAL_KEY . $phase . ':' . $time;
$r = myself()->_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);
}
}
}

View File

@ -18,6 +18,7 @@ require_once('mt/StakingVip.php');
require_once('services/AwardService.php');
require_once('services/PropertyChgService.php');
require_once('services/LogService.php');
require_once('services/BattleBoxService.php');
require_once('phpcommon/tglog.php');
use models\Circuit;
@ -334,9 +335,11 @@ class RoomBattleDataService extends BaseService {
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
if ($rate > 0 && !empty($member['box_num']) && myself()->_switchIsOpen('bigEventBoxDrop')){
$rewardBox = array();
$realBoxNum = 0;
for ($i = 0; $i < $member['box_num']; ++$i) {
$rand = $rate * 100;
$rnd = rand(1,100);
++$realBoxNum;
if ($rnd <= $rand){
$chestItems = LootService::dropOutItem($rewardMeta['chestLoot']);
if (count($chestItems)>0){
@ -360,6 +363,20 @@ class RoomBattleDataService extends BaseService {
}
}
if (count($rewardBox) > 0){
if ($battleSingleDb) {
$row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_box_alloc',
array(
'room_uuid' => $battleSingleDb['room_uuid'],
)
);
if ($row) {
services\BattleBoxService::incDropTotalNum($row['phase'],
$row['createtime'],
$realBoxNum);
}
}
$rewardBoxResult = myself()->_mergeAlikeItemKey($rewardBox);
foreach ($rewardBoxResult as $item){
array_push($reward,$item);