ParaWorld_Friends
querying and managing friends.
| Title |
querying and managing friends. |
| Author(s) |
LiXizhi,CYF |
| Date |
2008/1/21 |
| File |
script/kids/3DMapSystemApp/API/paraworld.friends.lua |
Description
Sample Code
NPL.load("(gl)script/kids/3DMapSystemApp/API/ParaworldAPI.lua");
Member Functions
paraworld.friends.areFriends
create class
commonlib.setfield("paraworld.friends", {});
[[
]]
syntax
function paraworld.friends.areFriends()
paraworld.friends.get
[[
取得指定用户的所有好友
msg = {
"uid" = string (*)
["pageIndex"] = int 显示第几页的数据(以0开始的索引,每页显示20条记录)
["onlyOnline"] = int 是否是只获取在线的好友。(0:获取全部好友 1:只获取在线好友,默认值为0)
[order] = int 排序方式。(1:注册时间 2:加入好友时间 3:用户名)
[isInverse] = int 是否是以倒序排序。(0:不是 1:是 默认值为 默认值为0)
}
msg = {
pageCnt = int //共有多少页数据
uids = string //以逗号“,”分隔的好友用户ID集合
errorCode = int 错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 497:数据不存在或已被删除 495:索引走出界限
[ "info" ] = string 发生时有此节点
}
-- LXZ Done: we allow a person to have thousands of friends. In that case the input should have a page number or max result returned, and the return
-- value should return whether there are more records to be retrieved.
]]
the local server will cache each result.
local friends_get_cache_policy =
Map3DSystem? .localserver.CachePolicy:new("access plus 1 day");
local friends_get_online_cache_policy =
Map3DSystem? .localserver.CachePolicy:new("access plus 10 minutes");
syntax
function paraworld.friends.get()
paraworld.friends.add
[[
登录用户新增一条好友记录
msg = {
"sessionKey" = string (*) 当前登录用户的用户凭证
"friendUserID" = string (*) 好友的用户ID
[ "relationType" ] = int 关系类型 //当前只有一种好友类型:0(好友)
}
msg = {
"isSuccess" = boolean 操作是否成功
"state" = int 状态。 1:双方已成为好友。 2:已向对方发送了好友请求。 3:对方已是您的好友,不必重复请求
[ errorCode ] = int 错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 497:数据不存在或已被删除
[ "info" ] = string 发生错误或非法访问时有此节点
}
]]
syntax
function paraworld.friends.add()
paraworld.friends.remove
[[
当前登录用户将一个好友移除,同时也会在被移除的好友列表中将当前登录用户移除
msg = {
"sessionKey" = string (*) 用户凭证
"friendUserID" = string (*) 好友的用户ID
}
msg = {
"isSuccess" = boolean 操作是否成功
[ errorCode ] = int 错误码。0:无异常 500:未知错误 499:提供的数据不完整 498:非法的访问 497:数据不存在或已被删除
[ "info" ] = string 发生错误或非法访问时有此节点
}
]]
syntax
function paraworld.friends.remove()
Topic revision: r1 - 2008-02-29 - 15:26:12 -
LiXizhi