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/Home/Controller/PromoteCoinController.class.php b/Application/Home/Controller/PromoteCoinController.class.php index 2bc70a5ab..c8178ffa7 100644 --- a/Application/Home/Controller/PromoteCoinController.class.php +++ b/Application/Home/Controller/PromoteCoinController.class.php @@ -625,10 +625,11 @@ class PromoteCoinController extends BaseController $level = I('level', 0); $account = I('account', ''); $mobile = I('mobile', ''); - $promote = $this->getLoginPromote(); $map = []; - $map['level'] = $level; + if ($level > 0) { + $map['level'] = $level; + } $map['chain'] = ['like', $promote['chain'] . $promote['id'] . '/%']; if ($account) { @@ -638,7 +639,6 @@ class PromoteCoinController extends BaseController $map['mobile_phone'] = ['like', '%' . $mobile . '%']; } $query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'mobile_phone'])->where($map); - list($promotes, $pagination, $count) = $this->paginate($query); $records = []; foreach ($promotes as $promote) { diff --git a/Application/Home/View/default/PromoteCoin/sub_promotes.html b/Application/Home/View/default/PromoteCoin/sub_promotes.html index d7becdd94..8873daa95 100644 --- a/Application/Home/View/default/PromoteCoin/sub_promotes.html +++ b/Application/Home/View/default/PromoteCoin/sub_promotes.html @@ -9,6 +9,7 @@