diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 685ad3c6a..8db3fc557 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -103,7 +103,7 @@ class AjaxController extends ThinkController{ } public function getUserPlayGameName($user_id=0){ - $map['user_id'] = $user_id; + $map['user_account'] = $user_id; $data = M("UserPlay","tab_")->field("game_id,game_name,bind_balance")->where($map)->group('user_id,game_id')->select(); $this->AjaxReturn($data); } diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index dcf6f6503..ef8cbb65f 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -129,8 +129,28 @@ class ConsoleController extends Think { public function deleteRepeatUserPlayInfo() { + /* INSERT INTO `tab_server`(`game_id`, `game_name`, `server_name`, `server_num`, `recommend_status`, `show_status`, `stop_status`, `server_status`, `icon`, `start_time`, `desride`, `prompt`, `parent_id`, `create_time`, `server_version`, `developers`, `server_id`) VALUES + (148, '王者纷争(安卓版)', 'O3-潜龙于渊', 3294, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3294'), + (148, '王者纷争(安卓版)', 'O4-攻心为上', 3301, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3301'), + (148, '王者纷争(安卓版)', 'O5-知人善用', 3311, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3311'), + (148, '王者纷争(安卓版)', 'O8-剑拔弩张', 3332, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3332'), + (148, '王者纷争(安卓版)', 'O12-七擒七纵', 3336, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3336'), + (148, '王者纷争(安卓版)', 'O15-遮空蔽日', 3375, 1, 1, 0, 0, NULL, 1571399818, NULL, NULL, NULL, 1571399818, 1, 0, '3375'); */ + // $gameId = 157; // $gameId = 155; + // $gameId = 153; + // $gameId = 150; + // $gameId = 151; + // 需要先执行上面sql插入区服才能清理干净 + // $gameId = 148; + // $gameId = 175; + // $gameId = 142; + // $gameId = 143; + // $gameId = 172; + // $gameId = 173; + // $gameId = 155; + // $gameId = 154; $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 @@ -175,4 +195,68 @@ class ConsoleController extends Think { } } } + + public function deleteRepeatUserPlayInfo2() + { + // $gameId = 157; + // $gameId = 148; + // $gameId = 150; + // $gameId = 151; + // $gameId = 158; + // $gameId = 175; + // $gameId = 142; + // $gameId = 143; + // $gameId = 172; + // $gameId = 173; + // $gameId = 154; + // $gameId = 155; + // $gameId = 176; + // $gameId = 165; + // $gameId = 164; + // $gameId = 179; + // $gameId = 156; + $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 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/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index c8feca33f..01c9b978d 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -219,6 +219,10 @@ class MemberController extends ThinkController ->group('tab_user.id') ->where($hav) ->having($havs)->select(false); + //获取总额 + $allcount = M()->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); + $this->assign('history_count', $allcount[0]['recharge_total']); + //替换为新表 if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){ $sql = M('user', 'tab_')->field('tab_user.id,IFNULL(sum(ss.pay_amount),0) AS recharge_total') @@ -234,7 +238,7 @@ class MemberController extends ThinkController $jcount = M('User', 'tab_')->field('count(a.id) as count,sum(a.recharge_total) recharge_total')->table('(' . $sql . ') as a')->select(); $count = $jcount[0]['count']; // var_dump($jcount);die(); - $this->assign('pay_allcount', $jcount[0]['recharge_total']); + $this->assign('now_count', $jcount[0]['recharge_total']); $model = M('Model')->getByName('user'); diff --git a/Application/Admin/View/DeductBindRecord/deductBindBalance.html b/Application/Admin/View/DeductBindRecord/deductBindBalance.html index f426a7086..c6a001e74 100644 --- a/Application/Admin/View/DeductBindRecord/deductBindBalance.html +++ b/Application/Admin/View/DeductBindRecord/deductBindBalance.html @@ -49,12 +49,13 @@