From d27280d04ad4be66564336a78b8c97bc9f547ca2 Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Mon, 9 Dec 2019 10:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E6=9C=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ExchangeController.class.php | 7 +++++++ .../Sdk/Controller/UserController.class.php | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Application/Sdk/Controller/ExchangeController.class.php b/Application/Sdk/Controller/ExchangeController.class.php index 15db73d9..fec9bd81 100644 --- a/Application/Sdk/Controller/ExchangeController.class.php +++ b/Application/Sdk/Controller/ExchangeController.class.php @@ -60,6 +60,13 @@ class ExchangeController extends BaseController{ 'server_name' => $request['server_name'] ])->find(); $request['server_id'] = $server['server_id']; + if (!isset($request['server_id']) || !$request['server_id']) { + $unionServer = M('server_union', 'tab_')->where([ + 'game_id' => $request['game_id'], + 'server_name' => $request['server_name'] + ])->find(); + $request['server_id'] = $unionServer['server_id']; + } $userPlayInfo = M('user_play_info', 'tab_')->where([ 'user_id' => $request['user_id'], diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 0e0fa05b..f0b7aa54 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -1307,6 +1307,25 @@ class UserController extends BaseController ]; M('server', 'tab_')->data($serverData)->add(); } + + // 处理合服情况 + $server = M('server', 'tab_')->where(['server_name' => $request['server_name'], 'game_id' => $request['game_id']])->find(); + if (empty($server)) { + $server = M('server_union', 'tab_')->where(['server_name' => $request['server_name'], 'game_id' => $request['game_id']])->find(); + if (empty($server)) { + $unionData = [ + 'game_id' => $request['game_id'], + 'game_name' => $gameName, + 'server_name' => $request['server_name'], + 'server_num' => $request['server_id'], + 'server_id' => $request['server_id'], + 'server_version' => $request["sdk_version"], + 'create_time' => time(), + 'start_time' => time(), + ]; + M('server_union', 'tab_')->data($unionData)->add(); + } + } $this -> set_message(200, "success", "成功");