|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace Base\Repository;
|
|
|
|
|
|
|
|
|
|
use Base\Service\GameService;
|
|
|
|
|
use Base\Tool\Registry;
|
|
|
|
|
use Base\Service\PromoteService;
|
|
|
|
|
|
|
|
|
@ -222,7 +223,7 @@ class TestingResourceRepository
|
|
|
|
|
'provide_status' => $batch['provide_status'],
|
|
|
|
|
'provide_status_text' => $this->getProvideStatusText($batch['provide_status']),
|
|
|
|
|
'provide_time' => $batch['provide_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['provide_time']),
|
|
|
|
|
'content' => $content,
|
|
|
|
|
'content' => '',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
return $records;
|
|
|
|
@ -317,6 +318,7 @@ class TestingResourceRepository
|
|
|
|
|
foreach ($roles as $role) {
|
|
|
|
|
$bindingOrWhere[] = '(role_id="' . $role['role_id'] . '" and game_id=' . $role['game_id'] . ')';
|
|
|
|
|
}
|
|
|
|
|
$bindingOrWhereStr = '(' . implode(' or ', $bindingOrWhere) . ')';
|
|
|
|
|
$userIds = array_unique(array_column($roles, 'user_id'));
|
|
|
|
|
|
|
|
|
|
$users = [];
|
|
|
|
@ -325,15 +327,30 @@ class TestingResourceRepository
|
|
|
|
|
$applyRecords = [];
|
|
|
|
|
$testingUsers = [];
|
|
|
|
|
if (count($roles) > 0) {
|
|
|
|
|
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($roles, 'game_id')]])->select();
|
|
|
|
|
$games = index_by_column('id', $games);
|
|
|
|
|
|
|
|
|
|
$gameRepository = new GameRepository();
|
|
|
|
|
$baseGames = $gameRepository->getBaseGames();
|
|
|
|
|
|
|
|
|
|
$testingUsers = M('testing_user', 'tab_')->where(['user_id' => ['in', $userIds]])->select();
|
|
|
|
|
$testingUsers = index_by_column('user_id', $testingUsers);
|
|
|
|
|
$users = M('user', 'tab_')->field(['id', 'phone', 'lock_status'])->where(['id' => ['in', $userIds]])->select();
|
|
|
|
|
$users = index_by_column('id', $users);
|
|
|
|
|
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select();
|
|
|
|
|
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => $bindingOrWhereStr])->select();
|
|
|
|
|
$bindingRoleIds = [];
|
|
|
|
|
foreach ($bindingRows as $bindingRow) {
|
|
|
|
|
$bindings[$this->getGameRoleId($bindingRow['game_id'], $bindingRow['role_id'])] = $bindingRow;
|
|
|
|
|
$bindingRoleIds[] = $this->getGameRoleId($bindingRow['game_id'], $bindingRow['bind_role_id']);
|
|
|
|
|
$game = $games[$bindingRow['game_id']];
|
|
|
|
|
$gameIds = [$bindingRow['game_id']];
|
|
|
|
|
if ($game['data_share'] == 1) {
|
|
|
|
|
$baseGame = $gameRepository->getBaseGameByGameId($bindingRow['game_id'], $baseGames);
|
|
|
|
|
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
|
|
|
|
|
}
|
|
|
|
|
foreach ($gameIds as $gameId) {
|
|
|
|
|
$bindingRoleIds[] = $this->getGameRoleId($gameId, $bindingRow['bind_role_id']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (count($bindings) > 0) {
|
|
|
|
|
$bindingRoles = M('user_play_info', 'tab_')
|
|
|
|
@ -347,7 +364,7 @@ class TestingResourceRepository
|
|
|
|
|
->field('sum(apply_amount) amount, game_id, role_id')
|
|
|
|
|
->where([
|
|
|
|
|
'verify_status' => 0,
|
|
|
|
|
'_string' => implode(' or ', $bindingOrWhere)
|
|
|
|
|
'_string' => $bindingOrWhereStr,
|
|
|
|
|
])
|
|
|
|
|
->group('game_id,role_id')->select();
|
|
|
|
|
$verifyRecords = [];
|
|
|
|
@ -359,7 +376,7 @@ class TestingResourceRepository
|
|
|
|
|
->field('sum(provide_amount) amount, game_id, role_id')
|
|
|
|
|
->where([
|
|
|
|
|
'verify_status' => 1,
|
|
|
|
|
'_string' => implode(' or ', $bindingOrWhere)
|
|
|
|
|
'_string' => $bindingOrWhereStr,
|
|
|
|
|
])
|
|
|
|
|
->group('game_id,role_id')->select();
|
|
|
|
|
$provideRecords = [];
|
|
|
|
@ -371,9 +388,8 @@ class TestingResourceRepository
|
|
|
|
|
->field('sum(provide_amount) amount, game_id, role_id')
|
|
|
|
|
->where([
|
|
|
|
|
'verify_status' => 1,
|
|
|
|
|
'_string' => implode(' or ', $bindingOrWhere),
|
|
|
|
|
'provide_time' => ['egt', strtotime(date('Y-m-d 00:00:00'))],
|
|
|
|
|
'provide_time' => ['elt', strtotime(date('Y-m-d 23:59:59'))],
|
|
|
|
|
'_string' => $bindingOrWhereStr,
|
|
|
|
|
'provide_time' => ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]],
|
|
|
|
|
])
|
|
|
|
|
->group('game_id,role_id')->select();
|
|
|
|
|
$todayProvideRecords = [];
|
|
|
|
@ -384,7 +400,7 @@ class TestingResourceRepository
|
|
|
|
|
$applyItems = M('testing_resource_batch', 'tab_')
|
|
|
|
|
->field('sum(apply_amount) amount, game_id, role_id')
|
|
|
|
|
->where([
|
|
|
|
|
'_string' => implode(' or ', $bindingOrWhere),
|
|
|
|
|
'_string' => $bindingOrWhereStr,
|
|
|
|
|
])
|
|
|
|
|
->group('game_id,role_id')->select();
|
|
|
|
|
$applyRecords = [];
|
|
|
|
@ -466,11 +482,19 @@ class TestingResourceRepository
|
|
|
|
|
$testingUser = $testingUsers[$role['user_id']] ?? null;
|
|
|
|
|
$binding = $bindings[$role['game_role_id']] ?? null;
|
|
|
|
|
$bindingRole = null;
|
|
|
|
|
|
|
|
|
|
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
|
|
|
|
|
|
|
|
|
|
if ($binding) {
|
|
|
|
|
$bindGameRoleId = $this->getGameRoleId($binding['game_id'], $binding['bind_role_id']);
|
|
|
|
|
$bindingRole = $bindingRoles[$bindGameRoleId] ? $bindingRoles[$bindGameRoleId] : null;
|
|
|
|
|
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
|
|
|
|
|
foreach ($gameIds as $gameId) {
|
|
|
|
|
$bindGameRoleId = $this->getGameRoleId($gameId, $binding['bind_role_id']);
|
|
|
|
|
if (isset($bindingRoles[$bindGameRoleId])) {
|
|
|
|
|
$bindingRole = $bindingRoles[$bindGameRoleId];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
|
|
|
|
|
$gameSetting = null;
|
|
|
|
|
if ($baseGame && isset($gameSettings[$baseGame['id']])) {
|
|
|
|
|
$gameSetting = $gameSettings[$baseGame['id']];
|
|
|
|
|