diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index 0e1010b0f..dcf6f6503 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -126,4 +126,53 @@ class ConsoleController extends Think { } } } + + public function deleteRepeatUserPlayInfo() + { + // $gameId = 157; + // $gameId = 155; + $gameId = 153; + $sql = 'select id from tab_user_play_info a left join ( + select role_id, server_id, game_id, count(1) from tab_user_play_info where server_id="' . $serverId . '" and game_id = ' . $gameId . ' GROUP BY role_id, server_id, game_id, server_name having count(1) > 1 + ) b on a.role_id=b.role_id where a.server_id=b.server_id and a.game_id=b.game_id and a.server_id="' . $serverId . '" and a.game_id = ' . $gameId . ' order by a.role_id, a.server_id, a.game_id'; + $model = new \Think\Model(); + + $servers = M('server', 'tab_')->field('server_id')->where(['game_id' => $gameId])->group('server_id')->select(); + foreach ($servers as $server) { + $serverId = $server['server_id']; + $sql = 'select a.id, a.role_id, a.server_id, a.game_id, a.role_level from tab_user_play_info a left join ( + select role_id, server_id, game_id, count(1) from tab_user_play_info where server_id="' . $serverId . '" and game_id = ' . $gameId . ' GROUP BY role_id, server_id, game_id, server_name having count(1) > 1 + ) b on a.role_id=b.role_id where a.server_id=b.server_id and a.game_id=b.game_id and a.server_id="' . $serverId . '" and a.game_id = ' . $gameId . ' order by a.role_id, a.server_id, a.game_id'; + // var_dump($sql); + + $result = $model->query($sql); + $uniqueRole = null; + $items = []; + foreach ($result as $item) { + $items[$item['role_id']][] = $item; + } + + $maxRoleIds = []; + $repeatIds = []; + foreach ($items as $roles) { + $maxRole = null; + foreach ($roles as $role) { + if ($maxRole == null) { + $maxRole = $role; + } elseif ($role['role_level'] > $maxRole['role_level']) { + $repeatIds[] = $maxRole['id']; + $maxRole = $role; + } else { + $repeatIds[] = $role['id']; + } + } + $maxRoleIds[] = $maxRole['id']; + } + if (count($repeatIds) > 0) { + M('user_play_info', 'tab_')->where(['id' => ['in', $repeatIds], 'game_id' => $gameId, 'server_id' => $serverId])->delete(); + echo M()->getLastSql(); + echo PHP_EOL; + } + } + } } diff --git a/Application/Base/Repository/PromoteRepository.class.php b/Application/Base/Repository/PromoteRepository.class.php index 867984aa7..83e40ea8b 100644 --- a/Application/Base/Repository/PromoteRepository.class.php +++ b/Application/Base/Repository/PromoteRepository.class.php @@ -370,6 +370,7 @@ class PromoteRepository { $params['time_column'] = 'pay_time'; $map = $this->getPublicAchievementMap($ids, $params); + $map['pay_status'] = 1; $items = M('spend', 'tab_')->field(['sum(pay_amount) amount', 'promote_id', 'pay_way'])->where($map)->group('promote_id, pay_way')->select(); // echo M()->getLastSql();die(); $records = []; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 255b4d206..753b1c416 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2013,7 +2013,6 @@ class QueryController extends BaseController $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); - $records[] = [ 'id' => $parent['id'], 'account' => $parent['account'], @@ -2027,7 +2026,7 @@ class QueryController extends BaseController 'login_user_count' => $selfLoginUserCountList[$parent['id']], 'recharge_count' => $selfRechargeCountList[$parent['id']], 'recharge_user_count' => $selfRechargeUserCountList[$parent['id']], - 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $rechargeAmountList[$parent['id']]['coin'] + $rechargeAmountList[$parent['id']]['cash'], + 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash'], 'recharge_by_ban_coin' => $selfRechargeAmountList[$parent['id']]['ban_coin'], 'recharge_by_coin' => $selfRechargeAmountList[$parent['id']]['coin'], 'recharge_by_cash' => $selfRechargeAmountList[$parent['id']]['cash'], diff --git a/Application/Home/View/default/Query/achievement.html b/Application/Home/View/default/Query/achievement.html index d37eaef80..8205bff9c 100644 --- a/Application/Home/View/default/Query/achievement.html +++ b/Application/Home/View/default/Query/achievement.html @@ -109,8 +109,8 @@