ParaWorld_Users
user info
Title |
user info |
Author(s) |
LiXizhi |
Date |
2008/1/21 |
File |
script/kids/3DMapSystemApp/API/paraworld.users.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Member Functions
!
create class
commonlib.setfield("paraworld.users", {});
[[
鑾峰彇涓€缁勬寚瀹氱敤鎴风殑鎸囧畾淇℃伅
msg = {
"uids" = string (*) //鐢ㄩ€楀彿锛?锛夊垎闅旂殑澶氫釜鐢ㄦ埛ID
"nids" = string // 鐢ㄩ€楀彿锛?锛夊垎闅旂殑澶氫釜鐢ㄦ埛鏁板瓧ID锛屾渶澶氫笉鍙秴杩?0涓?
"fields" = string //瑕侀€楀彿锛?锛夊垎闅旂殑澶氫釜瑕佸彇寰楃殑瀛楁锛岃嫢涓嶄紶姝ゅ弬鏁帮紝琛ㄧず鍙栧緱鎵€鏈夊瓧娈点€傚彲鐢ㄧ殑鍙傛暟涓猴細UserName;MoneyE;MoneyEValidUntil;Gender;BirthDate;Occupation;Website;GameServer;SpaceServer;LobbyServer;MapX;MapY;MapLevel;MapMessage;CityID;CityRole;Profession;ProfessionalSkill;EngineeringSkill;Inventories;CCS_info;UserID,ViewCount,
MoneyP, Credits, Level,
InRoles,FirstName,LastName
}
if(operation = "get")
{
msg = {
"users" = list{
userID = string
锛堢敱鍙傛暟fields鍐冲畾鐨勮妭鐐癸級
}
[ errorCode ] = int 閿欒鐮併€?锛氭棤寮傚父 500锛氭湭鐭ラ敊璇? 499锛氭彁渚涚殑鏁版嵁涓嶅畬鏁? 498锛氶潪娉曠殑璁块棶
[ info ] = string 鍙戠敓寮傚父鎴栫壒娈婃儏褰笅鏈夋鑺傜偣
}
}
paraworld.users.getInfo({nids="001,002,003", fields="userID,NID,UserName"}, "test", function(msg)
log(commonlib.serialize(msg));
end);
paraworld.users.getInfo({uids="813b07e0-7897-4359-aa1f-4b64dc4f20f0", fields="userID,NID,UserName"}, "test", function(msg)
log(commonlib.serialize(msg));
end);
]]
getinfo with modified preprocessor and postprocessor and local server cache policy
- note __ : if msg.fields is nil, local server is not used, so always specify fields.
- note2 __ : FOR LOCAL SERVER TO WORK PROPERLY, ALWAYS INCLUDE "userID,NID" in msg.fields
local getInfo_cache_policy =
Map3DSystem.localserver.CachePolicy:new("access plus 1 week");
local getInfo_cache_policy =
Map3DSystem.localserver.CachePolicy:new("access plus 1 day");
paraworld.CreateRESTJsonWrapper("paraworld.users.getInfo", "%MAIN%/Users/GetInfo.ashx",
PreProcessor
syntax
function (self, msg, id, callbackFunc, callbackParams, postMsgTranslator)
parameters
self |
|
msg |
|
id |
|
callbackFunc |
|
callbackParams |
|
postMsgTranslator |
|
!
Post Processor
syntax
function (self, msg, id,callbackFunc, callbackParams, postMsgTranslator, raw_msg, inputMsg)
parameters
self |
|
msg |
|
id |
|
callbackFunc |
|
callbackParams |
|
postMsgTranslator |
|
raw |
|
msg |
|
inputMsg |
|