MergeServerLogic.lua 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. --合服逻辑
  2. --[=[
  3. 1.更新MergeServerDefine.MERGE_DB_TB中要合并的数据库,备份数据库, 方法见 MergeServerDefine
  4. 2.先执行一次start.sh, 因为重启游戏服时会根据条件删除一些数据, 这样合服时要处理的数据就少了一些。比较前面的服邮件数据可能有异常,
  5. 执行/server/cleanExpireMail.sh清理下异常的邮件(需要修改脚本中数据库名)
  6. 3.将游戏服bin* 的/script 目录下的启动文件Main.lua暂时改为其他名字, MainMerger改为Main.lua,合服完毕后再改回来。
  7. 4.检查MergeServerDefine中的MERGE_DB_TB数据库名是否正确, 如果正确则和正常启动游戏一样启动游戏服, 开始进行合服
  8. 5.查看日志oss_merge, 是否有报错。
  9. 6.修改mysql区服列表的 port, dbName,megre_server字段, 被合服的 port 和 dbname 要改为目标服一样。 sql见sdk数据库下查询中的updateMergeServerData(需要修改数据库名)
  10. 7.修改linux上被合服的bin*文件名, 防止 start.sh 启动时会把被合服也启动起来。脚本见/server/changebinName.sh (需要修改脚本中数据库名)
  11. ]=]
  12. local LuaMongo = _G.lua_mongo
  13. local Config = require("Config")
  14. local Log = require("common.Log")
  15. local MergeServerDefine = require("merge.MergeServerDefine")
  16. local MoZhuExcel = require("excel.mozhu")
  17. local MailExcel = require("excel.mail")
  18. local TowerConfig = require("excel.huanjingTower").huanjingTower
  19. local Util = require("common.Util")
  20. local ItemDefine = require("bag.ItemDefine")
  21. local HuanJingTowerLogic = require("huanjingTower.HuanjingTowerLogic")
  22. local primaryKeyTable = {}
  23. --重复_id缓存表
  24. local repeatIdTb = {}
  25. --目标服和被合服所有玩家的名字缓存表
  26. local allNameTb = {}
  27. --同名数据
  28. local repeatName2Data = {}
  29. local num = 0
  30. --次元魔珠数据缓存表
  31. local mozhuDbCache = { roleList = {}, unionList = {}}
  32. --烟花加成时间
  33. local firesTimeCache = 0
  34. --恶魔之塔最高层数
  35. local towerMaxLevel = 0
  36. local towerHeadCache = {}
  37. local TOWER_LV_HEAD_MAX = HuanJingTowerLogic.TOWER_LV_HEAD_MAX
  38. --创建一个mongo连接实例
  39. local function clientMongoDb(addr)
  40. addr = addr or Config.DB_IP
  41. LuaMongo.client(addr)
  42. end
  43. --切换数据库
  44. local function chooseMongoDb(dbName)
  45. if not dbName or dbName == "" then
  46. print(string.format("数据库名错误, dbName = %s\n", dbName))
  47. return
  48. end
  49. LuaMongo.auth(dbName, Config.DB_USER, Config.DB_PASS)
  50. end
  51. --生成新的 _id
  52. local function generateNewId()
  53. local newId = LuaMongo.id()
  54. return newId
  55. end
  56. --清理部分缓存数据
  57. local function cleanCache()
  58. primaryKeyTable = {}
  59. repeatIdTb = {}
  60. allNameTb = {}
  61. repeatName2Data = {}
  62. mozhuDbCache = { roleList = {}, unionList = {}}
  63. firesTimeCache = 0
  64. towerHeadCache = {}
  65. end
  66. --写日志
  67. local function writeLog(tag, targetDb, sourceDb, sourceColl, info1, info2, docId, errInfo)
  68. local logInfo = string.format("tag: %s, targetDb: %s, sourceDb: %s, sourceColl: %s, info1: %s, info2: %s, docId: %s, errInfo: %s",
  69. tag, targetDb, sourceDb, sourceColl, info1, info2, docId, errInfo)
  70. Log.write(Log.LOGID_OSS_MERGE, logInfo)
  71. end
  72. -------------------------------------------------------------需要单独处理的部分数据---------------------------------------------------------------------
  73. ---------------------------------次元魔蛛/梼杌------------------------------------
  74. local MozhuQueryFiles = { [MergeServerDefine.KEY_CIYUAN_MOZHU] = 1}
  75. --读取
  76. local function loadMoZhuDB(sourceDb, collectionName)
  77. local targetCollection = sourceDb .. collectionName
  78. LuaMongo.find(targetCollection, nil, MozhuQueryFiles)
  79. local data = {}
  80. if not LuaMongo.next(data) then
  81. return nil
  82. end
  83. local targetMoZhuData = data.ciyuanMoZhu
  84. for uuid, roleData in pairs(targetMoZhuData.role or {}) do
  85. mozhuDbCache.roleList[uuid] = roleData
  86. end
  87. for uuid, unionData in pairs(targetMoZhuData.union or {}) do
  88. mozhuDbCache.unionList[uuid] = unionData
  89. num = num + 1
  90. end
  91. end
  92. --随机词条
  93. local function randomCiTiao(data)
  94. local weekTime = Util.getWeekStartTime(os.time())
  95. -- if data.citiaoTime and data.citiaoTime == weekTime then
  96. -- return
  97. -- end
  98. data.citiao = {}
  99. local citiao_rare_max
  100. if not citiao_rare_max then
  101. -- 防止策划删减 词条
  102. citiao_rare_max = 0
  103. for k, v in pairs(MoZhuExcel.citiao) do
  104. if v then
  105. citiao_rare_max = citiao_rare_max + v.quanzhong
  106. end
  107. end
  108. end
  109. local getRare = 0
  110. for i=1, 1 do
  111. local random = math.random(1, citiao_rare_max - getRare)
  112. for k, v in pairs(MoZhuExcel.citiao) do
  113. if not data.citiao[k] and random <= v.quanzhong then
  114. data.citiao[k] = i
  115. getRare = getRare + v.quanzhong
  116. break
  117. elseif not data.citiao[k] then
  118. -- 防止循环最后一个是 已经随机过的 导致 随机不出来
  119. random = random - v.quanzhong
  120. end
  121. end
  122. end
  123. data.citiaoTime = weekTime
  124. end
  125. --初始化魔珠db
  126. local function initMoZhuDB(data)
  127. data.time = os.time()
  128. data.unionRank = {}
  129. data.roleRank = {}
  130. data.role = {}
  131. data.union= {}
  132. --词条
  133. randomCiTiao(data)
  134. end
  135. --插入
  136. local function updateTargetMoZhuDB(targetDb)
  137. local collectionName = MergeServerDefine.COLLECTIONS[3]
  138. local targetCollection = targetDb .. collectionName
  139. LuaMongo.find(targetCollection, nil, MozhuQueryFiles)
  140. local data = {}
  141. if not LuaMongo.next(data) then
  142. return
  143. end
  144. if not data.ciyuanMoZhu then
  145. data.ciyuanMoZhu = {}
  146. initMoZhuDB(data.ciyuanMoZhu)
  147. end
  148. local targetMoZhuData = data.ciyuanMoZhu
  149. local roleRankLen = #targetMoZhuData.roleRank
  150. local unionRankLen = #targetMoZhuData.unionRank
  151. --玩家
  152. for uuid, roleData in pairs(mozhuDbCache.roleList) do
  153. targetMoZhuData.role[uuid] = roleData
  154. roleRankLen = roleRankLen + 1
  155. targetMoZhuData.roleRank[roleRankLen] = uuid
  156. end
  157. --公会
  158. for uuid, unionData in pairs(mozhuDbCache.unionList) do
  159. targetMoZhuData.union[uuid] = unionData
  160. unionRankLen = unionRankLen + 1
  161. targetMoZhuData.unionRank[unionRankLen] = uuid
  162. end
  163. --排序
  164. table.sort(targetMoZhuData.roleRank, function(a, b)
  165. local roleA = targetMoZhuData.role[a]
  166. local roleB = targetMoZhuData.role[b]
  167. return roleA.hurt > roleB.hurt
  168. end)
  169. table.sort(targetMoZhuData.unionRank, function(a, b)
  170. local unionA = targetMoZhuData.union[a]
  171. local unionB = targetMoZhuData.union[b]
  172. if unionA.hurt > unionB.hurt then
  173. return true
  174. elseif unionA.hurt == unionB.hurt then
  175. return unionA.time < unionB.time
  176. end
  177. return false
  178. end)
  179. --更新
  180. LuaMongo.update(targetCollection, {}, {
  181. ["$set"] = {
  182. [MergeServerDefine.KEY_CIYUAN_MOZHU] = targetMoZhuData
  183. },
  184. })
  185. mozhuDbCache = nil
  186. end
  187. ----------------------------------烟花加成时间------------------------------------
  188. local FireQueryFiles = { [MergeServerDefine.KEY_FIREWORKBONUS_TIME] = 1}
  189. --读取
  190. local function loadFireTimeData(sourceDb, collectionName)
  191. local targetCollection = sourceDb .. collectionName
  192. LuaMongo.find(targetCollection, nil, FireQueryFiles)
  193. local data = {}
  194. if not LuaMongo.next(data) then
  195. return nil
  196. end
  197. local now = os.time()
  198. local ti = data.fireWorksBonusTime
  199. if ti and ti > now then
  200. firesTimeCache = firesTimeCache + (ti - now)
  201. end
  202. end
  203. --更新目标库
  204. local function updateTargetFireTimeDB(targetDb)
  205. if firesTimeCache > 0 then
  206. local collectionName = MergeServerDefine.COLLECTIONS[3]
  207. local targetCollection = targetDb .. collectionName
  208. LuaMongo.find(targetCollection, nil, FireQueryFiles)
  209. local data = {}
  210. if not LuaMongo.next(data) then
  211. return
  212. end
  213. local now = os.time()
  214. local ti = data.fireWorksBonusTime
  215. if not ti or ti < now then
  216. ti = now + firesTimeCache
  217. else
  218. ti = ti + firesTimeCache
  219. end
  220. local maxTime = now + MergeServerDefine.FIRE_MAX_TIME
  221. ti = math.min(ti, maxTime)
  222. --更新
  223. LuaMongo.update(targetCollection, {}, {
  224. ["$set"] = {
  225. [MergeServerDefine.KEY_FIREWORKBONUS_TIME] = ti
  226. },
  227. })
  228. end
  229. end
  230. ----------------------------------恶魔之塔------------------------------------
  231. local queryTowerByLv = { lv = nil }
  232. local queryTowerFiles = { headList = 1 }
  233. local function calcTblLen(tb)
  234. local len = 0
  235. for _,_ in pairs(tb) do
  236. len = len + 1
  237. end
  238. return len
  239. end
  240. --加载目标库中tower集合中所有文档的headList
  241. local function loadTowerHeadData(targetDb)
  242. local collectionName = MergeServerDefine.COLLECTIONS[16]
  243. local targetCollection = targetDb .. collectionName
  244. towerMaxLevel = #TowerConfig
  245. for i=1,towerMaxLevel do
  246. queryTowerByLv.lv = i
  247. LuaMongo.find(targetCollection, queryTowerByLv, queryTowerFiles)
  248. local data = {}
  249. if LuaMongo.next(data) then
  250. towerHeadCache[i] = {
  251. subNum = TOWER_LV_HEAD_MAX,
  252. headList = data.headList
  253. }
  254. if data.headList and next(data.headList) then
  255. local len = calcTblLen(data.headList)
  256. if len < TOWER_LV_HEAD_MAX then
  257. towerHeadCache[i].subNum = TOWER_LV_HEAD_MAX - len
  258. end
  259. end
  260. end
  261. end
  262. end
  263. -- 把源库tower集合中的headList插入到目标库的headList中
  264. local function insertTargetTowerHeadCache(sourceDb, coll)
  265. local targetCollection = sourceDb .. coll
  266. for i=1,towerMaxLevel do
  267. local subNum = towerHeadCache[i].subNum
  268. if subNum > 0 then
  269. queryTowerByLv.lv = i
  270. LuaMongo.find(targetCollection, queryTowerByLv, queryTowerFiles)
  271. local data = {}
  272. if LuaMongo.next(data) then
  273. local headData = data.headList
  274. if headData and next(headData) then
  275. towerHeadCache[i].headList = towerHeadCache[i].headList or {}
  276. local targetHeadList = towerHeadCache[i].headList
  277. for k,v in pairs(headData) do
  278. targetHeadList[k] = v
  279. subNum = subNum - 1
  280. if subNum <= 0 then
  281. break
  282. end
  283. end
  284. towerHeadCache[i].subNum = subNum
  285. towerHeadCache[i].isChange = true
  286. end
  287. end
  288. end
  289. end
  290. end
  291. --更新目标库的headList
  292. local function updateTargetTowerHeadDB(targetDb)
  293. local collectionName = MergeServerDefine.COLLECTIONS[16]
  294. local targetCollection = targetDb .. collectionName
  295. for i=1,#towerHeadCache do
  296. local data = towerHeadCache[i]
  297. if data.isChange then
  298. --更新
  299. queryTowerByLv.lv = i
  300. LuaMongo.update(targetCollection, queryTowerByLv, { ["$set"] = { headList = data.headList }})
  301. end
  302. end
  303. end
  304. ---------------------------------------玩家同名------------------------------
  305. local NameQueryFiles = { ["name"] = 1 }
  306. --加载目标库所有玩家的名字
  307. local function loadTargetCharName(targetDb)
  308. local collectionName = MergeServerDefine.COLLECTIONS[1]
  309. local targetCollection = targetDb .. collectionName
  310. LuaMongo.find(targetCollection, nil, NameQueryFiles)
  311. while true do
  312. local data = {}
  313. if not LuaMongo.next(data) then
  314. break
  315. end
  316. allNameTb[data.name] = '1'
  317. end
  318. end
  319. --得到一个邮件数据
  320. local mailConfig = MailExcel.mail[MergeServerDefine.MAIL_ID]
  321. local function frontMail(receiverUuid)
  322. local mail = {}
  323. mail.type = 1
  324. mail.receiverUuid = receiverUuid
  325. mail.title = mailConfig.title
  326. mail.content = mailConfig.content
  327. mail.read = nil
  328. mail.senderName = mailConfig.title
  329. mail.head = 0
  330. mail.fbTime = nil
  331. mail.fbContent = nil
  332. mail.time = os.time()
  333. mail.get = nil
  334. mail.flag = 1
  335. mail.items = { { ItemDefine.ITEM_ZUANSHI_ID, MergeServerDefine.MAIL_NUM } }
  336. return mail
  337. end
  338. --给因同名而修改名字的玩家发送补偿邮件
  339. local function sendRepeatNameMail(targetDb)
  340. local coll = MergeServerDefine.COLLECTIONS[2]
  341. local targetCollection = targetDb .. coll
  342. for oldName, v in pairs(repeatName2Data) do
  343. local mail = frontMail(v.uuid)
  344. local _, err = pcall(LuaMongo.insert, targetCollection, mail)
  345. writeLog(MergeServerDefine.CHANGENAME_TAG, targetDb, v.sourceDb, coll, oldName, v.newName, v.uuid, err or "")
  346. end
  347. end
  348. --------------------------------更新合服时间------------------------------------
  349. local function updateMergeTime(targetDb)
  350. local targetCollection = targetDb .. MergeServerDefine.COLLECTIONS[3]
  351. local now = os.time()
  352. LuaMongo.update(targetCollection, {}, {
  353. ["$set"] = {
  354. [MergeServerDefine.KEY_MERGE_TIME] = now
  355. },
  356. })
  357. end
  358. ----------------------------------------------------------------------------------------------------------------------------------
  359. -----------------------------------------------------char集合中_id的重复检测和处理-------------------------------------------------
  360. --用于检测不同数据库的char集合中的_id是否有重复, 一般来说通过mongo生成的_id基本不会重复(暂时不用)
  361. local function primaryKeyRepeatCheck()
  362. print("================================检查char集合_id的重复性开始=======================================\n")
  363. local collectionName = MergeServerDefine.COLLECTIONS[1]
  364. for k, dbName in ipairs(MergeServerDefine.MERGE_DB_TB) do
  365. local targetCollection = dbName .. collectionName
  366. LuaMongo.find(targetCollection, nil, nil, {_id = 1})
  367. while true do
  368. local data = {}
  369. if not LuaMongo.next(data) then
  370. break
  371. end
  372. if k ~= 1 then
  373. if primaryKeyTable[data._id] then
  374. repeatIdTb[data._id] = generateNewId()
  375. Log.write(Log.LOGID_OSS_MERGE, string.format("result: %s, targetColl: %s, repeatId: %s, newId: %s",
  376. "Repeat", targetCollection, data._id, repeatIdTb[data._id]))
  377. else
  378. primaryKeyTable[data._id] = '1'
  379. end
  380. else
  381. primaryKeyTable[data._id] = '1'
  382. end
  383. end
  384. end
  385. print("================================检查char集合_id的重复性结束=======================================\n")
  386. end
  387. --好友集合
  388. local function handleFriend(data)
  389. if repeatIdTb[data.uuid1] then
  390. data.uuid1 = repeatIdTb[data.uuid1]
  391. end
  392. if repeatIdTb[data.uuid2] then
  393. data.uuid2 = repeatIdTb[data.uuid2]
  394. end
  395. end
  396. --邮件集合
  397. local function handleMail(data)
  398. if repeatIdTb[data.receiverUuid] then
  399. data.receiverUuid = repeatIdTb[data.receiverUuid]
  400. end
  401. end
  402. --公会集合
  403. local function handleUnion(data)
  404. local tb = {}
  405. for id, v in pairs(data.member) do
  406. if repeatIdTb[id] then
  407. tb[id] = v
  408. end
  409. end
  410. for id, v in pairs(tb) do
  411. data.member[id] = nil
  412. data.member[repeatIdTb[id]] = v
  413. end
  414. tb = {}
  415. for id, v in pairs(data.apply) do
  416. if repeatIdTb[id] then
  417. tb[id] = v
  418. end
  419. end
  420. for id, v in pairs(tb) do
  421. data.apply[id] = nil
  422. data.apply[repeatIdTb[id]] = v
  423. end
  424. if data.presidentUuid and repeatIdTb[data.presidentUuid] then
  425. data.presidentUuid = repeatIdTb[data.presidentUuid]
  426. end
  427. end
  428. --星空争霸集合
  429. local function handleStar(data)
  430. if repeatIdTb[data.uuid] then
  431. data.uuid = repeatIdTb[data.uuid]
  432. end
  433. end
  434. --单人竞技场集合
  435. local function handleJJC(data)
  436. if not data.monsterOutID and repeatIdTb[data._id] then
  437. data._id = repeatIdTb[data._id]
  438. end
  439. end
  440. --战斗视频集合
  441. local function handleVideo(data)
  442. local uuid = data.combatInfo.attacker.uuid
  443. if repeatIdTb[uuid] then
  444. data.combatInfo.attacker.uuid = repeatIdTb[uuid]
  445. end
  446. end
  447. ----------------------------------------------------合并数据----------------------------------------------------------
  448. local writeQueue = {}
  449. local function flushWriteQueue()
  450. for _, task in ipairs(writeQueue) do
  451. local ok, err = pcall(LuaMongo.insert, task.collection, task.data)
  452. if not ok then
  453. Log.write(Log.LOGID_OSS_MERGE, task.collection, err)
  454. end
  455. end
  456. writeQueue = {}
  457. end
  458. -- 每积累100条数据批量写入
  459. local function bufferedInsert(collection, data)
  460. table.insert(writeQueue, {collection=collection, data=data})
  461. if #writeQueue >= 100 then
  462. flushWriteQueue()
  463. end
  464. end
  465. local function processCollection(sourceDb, targetDb, coll)
  466. local sourceCollection = sourceDb .. coll
  467. local targetCollection = targetDb .. coll
  468. local errNum = 0
  469. local allNum = 0
  470. LuaMongo.find(sourceCollection, nil, {})
  471. while true do
  472. local data = {}
  473. if not LuaMongo.next(data) then
  474. break
  475. end
  476. --直接插入目标库
  477. local ok, err = pcall(LuaMongo.insert, targetCollection, data)
  478. if not ok then
  479. errNum = errNum + 1
  480. writeLog(MergeServerDefine.ERR_TAG, targetDb, sourceDb, coll, 1, 1, data._id, err)
  481. end
  482. allNum = allNum + 1
  483. end
  484. writeLog(MergeServerDefine.SUCC_TAG, targetDb, sourceDb, coll, allNum, errNum, "", "")
  485. end
  486. --合并char集合
  487. local function processCharColl(sourceDb, targetDb, coll)
  488. local sourceCollection = sourceDb .. coll
  489. local targetCollection = targetDb .. coll
  490. local errNum = 0
  491. local allNum = 0
  492. LuaMongo.find(sourceCollection, nil, {})
  493. while true do
  494. local data = {}
  495. if not LuaMongo.next(data) then
  496. break
  497. end
  498. --同名检测
  499. if allNameTb[data.name] then
  500. num = num + 1
  501. local newName = MergeServerDefine.NEW_NAME .. num
  502. --统计数据
  503. repeatName2Data[data.name] = {
  504. uuid = data._id,
  505. newName = newName,
  506. sourceDb = sourceDb,
  507. }
  508. --改名
  509. data.name = newName
  510. end
  511. allNameTb[data.name] = '1'
  512. --插入目标库
  513. local ok, err = pcall(LuaMongo.insert, targetCollection, data)
  514. if not ok then
  515. errNum = errNum + 1
  516. writeLog(MergeServerDefine.ERR_TAG, targetDb, sourceDb, coll, 1, 1, data._id, err)
  517. end
  518. allNum = allNum + 1
  519. end
  520. writeLog(MergeServerDefine.SUCC_TAG, targetDb, sourceDb, coll, allNum, errNum, "", "")
  521. end
  522. local function startMergeServer(dbList)
  523. assert(dbList and next(dbList), "====数据错误====")
  524. cleanCache()
  525. --目标集合数据库名
  526. local targetDb = dbList[1]
  527. loadTargetCharName(targetDb)
  528. loadTowerHeadData(targetDb)
  529. for i = 2, #dbList do
  530. local sourceDb = dbList[i]
  531. LuaMongo.auth(sourceDb, Config.DB_USER, Config.DB_PASS)
  532. for _, coll in ipairs(MergeServerDefine.COLLECTIONS) do
  533. if not MergeServerDefine.NO_INSERT_COLLECTIONS[coll] then
  534. print(string.format("========================开始处理集合: %s, %s\n", sourceDb, coll))
  535. if coll == MergeServerDefine.COLLECTIONS[1] then
  536. processCharColl(sourceDb, targetDb, coll)
  537. elseif coll == MergeServerDefine.COLLECTIONS[3] then
  538. loadMoZhuDB(sourceDb, coll)
  539. loadFireTimeData(sourceDb, coll)
  540. elseif coll == MergeServerDefine.COLLECTIONS[16] then
  541. insertTargetTowerHeadCache(sourceDb, coll)
  542. else
  543. processCollection(sourceDb, targetDb, coll)
  544. end
  545. end
  546. end
  547. end
  548. --处理那些需要单独处理的数据
  549. updateTargetMoZhuDB(targetDb)
  550. updateTargetFireTimeDB(targetDb)
  551. sendRepeatNameMail(targetDb)
  552. updateTargetTowerHeadDB(targetDb)
  553. updateMergeTime(targetDb)
  554. end
  555. --合服开始函数
  556. function Start()
  557. --创建mongo连接实例
  558. clientMongoDb()
  559. --检查char集合_id的重复性
  560. --primaryKeyRepeatCheck()
  561. print("========================合服开始=====================")
  562. for i, dbList in ipairs(MergeServerDefine.MERGE_DB_TB) do
  563. startMergeServer(dbList)
  564. end
  565. print("========================合服结束=====================")
  566. end