浏览代码

修复遗失之塔存档报错

249435196@qq.com 1 年之前
父节点
当前提交
ef0ab9648c
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      script/module/lostTemple/lostTempleLogic.lua

+ 7 - 3
script/module/lostTemple/lostTempleLogic.lua

@@ -112,9 +112,12 @@ local DB_DATA = { }
 function dbSave(human)
     if not human.lostTemple then return end
     if not human.db then return end
+    QueryByUuid._id = human.db._id
+    -- 设置upsert为true 如果未找到则插入
+    LuaMongo.update(DB.db_lost_temple, QueryByUuid, human.lostTemple,true)
 
-    DB_DATA = { }
-    LuaMongo.find(DB.db_lost_temple, QueryByUuid)
+    --DB_DATA = { }
+    --[[LuaMongo.find(DB.db_lost_temple, QueryByUuid)
     if not LuaMongo.next(DB_DATA) then
         human.lostTemple._id = human.db._id
         LuaMongo.insert(DB.db_lost_temple, human.lostTemple)
@@ -122,7 +125,8 @@ function dbSave(human)
     end
 
     QueryByUuid._id = human.db._id
-    LuaMongo.update(DB.db_lost_temple, QueryByUuid, human.lostTemple)
+    LuaMongo.update(DB.db_lost_temple, QueryByUuid, human.lostTemple)]]
+
 end
 
 -- db