ParaWorld_Profile
App profile management API
Title |
App profile management API |
Author(s) |
LiXizhi,CYF |
Date |
2008/1/21 |
File |
script/kids/3DMapSystemApp/API/paraworld.profile.lua |
Description
get a given or all application profiles of a given user;
set a given application's profile for the current user or any user(needs providing application signature)
LocalServer is used for caching, so the
GetMCML function can be used offline.
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Member Functions
!
create class
commonlib.setfield("paraworld.profile", {});
[[
鐧诲綍鐢ㄦ埛淇敼銆佽缃叾鏈汉鐨凱rofile
msg = {
sessionKey = string (*) 鐢ㄦ埛蹇呴』鐧诲綍鎵嶈兘淇敼鏁版嵁锛屽苟涓旀殏鏃跺彧淇敼鑷繁鐨凱rofile
appKey = string(*) 淇敼鐨勬槸鍝釜App鐨凱rofile
profile =
XmlElement (*) 鏌愪釜鐢ㄦ埛鐨凱rofile鐨凪CML琛ㄧず褰㈠紡銆傝嫢鏈彁渚汸rofile鎴朠rofile鍊间负String.Empty锛岃〃绀哄皢璇ユ潯鏁版嵁鍒犻櫎
}
msg = {
isSuccess = boolean 鎿嶄綔鏄惁鎴愬姛銆?
[ errorCode ] = int //閿欒鐮併€?锛氭棤寮傚父 500锛氭湭鐭ラ敊璇? 499锛氭彁渚涚殑鏁版嵁涓嶅畬鏁? 498锛氶潪娉曠殑璁块棶
[ info ] = string (鍙戠敓寮傚父鎴栦笉鑳芥甯告搷浣滄暟鎹椂鍒欒繑鍥炴鑺傜偣)
}
]]
paraworld.CreateRESTJsonWrapper("paraworld.profile.SetMCML", "%MAIN%/Profile/SetMCML.ashx",
paraworld.prepLoginRequried);
[[
鍙栧緱鎸囧畾鐢ㄦ埛鐨凱rofile鐨凪CML
msg = {
appKey = string, 鑾病鏈夋彁渚汚ppKey锛屽垯杩斿洖鎸囧畾鐢ㄦ埛鐨勬墍鏈塒rofile
uid = string (*)
}
msg = {
uid = string 瀹㈡埛绔紶杩囨潵鐨勭敤鎴稩D
appKey = string 瀹㈡埛绔紶杩囨潵鐨凙pp Key
apps = list{
appKey = string
profile = string
}
profile = string, for single app, data may be here. one need to check both msg.profile and msg.apps[appKey] for max compatibilities.
[ errorCode ] = int //閿欒鐮併€? 鏈煡鐨勯敊璇?= 500, 鎻愪緵鐨勬暟鎹笉瀹屾暣 = 499, 闈炴硶鐨勮闂?= 498, 鏁版嵁涓嶅瓨鍦ㄦ垨宸茶鍒犻櫎 = 497, 鏈櫥褰曟垨娌℃湁鏉冮檺 = 496
[ info ] = string //鍙戠敓寮傚父鏃舵湁姝よ妭鐐?
}
]]
getMCML with modified preprocessor and postprocessor and local server cache policy
the local server will cache each app
MCML entry, if caller queries for multiple entries at one call, they are saved in local server as multiple entries.
Note: if appKey is nil, local server is not used. if appKey is not nil, local server is used and expired result, if any, will be returned followed by an unexpired or latest result.
local
GetMCML_cache_policy =
Map3DSystem.localserver.CachePolicy:new("access plus 2 hours");
paraworld.CreateRESTJsonWrapper("paraworld.profile.GetMCML", "%MAIN%/Profile/GetMCML.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 |
|