|
|
|
@ -411,10 +411,27 @@ class TestingResourceRepository
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$spendItems = [];
|
|
|
|
|
$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);
|
|
|
|
|
$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,
|
|
|
|
@ -423,7 +440,7 @@ class TestingResourceRepository
|
|
|
|
|
$subBindingCondition = [
|
|
|
|
|
'_string' =>
|
|
|
|
|
'tab_testing_binding.bind_role_id = tab_spend.game_player_id and ' .
|
|
|
|
|
'tab_testing_binding.game_id = tab_spend.game_id and ' .
|
|
|
|
|
'tab_testing_binding.bind_user_id = tab_spend.user_id and ' .
|
|
|
|
|
'UNIX_TIMESTAMP(FROM_UNIXTIME(tab_testing_binding.create_time, "%Y-%m-%d 00:00:00")) <= tab_spend.pay_time'
|
|
|
|
|
];
|
|
|
|
|
$spendRepository = new SpendRepository();
|
|
|
|
@ -440,7 +457,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();
|
|
|
|
@ -455,6 +478,7 @@ class TestingResourceRepository
|
|
|
|
|
'todayProvideRecords' => $todayProvideRecords,
|
|
|
|
|
'gameSettings' => $gameSettings,
|
|
|
|
|
'testingUsers' => $testingUsers,
|
|
|
|
|
'revGameIdMap' => $revGameIdMap
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -467,15 +491,14 @@ 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();
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
|
$user = $users[$role['user_id']] ?? null;
|
|
|
|
@ -484,7 +507,13 @@ 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;
|
|
|
|
|
$quota = 0;
|
|
|
|
|
if ($binding) {
|
|
|
|
|
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
|
|
|
|
|
foreach ($gameIds as $gameId) {
|
|
|
|
@ -494,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;
|
|
|
|
|
$quota = $gameSetting ? round($spendQuota * $gameSetting['rate'] / 100, 2) : 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)) {
|
|
|
|
|