3. 【App】朋友关系接口
3.1. 获取指定好友
URL: /friend/queryFriend
Type: GET
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 获取指定好友
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
friendId |
int32 |
好友ID |
true |
- |
Request-example:
curl -X GET -i '/friend/queryFriend?friendId=0'
Response-fields:
Field | Type | Description | Since |
---|---|---|---|
id |
int32 |
ID |
- |
userId |
int32 |
用户ID |
- |
userNickname |
string |
用户昵称 |
- |
friendId |
int32 |
朋友ID |
- |
friendNickname |
string |
朋友昵称 |
- |
friendAlias |
string |
朋友别名(备注) |
- |
friendCorpId |
int32 |
朋友公司ID |
- |
friendCorpName |
string |
朋友公司名称 |
- |
greeting |
string |
请求问候语 |
- |
state |
int32 |
关系状态(-3=被移除, -2=被拒绝, -1=被请求中, 0=彼此好友, 1=请求中, 2=已拒绝, 3=已移除) |
- |
createDate |
string |
添加时间 |
- |
updateDate |
string |
更新时间 |
- |
Response-example:
{
"id": 0,
"userId": 0,
"userNickname": "",
"friendId": 0,
"friendNickname": "",
"friendAlias": "",
"friendCorpId": 0,
"friendCorpName": "",
"greeting": "",
"state": 0,
"createDate": "yyyy-MM-dd HH:mm:ss",
"updateDate": "yyyy-MM-dd HH:mm:ss"
}
3.2. 获取我的所有好友
URL: /friend/listMine
Type: GET
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 获取我的所有好友
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
pageNum |
int32 |
页码 |
false |
- |
pageSize |
int32 |
页面大小 |
false |
- |
Request-example:
curl -X GET -i '/friend/listMine?pageNum=0&pageSize=0'
Response-fields:
Field | Type | Description | Since |
---|---|---|---|
total |
int64 |
No comments found. |
- |
list |
array |
No comments found. |
- |
└─id |
int32 |
ID |
- |
└─username |
string |
用户名 |
- |
string |
E-mail |
- |
|
└─phone |
string |
电话 |
- |
└─password |
string |
密码 |
- |
└─password1 |
string |
用户填写密码 |
- |
└─password2 |
string |
用户确认密码 |
- |
└─nickname |
string |
用户昵称 |
- |
└─realname |
string |
姓名 |
- |
└─roleId |
int32 |
角色ID |
- |
└─roleTitle |
string |
角色头衔 |
- |
└─corpId |
int32 |
所在公司ID |
- |
└─corpName |
string |
所在公司名称 |
- |
└─deptId |
int32 |
部门ID |
- |
└─deptName |
string |
部门名称 |
- |
└─gender |
int32 |
性别【0=女,1=男】 |
- |
└─avatar |
string |
头像 |
- |
└─birthday |
string |
生日 |
- |
string |
- |
||
└─major |
string |
专业 |
- |
└─university |
string |
毕业院校 |
- |
└─assignee |
string |
委托人身份(用于流程) |
- |
└─address |
string |
住址 |
- |
└─introduce |
string |
自我简介 |
- |
└─code |
string |
各种码 |
- |
└─invateId |
int32 |
邀请人ID |
- |
└─invateUsername |
string |
邀请人用户名(注册时临时邀请码) |
- |
└─invateNickname |
string |
邀请人昵称 |
- |
└─expiration |
string |
激活有效期 | 帐号有效期 |
- |
└─state |
int32 |
激活状态【-1=已禁用,0=已锁定,1=注册会员,2=VIP会员】(好友中代指关系状态) |
- |
└─alias |
string |
朋友别名(备注) |
- |
└─greeting |
string |
请求问候语(关系属性) |
- |
└─lastDate |
string |
上次登录时间 |
- |
└─lastIp |
string |
上次登录IP |
- |
└─lastAddress |
string |
上次登录IP位置鉴定 |
- |
└─createDate |
string |
注册时间 |
- |
└─updateDate |
string |
更新时间 |
- |
└─push |
int32 |
消息推送 |
- |
└─alert |
int32 |
声音提醒 |
- |
pageNum |
int32 |
当前页 |
- |
pageSize |
int32 |
每页的数量 |
- |
size |
int32 |
当前页的数量 |
- |
startRow |
int64 |
由于startRow和endRow不常用,这里说个具体的用法 |
- |
endRow |
int64 |
当前页面最后一个元素在数据库中的行号 |
- |
pages |
int32 |
总页数 |
- |
prePage |
int32 |
前一页 |
- |
nextPage |
int32 |
下一页 |
- |
firstPage |
boolean |
是否为第一页 |
- |
lastPage |
boolean |
是否为最后一页 |
- |
hasPreviousPage |
boolean |
是否有前一页 |
- |
hasNextPage |
boolean |
是否有下一页 |
- |
navigatePages |
int32 |
导航页码数 |
- |
navigatepageNums |
array |
所有导航页号 |
- |
navigateFirstPage |
int32 |
导航条上的第一页 |
- |
navigateLastPage |
int32 |
导航条上的最后一页 |
- |
Response-example:
{
"total": 0,
"list": [
{
"id": 0,
"username": "",
"email": "",
"phone": "",
"password": "",
"password1": "",
"password2": "",
"nickname": "",
"realname": "",
"roleId": 0,
"roleTitle": "",
"corpId": 0,
"corpName": "",
"deptId": 0,
"deptName": "",
"gender": 0,
"avatar": "",
"birthday": "yyyy-MM-dd",
"qq": "",
"major": "",
"university": "",
"assignee": "",
"address": "",
"introduce": "",
"code": "",
"invateId": 0,
"invateUsername": "",
"invateNickname": "",
"expiration": "yyyy-MM-dd HH:mm:ss",
"state": 0,
"alias": "",
"greeting": "",
"lastDate": "yyyy-MM-dd HH:mm:ss",
"lastIp": "",
"lastAddress": "",
"createDate": "yyyy-MM-dd HH:mm:ss",
"updateDate": "yyyy-MM-dd HH:mm:ss",
"push": 0,
"alert": 0
}
],
"pageNum": 0,
"pageSize": 0,
"size": 0,
"startRow": 0,
"endRow": 0,
"pages": 0,
"prePage": 0,
"nextPage": 0,
"firstPage": true,
"lastPage": true,
"hasPreviousPage": true,
"hasNextPage": true,
"navigatePages": 0,
"navigatepageNums": [
0
],
"navigateFirstPage": 0,
"navigateLastPage": 0
}
3.3. 获取新朋友(近一个月)
URL: /friend/listMyNew
Type: GET
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 获取新朋友(近一个月)
Request-example:
curl -X GET -i '/friend/listMyNew'
Response-fields:
Field | Type | Description | Since |
---|---|---|---|
id |
int32 |
ID |
- |
username |
string |
用户名 |
- |
string |
E-mail |
- |
|
phone |
string |
电话 |
- |
password |
string |
密码 |
- |
password1 |
string |
用户填写密码 |
- |
password2 |
string |
用户确认密码 |
- |
nickname |
string |
用户昵称 |
- |
realname |
string |
姓名 |
- |
roleId |
int32 |
角色ID |
- |
roleTitle |
string |
角色头衔 |
- |
corpId |
int32 |
所在公司ID |
- |
corpName |
string |
所在公司名称 |
- |
deptId |
int32 |
部门ID |
- |
deptName |
string |
部门名称 |
- |
gender |
int32 |
性别【0=女,1=男】 |
- |
avatar |
string |
头像 |
- |
birthday |
string |
生日 |
- |
string |
- |
||
major |
string |
专业 |
- |
university |
string |
毕业院校 |
- |
assignee |
string |
委托人身份(用于流程) |
- |
address |
string |
住址 |
- |
introduce |
string |
自我简介 |
- |
code |
string |
各种码 |
- |
invateId |
int32 |
邀请人ID |
- |
invateUsername |
string |
邀请人用户名(注册时临时邀请码) |
- |
invateNickname |
string |
邀请人昵称 |
- |
expiration |
string |
激活有效期 | 帐号有效期 |
- |
state |
int32 |
激活状态【-1=已禁用,0=已锁定,1=注册会员,2=VIP会员】(好友中代指关系状态) |
- |
alias |
string |
朋友别名(备注) |
- |
greeting |
string |
请求问候语(关系属性) |
- |
lastDate |
string |
上次登录时间 |
- |
lastIp |
string |
上次登录IP |
- |
lastAddress |
string |
上次登录IP位置鉴定 |
- |
createDate |
string |
注册时间 |
- |
updateDate |
string |
更新时间 |
- |
push |
int32 |
消息推送 |
- |
alert |
int32 |
声音提醒 |
- |
Response-example:
[
{
"id": 0,
"username": "",
"email": "",
"phone": "",
"password": "",
"password1": "",
"password2": "",
"nickname": "",
"realname": "",
"roleId": 0,
"roleTitle": "",
"corpId": 0,
"corpName": "",
"deptId": 0,
"deptName": "",
"gender": 0,
"avatar": "",
"birthday": "yyyy-MM-dd",
"qq": "",
"major": "",
"university": "",
"assignee": "",
"address": "",
"introduce": "",
"code": "",
"invateId": 0,
"invateUsername": "",
"invateNickname": "",
"expiration": "yyyy-MM-dd HH:mm:ss",
"state": 0,
"alias": "",
"greeting": "",
"lastDate": "yyyy-MM-dd HH:mm:ss",
"lastIp": "",
"lastAddress": "",
"createDate": "yyyy-MM-dd HH:mm:ss",
"updateDate": "yyyy-MM-dd HH:mm:ss",
"push": 0,
"alert": 0
}
]
3.4. 添加好友
URL: /friend/add
Type: POST
Author: Timothy
Content-Type: application/json
Description: [参数]
friendId 朋友ID
friendNickname 朋友昵称
friendCorpId 公司ID
friendCorpName 公司名称
greeting 问候语
Body-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
id |
int32 |
ID |
false |
- |
userId |
int32 |
用户ID |
true |
- |
userNickname |
string |
用户昵称 |
false |
- |
friendId |
int32 |
朋友ID |
true |
- |
friendNickname |
string |
朋友昵称 |
false |
- |
friendAlias |
string |
朋友别名(备注) |
false |
- |
friendCorpId |
int32 |
朋友公司ID |
false |
- |
friendCorpName |
string |
朋友公司名称 |
false |
- |
greeting |
string |
请求问候语 |
false |
- |
state |
int32 |
关系状态(-3=被移除, -2=被拒绝, -1=被请求中, 0=彼此好友, 1=请求中, 2=已拒绝, 3=已移除) |
false |
- |
createDate |
string |
添加时间 |
false |
- |
updateDate |
string |
更新时间 |
false |
- |
Request-example:
curl -X POST -H "Content-Type: application/json" -i '/friend/add' --data '{
"id": 0,
"userId": 0,
"userNickname": "",
"friendId": 0,
"friendNickname": "",
"friendAlias": "",
"friendCorpId": 0,
"friendCorpName": "",
"greeting": "",
"state": 0,
"createDate": "yyyy-MM-dd HH:mm:ss",
"updateDate": "yyyy-MM-dd HH:mm:ss"
}'
3.5. 接受好友请求
URL: /friend/accept
Type: POST
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 接受好友请求
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
friendId |
int32 |
朋友ID |
true |
- |
Request-example:
curl -X POST -i '/friend/accept' --data 'friendId=0'
3.6. 拒绝好友请求
URL: /friend/reject
Type: POST
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 拒绝好友请求
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
friendId |
int32 |
朋友ID |
true |
- |
Request-example:
curl -X POST -i '/friend/reject' --data 'friendId=0'
3.7. 解除好友关系
URL: /friend/unfriend
Type: DELETE
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 解除好友关系
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
friendId |
int32 |
朋友ID |
true |
- |
Request-example:
curl -X DELETE -i '/friend/unfriend?friendId=0'
3.8. 修改好友别名(备注)
URL: /friend/update
Type: PUT
Author: Timothy
Content-Type: application/x-www-form-urlencoded
Description: 修改好友别名(备注)
Query-parameters:
Parameter | Type | Description | Required | Since |
---|---|---|---|---|
friendId |
int32 |
朋友ID |
true |
- |
friendAlias |
string |
朋友别名 |
true |
- |
Request-example:
curl -X PUT -i '/friend/update' --data 'friendId=0&friendAlias='
Response-example:
0