master
ELF 4 years ago
parent 5c034c3c7b
commit c7b90f54a6

@ -411,10 +411,10 @@ class TestingResourceRepository
}
$spendItems = [];
if (count($bindingRoles) > 0) {
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($bindingRoles, 'game_id')]])->select();
$revGameIdMap = [];
$gameIdMap = [];
if (count($bindingRoles) > 0) {
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($bindingRoles, 'game_id')]])->select();
foreach ($games as $game) {
if ($game['data_share'] == 1) {
$baseGame = $gameRepository->getBaseGameByGameId($game['id'], $baseGames);
@ -428,7 +428,6 @@ class TestingResourceRepository
$revGameIdMap[$game['id']] = $game['id'];
}
}
$spendOrWhere = [];
foreach ($bindingRoles as $bindingRole) {
$gameIds = $gameIdMap[$bindingRole['game_id']];
@ -479,6 +478,7 @@ class TestingResourceRepository
'todayProvideRecords' => $todayProvideRecords,
'gameSettings' => $gameSettings,
'testingUsers' => $testingUsers,
'revGameIdMap' => $revGameIdMap
];
}
@ -491,11 +491,11 @@ class TestingResourceRepository
$gameSettings = $result['gameSettings'];
$bindings = $result['bindings'];
$bindingRoles = $result['bindingRoles'];
$revGameIdMap = $result['revGameIdMap'];
$applyRecords = $result['applyRecords'];
$provideRecords = $result['provideRecords'];
$verifyRecords = $result['verifyRecords'];
$todayProvideRecords = $result['todayProvideRecords'];
$gameSettings = index_by_column('base_game_id', $gameSettings);
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
@ -508,7 +508,12 @@ class TestingResourceRepository
$bindingRole = null;
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
$gameSetting = null;
if ($baseGame && isset($gameSettings[$baseGame['id']])) {
$gameSetting = $gameSettings[$baseGame['id']];
}
$spendQuota = 0;
if ($binding) {
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
foreach ($gameIds as $gameId) {
@ -518,14 +523,14 @@ class TestingResourceRepository
break;
}
}
}
$gameSetting = null;
if ($baseGame && isset($gameSettings[$baseGame['id']])) {
$gameSetting = $gameSettings[$baseGame['id']];
}
$spendQuota = $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0;
if ($bindingRole) {
$mainGameId = $revGameIdMap[$binding['game_id']];
$mainGameRoleId = $this->getGameRoleId($mainGameId, $binding['bind_role_id']);
$spendQuota = isset($spendItems[$mainGameRoleId]) ? $spendItems[$mainGameRoleId] : 0;
}
$quota = $gameSetting ? round($spendQuota * $gameSetting['rate'] / 100, 2) : 0;
}
$statusText = '正常';
if (is_null($user) || is_null($testingUser)) {

Loading…
Cancel
Save