|
|
|
@ -412,9 +412,27 @@ 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 = [];
|
|
|
|
|
foreach ($games as $game) {
|
|
|
|
|
if ($game['data_share'] == 1) {
|
|
|
|
|
$baseGame = $gameRepository->getBaseGameByGameId($game['id'], $baseGames);
|
|
|
|
|
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
|
|
|
|
|
$gameIdMap[$game['id']] = $gameIds;
|
|
|
|
|
foreach ($gameIds as $gameId) {
|
|
|
|
|
$revGameIdMap[$gameId] = $game['id'];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$gameIdMap[$game['id']] = [$game['id']];
|
|
|
|
|
$revGameIdMap[$game['id']] = $game['id'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$spendOrWhere = [];
|
|
|
|
|
foreach ($bindingRoles as $bindingRole) {
|
|
|
|
|
$spendOrWhere[] = '(game_player_id="' . $bindingRole['role_id'] . '" and game_id=' . $bindingRole['game_id'] . ')';
|
|
|
|
|
$gameIds = $gameIdMap[$bindingRole['game_id']];
|
|
|
|
|
$spendOrWhere[] = '(game_player_id="' . $bindingRole['role_id'] . '" and game_id in (' . implode(',', $gameIds) . '))';
|
|
|
|
|
}
|
|
|
|
|
$spendCondition = [
|
|
|
|
|
'pay_status' => 1,
|
|
|
|
@ -440,7 +458,13 @@ class TestingResourceRepository
|
|
|
|
|
->group('game_id,game_player_id')
|
|
|
|
|
->select();
|
|
|
|
|
foreach ($spendList as $item) {
|
|
|
|
|
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
|
|
|
|
|
$mainGameId = $revGameIdMap[$item['game_id']];
|
|
|
|
|
$itemKey = $this->getGameRoleId($mainGameId, $item['game_player_id']);
|
|
|
|
|
if (isset($spendItems[$itemKey])) {
|
|
|
|
|
$spendItems[$itemKey] += $item['amount'];
|
|
|
|
|
} else {
|
|
|
|
|
$spendItems[$itemKey] = $item['amount'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$gameSettings = $this->getGameSettings();
|
|
|
|
|