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
paraworld.profile.SetMCML
create class
commonlib.setfield("paraworld.profile", {});
[[
登录用户修改、设置其本人的Profile
msg = {
sessionKey = string (*) 用户必须登录才能修改数据,并且暂时只修改自己的Profile
appKey = string(*) 修改的是哪个App的Profile
profile =
XmlElement? (*) 某个用户的Profile的MCML表示形式。若未提供Profile或Profile值为String.Empty,表示将该条数据删除
}
msg = {
isSuccess = boolean 操作是否成功。
[ errorCode ] = int //错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问
[ info ] = string (发生异常或不能正常操作数据时则返回此节点)
}
]]
syntax
function paraworld.profile.SetMCML()
paraworld.profile.GetMCML
[[
取得指定用户的Profile的MCML
msg = {
appKey = string, 莫没有提供AppKey,则返回指定用户的所有Profile
uid = string (*)
}
msg = {
uid = string 客户端传过来的用户ID
appKey = string 客户端传过来的App Key
apps = list{
appKey = string
profile = string
}
[ 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");
syntax
function paraworld.profile.GetMCML()
!
Post Processor
syntax
function (self, msg, id)
parameters
Topic revision: r1 - 2008-02-29 - 15:26:12 -
LiXizhi