From 4d05b52d78b592673bd93dd29f1668147cf89039 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 16 十月 2018 15:04:06 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/SnxxServerCode

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 8 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
index 2dbdcdb..f471d91 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorld.py
@@ -477,17 +477,31 @@
 def GetPlayerMainServerID(accIDPlatform):
     # 玩家合服后所属主服ID
     # @param accIDPlatform: 玩家账号所属的平台
-    #===========================================================================
-    # mainServerID = ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "%sMainServerID" % accIDPlatform), None)
-    # if mainServerID != None:
-    #    return mainServerID
-    #===========================================================================
+    mainServerID = ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "%sMainServerID" % accIDPlatform), None)
+    if mainServerID != None:
+        return mainServerID
     return GetServerID()
 
+
+#===============================================================================
+# 平台ID = appid
+# 运营ID = spid
+# 服务器账号更改
+# 原先账号组合为
+# 运营提供的玩家账号ID + 平台ID + 区服组成
+# 
+# 因为IOS和安卓在支持混服的情况下,还要能支持同一个角色号,故引入一个新的运营ID(客户端打包配置),以保证玩家账号为同一个
+# 账号组合变更
+# 运营提供的玩家账号ID + 运营ID + 区服组成
+# 
+# 原游戏中获取平台ID接口变更
+# 1. db 从数据库中的账号表获取AppID
+# 2. GameServer和MapServer 接口改为GetOperator 参考 GetPlayerPlatform
+#===============================================================================
+
 ##获取玩家所属平台
-def GetPlayerPlatform(gameAccID):
-    infoList = gameAccID.split(Def_AccID_Split_Sign)
-    return "" if len(infoList) < 3 else infoList[-2]
+def GetPlayerPlatform(curPlayer):
+    return curPlayer.GetAccountInfo().GetOperator()
 
 ##获取平台账号
 def GetPlatformAccID(gameAccID):
@@ -537,6 +551,19 @@
     return tagPlayer.GetRealMapID()
 
 #---------------------------------------------------------------------
+
+def GetOperationActionDateStr(dateInfo, openServerDay):
+    '''获取运营活动对应日期,存数字代表开服天配置,需要转化为对应的日期
+    @param dateInfo: 运营活动表配置的日期信息, 如果是纯数字代表开服天
+    @param openServerDay: 当前开服天
+    '''
+    if not dateInfo.isdigit():
+        return dateInfo
+    actionServerDay = int(dateInfo)
+    curDateTime = datetime.datetime.today()
+    actionDateTime = curDateTime + datetime.timedelta(days=(actionServerDay-openServerDay))
+    return "%d-%d-%d" % (actionDateTime.year, actionDateTime.month, actionDateTime.day)
+
 ##获得系统时间
 # @param 无意义
 # @return 系统时间
@@ -987,4 +1014,19 @@
     except:
         return inputText
     
+    return inputText
+
+# 服务器默认GBK,转配置编码如UTF8,一般用于与显示层交互,不判断是否base64
+def CodeToGBK(inputText):
+    encodingList = ReadChConfig.GetEvalChConfig("EncodingTex")
+    
+    if len(encodingList) != 2:
+        ErrLog("EncodingTex.txt Error len != 2")
+        return inputText
+    
+    try:
+        return inputText.decode(GetCharacterEncoding()).encode(ShareDefine.Def_Game_Character_Encoding)
+    except:
+        return inputText
+    
     return inputText
\ No newline at end of file

--
Gitblit v1.8.0