From e1dbd84e697445ea0c5f73075f56f97e5849ae53 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 08 三月 2019 14:58:15 +0800
Subject: [PATCH] 6328 【后端】优化代码eval - json只适合字符串序列化,并且尽量用于非中文;建议使用cPickle 的dumps 和loads,协议用2,可支持所有类型,缺点为序列化后不可阅读

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCacheTube.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCacheTube.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCacheTube.py
index 9384eae..b25ce9b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCacheTube.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerViewCacheTube.py
@@ -32,7 +32,7 @@
 import BossHurtMng
 
 import time
-import json
+import cPickle
 
 Def_Process_Tick = "ProcessPlayerCache"
 ##玩家下线同步
@@ -169,9 +169,9 @@
     curPlayerPlusDict["Fruit"] = PlayerAttrFruit.GetAttrFruitEatCntDict(curPlayer)
     
     #-----------
-    curPlayerPropData = json.dumps(curPlayerPropDict, ensure_ascii=False)
-    curPlayerItemData = json.dumps(curEquipItemList, ensure_ascii=False)
-    curPlayerPlusData = json.dumps(__RemoveEmptyDataKey(curPlayerPlusDict), ensure_ascii=False)
+    curPlayerPropData = cPickle.dumps(curPlayerPropDict, 2)
+    curPlayerItemData = cPickle.dumps(curEquipItemList, 2)
+    curPlayerPlusData = cPickle.dumps(__RemoveEmptyDataKey(curPlayerPlusDict), 2)
     return (curPlayerPropData, curPlayerItemData, curPlayerPlusData)
 
 def __RemoveEmptyDataKey(dataDict):

--
Gitblit v1.8.0