|
|
@@ -30,6 +30,16 @@ local FieldName = {name = 1}
|
|
|
local FieldAccount = {account = 1}
|
|
|
|
|
|
local tempData = {}
|
|
|
+
|
|
|
+local function generateuuid(account, serverTag)
|
|
|
+ if not account or not serverTag then
|
|
|
+ assert(false, string.format("data Error! account:%s,svrIndex:%s", account, serverTag))
|
|
|
+ end
|
|
|
+ return string.format("%s|%s", serverTag, account)
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
function isNameExistInDB(name)
|
|
|
QueryByName.name = name
|
|
|
tempData.name = nil
|
|
|
@@ -180,9 +190,10 @@ function saveRoleSset(db, sunset)
|
|
|
end
|
|
|
|
|
|
-------------------- humandb 初始化 start ----------------------
|
|
|
-function createDefaultRole(account)
|
|
|
+function createDefaultRole(account, serverTag)
|
|
|
local db = {
|
|
|
svrIndex = Config.SVR_INDEX,
|
|
|
+ newUniqueTag = generateuuid(account, serverTag),
|
|
|
identity = nil, -- 11位全局不重复的数字id
|
|
|
account = account, -- 帐号名
|
|
|
name = nil, -- 角色名
|
|
|
@@ -211,6 +222,7 @@ function createDefaultRole(account)
|
|
|
heroBook = nil, -- 获得过的图鉴英雄[id]= true
|
|
|
shop = nil, -- 商店购买物品次数记录 shop[shopType][itemID] = cnt
|
|
|
|
|
|
+ battleGameTimes = nil, -- 普通闯关的获得的游戏次数
|
|
|
battleType = 1, -- 战役类型(1、普通,2、精英,3、困难)
|
|
|
maxBattleTime = nil, -- 最新关卡通关时间
|
|
|
guajiID = 0, -- 已通关关卡/挂机关卡
|
|
|
@@ -543,6 +555,13 @@ function roleDBInit()
|
|
|
all = all + 1
|
|
|
roleDBchanged = nil
|
|
|
handleNew(data, newAddDBData)
|
|
|
+
|
|
|
+ --暂时特殊处理下
|
|
|
+ if not data.newUniqueTag then
|
|
|
+ data.newUniqueTag = generateuuid(data.account, Config.NEW_SVR_INDEX)
|
|
|
+ LuaMongo.update(DB.db_char, {_id = data._id}, data)
|
|
|
+ end
|
|
|
+
|
|
|
if roleDBchanged then
|
|
|
list[#list + 1] = data._id
|
|
|
end
|