From 7e2fba6800afaaeef3ac9d2d3c8c42ebcefd2016 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 05 三月 2019 15:53:48 +0800
Subject: [PATCH] 6328 【后端】优化代码eval

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
index ef6881f..68c9778 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFriend.py
@@ -28,6 +28,7 @@
 import copy
 import PlayerViewCache
 import PlayerTeam
+import json
 
 #---------------------------------------------------------------------
 
@@ -81,7 +82,7 @@
             #玩家的数据没有缓存过
             PlayerControl.NotifyCode(curPlayer, 'Friend_OffLine')
             return
-        cacheDict = eval(curCache.GetPropData())
+        cacheDict = json.loads(curCache.GetPropData())
         tagLV = cacheDict["LV"]
     else:
         tagLV = tagPlayer.GetLV()
@@ -323,7 +324,7 @@
         PlayerControl.NotifyCode(srcPlayer, 'Friend_MakeFriend', [curPlayer.GetName()])
         #srcPlayer.MapServer_QueryPlayerResult(0, 0, 'AddFriendSucceed', "", 0)
     else:
-        cacheDict = eval(curCache.GetPropData())
+        cacheDict = json.loads(curCache.GetPropData())
         PlayerControl.NotifyCode(curPlayer, 'Friend_MakeFriend', [cacheDict['Name']])  
         # 记录等对方上线通知地图,任务等会用到触发逻辑,通用记录次数即可, MapServer_SyncFriendInfo为具体的好友数量,根据策划需求制作
         pass
@@ -395,7 +396,7 @@
         curCache = PlayerViewCache.ViewCacheMgr.FindCache(tagID)
         if not curCache:
             return
-        cacheDict = eval(curCache.GetPropData())
+        cacheDict = json.loads(curCache.GetPropData())
         playerName = cacheDict['Name']
     else:
         playerName = tagPlayer.GetName()

--
Gitblit v1.8.0