-
Notifications
You must be signed in to change notification settings - Fork 2
Web API
接口地址:/api/user/login/common
Request:
| Field | Type | Description |
|---|---|---|
| phone | String | 用户手机号 |
| password | String | 用户密码(SSH明文) |
userLogin = {
phone: "15012341234",
password: "bbbbfe321"
};
Response:
| Field | Type | Description |
|---|---|---|
| token | String | User token |
| error | Error Type | 错误信息 |
{"token":"fafsdfsdfsd","error":{"message":"OK","errNo":0}}
| ErrNo | message |
|---|---|
| 0 | 登陆成功(返回token) |
| 1 | (占位留空) |
| 2 | 用户名或密码错误 |
| 3 | 登录失败 |
| 4 | 用户不存在 |
| 100 | 缺少字段:phone |
| 101 | 缺少字段:password |
| 200 | 请输入11位手机号 |
| 201 | 密码长度为6-30位 |
接口地址:/api/user/register
Request:
| Field | Type | Description |
|---|---|---|
| phone | String | 用户手机号 |
| password | String | 用户密码(SSH明文) |
| username | String | 用户名 |
userRegister = {
phone: "15012341234",
password: "bbbbfe321",
username: "lfs"
};
Response:
{"message":"OK","errNo":0}
| ErrNo | message |
|---|---|
| 0 | 注册成功 |
| 1 | (占位留空) |
| 2 | 用户已被注册 |
| 100 | 缺少phone字段 |
| 101 | 缺少username字段 |
| 102 | 缺少password字段 |
| 200 | 请输入11位手机号 |
| 201 | 用户名长度为1-30字符 |
| 202 | 密码长度为6-30位 |
以下不可靠
接口地址:
添加好友: /api/user/friend/add
删除好友: /api/user/friend/remove
接受好友申请: /api/user/friend/accept
拒绝好友申请: /api/user/friend/reject
Request: (四个都相同)
| Field | Type | Description |
|---|---|---|
| token | String | 当前用户token |
| target_user | int | 目标用户id |
friend = {
token: "fdsf",
target_user: 233
};
Response:
添加好友:
| ErrNo | message |
|---|---|
| 0 | 发送好友申请成功 |
| 1 | 用户Token错误 |
| 2 | 目标用户不存在或非法 |
| 3 | 目标用户已经是好友 |
删除好友:
| ErrNo | message |
|---|---|
| 0 | 删除好友成功 |
| 1 | 用户Token错误 |
| 2 | 目标用户不存在或非法 |
| 3 | 目标用户不是用户的好友 |
接受好友请求:
| ErrNo | message |
|---|---|
| 0 | 已接受好友请求 |
| 1 | 用户Token错误 |
| 2 | 目标用户不存在或非法 |
| 3 | 未收到目标用户的好友请求或已经是好友 |
拒绝好友请求:
| ErrNo | message |
|---|---|
| 0 | 已拒绝好友请求 |
| 1 | 用户Token错误 |
| 2 | 目标用户不存在 |
| 3 | 未收到目标用户的好友请求或已经是好友 |
接口地址:/api/user/signature
Request:
| Field | Type | Description |
|---|---|---|
| token | String | User token |
| signature | String | 修改的用户签名 |
userSignature = {
token: "HCVYGWA432SD",
signature: "汪汪汪"
};
Response:
{"message":"OK","errNo":0}
接口地址:/api/user/get/user
Requset:
| Field | Type | Description |
|---|---|---|
| token | String | User token |
| user_id | int | user id |
getUser = {
token: "Hfyd7Nxcn",
user_id: 63
};
Response:
| Field | Type | Description |
|---|---|---|
| user_id | int | user id |
| phone | String | phone |
| username | String | username |
| signature | String | signature |
| is_my_friend | boolean | 是否是我的好友 |
| error | Error Type | error message |
{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
}
接口地址:/api/user/get/friend_list
Request:
| Field | Type | Description |
|---|---|---|
| token | String | User token |
getFriendList = {
token: "Hfyd7Nxcn"
};
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | error message |
| friend_list | User Array | the array of friends |
Note: 忽略user中的error和is_my_friend(true),其他地方可能有类似冗余,同样忽略
{
"error":{"message":"仅校验通过","errNo":999},
"friend_list":
[{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
},{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
}]
}
接口地址:/api/user/signature
Request:
| Field | Type | Description |
|---|---|---|
| token | String | token |
| signature | String | signature to update |
signature = {
token: "Hfyd7Nxcn",
signature: "fsdfds"
};
Response:
{"message":"OK","errNo":0}
接口地址:/api/user/search
Request:
| Field | Type | Description |
|---|---|---|
| token | String | token |
| search_text | String | text(phone or username) to search |
search = {
token: "Hfyd7Nxcn",
search_text: "fsdfds"
};
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | error |
| users | User Type | all matched users |
Note: 忽略user中的error
{
"error":{"message":"OK","errNo":0},
"users":
[{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
},{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
}]
}
接口地址:/api/user/search_contact
Request:
| Field | Type | Description |
|---|---|---|
| token | String | token |
| phones | String Array | phone numbers of contacts |
search_contact = {
token: "Hfyd7Nxcn",
phones: ["15012341234", "27495729301", "13636663666"]
};
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | error |
| users | User Type | users whose phone has registered |
Note: 忽略user中的error
{
"error":{"message":"OK","errNo":0},
"users":
[{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
},{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
}]
}
接口地址:/api/user/get/list/friend_request
Request:
{token:"dfsdffsd"}
Response:
{
"error":{"message":"OK","errNo":0},
"users":
[{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
},{
"user_id":24,
"phone":"12345678901",
"username":"htc",
"signature":"汪!",
"is_my_friend":true,
"error":{"message":"OK","errNo":0}
}]
}
接口地址:/api/activity/get/list/activity_request
Request:
{token:"dfsdffsd"}
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | 错误信息 |
| activities | info array | 活动简介数组 |
{"activities":[
{
"title": "balabala",
"description": "bjrefaewf",
"startTime": 234242342123,
"location": "shanghai",
"activity_id": 7,
"status": 3,
"url": "fsfsd"
}
],"error":{"message":"OK","errNo":0}}`
接口地址:/api/image/upload
| Field | Type | Description |
|---|---|---|
| data | String(Base64) | 照片数据 |
image = {
data: "c7zwebr32BDSAxV67THGyguB6t5YgF36erDfgC2GH......."
};
Response:
| Field | Type | Description |
|---|---|---|
| url | String | 照片url |
| error | Error | error message |
{"error":{"message":"OK","errNo":0},"url":null}
接口地址:/api/activity/post/new
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| title | String | 活动标题 |
| description | String | 活动描述 |
| deadline | ISOString | 报名截至时间 |
add_activity = {
token: "Hfyd7Nxcn",//token
title: "My Activity",
description: "起来嗨!",
deadline: "2011-10-05T14:48:00.000Z"//ISOString
};
Response:
{"activity_id":0,"error":{"message":"OK","errNo":0}}
| ErrNo | message |
|---|---|
| 0 | 添加活动成功 |
| 1 | 用户Token错误 |
| 2 | 添加活动失败 |
接口地址: /api/activity/post/invite
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| activity_id | int | 活动id |
| invites | int array | 邀请的好友 |
invite_user = {
token: "Hfyd7Nxcn",//token
activity_id: 123,
invites: [23, 4234, 5342, 52, 234, 3]//list of user_id
};
Response:
{"message":"OK","errNo":0}
| ErrNo | message |
|---|---|
| 0 | 好友邀请成功 |
| 1 | 用户Token错误 |
| 2 | 活动不存在 |
| 3 | 部分好友邀请失败 |
接口地址:/api/activity/post/reply_invite
Request:
| Field | Type | Description |
|---|---|---|
| token | String | User token |
| activity_id | int | 活动id |
| attend | boolean | 是否参加 |
reply_invite = {
token: "Hfyd7Nxcn",//token
activity_id: 123,
attend: true
};
Response:
{"message":"OK","errNo":0}
| ErrNo | message |
|---|---|
| 0 | 活动回复成功 |
| 1 | 用户Token错误 |
| 2 | 活动请求不存在 |
| 3 | 活动回复失败 |
接口地址: /api/activity/post/time_location
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| activity_id | int | 活动id |
| time | Two Time | 活动开始时间、结束时间 |
| location | Location Time | 活动地点描述、坐标 |
time_location = {
token: "Hfyd7Nxcn",//token
time: {
start_time: "2011-10-05T14:48:00.000Z",
end_time: "2011-10-05T14:48:00.000Z"
},
location: {
latitude: 123123.4324,
longitude: 313213.4324,
place: "Shanghai"
},
activity_id: 233
};
Response:
{"time_location_id":234,"error":{"message":"OK","errNo":0}}
| ErrNo | message |
|---|---|
| 0 | 创建活动建议成功 |
| 1 | 用户Token错误 |
| 2 | 活动不存在 |
| 3 | 创建活动建议失败 |
接口地址:/api/activity/post/photo
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| activity_id | int | 活动id |
| url | String | 活动照片url |
add_activity_photos = {
token: "Hfyd7Nxcn",//token
url: 'hahahaha.png',
activity_id: 233
};
Response:
{"message":"OK","errNo":0}
| ErrNo | message |
|---|---|
| 0 | 资源储存成功 |
| 1 | 用户Token错误 |
| 2 | 活动不存在 |
| 3 | 资源储存失败 |
结束邀请只有活动发起者有权限执行
到达deadline时也会结束邀请,此时默认选择票数最高的时间地点
接口地址:/api/activity//post/decide
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| time_location_id | int | 选择的时间地点 |
decide = {
token: "Hfyd7Nxcn",//token
time_location_id: 213
};
Response:
{"message":"OK","errNo":0}
接口地址:/api/activity/post/vote
Requset:
| Field | Type | Description |
|---|---|---|
| token | String | 投票者token |
| time_location_id | int | 投票的时间地点 |
vote = {
token: "Hfyd7Nxcn",//token
time_location_id: 213
};
Response:
{"message":"OK","errNo":0}
接口地址:/api/activity/get/activity
Request:
| Field | Type | Description |
|---|---|---|
| token | String | 活动发起者token |
| activity_id | int | 活动id |
getActivity = {
token: "Hfyd7Nxcn",
activity_id: 233
};
Response:
| Field | Type | Description |
|---|---|---|
| title | String | 活动标题 |
| description | String | 活动描述 |
| deadline | ISOString | 报名截止时间 |
| error | Error Type | 错误信息 |
| invites | int(user_id) array | 被邀请的好友 |
| activity_id | int | 活动id |
| timeLocations | TimeLocation Array | 候选时间地点 |
| photo_urls | url array | 活动图片 |
| status | int | 活动状态 |
status:
| Value | Description |
|---|---|
| 0 | 邀请中 |
| 1 | 邀请结束 |
| 2 | 活动前and活动时(可以查看好友位置) |
| 3 | 活动结束 |
invite_status
| Value | Description |
|---|---|
| 0 | 暂未回复 |
| 1 | 接受邀请 |
| -1 | 拒绝邀请 |
{
"title":"My Activity",
"description":"起来嗨!",
"deadline":"2011-10-05T14:48:00.000Z",
"error":{"message":"OK","errNo":0},
"invites":[
{
"user_id":23,
"invite_status":-1
},
{
"user_id":32,
"invite_status":0
},
{
"user_id":23333,
"invite_status":1
}],
"activity_id":5432,
"timeLocations":[
{
"time":
{
"start_time": "2011-10-05T14:48:00.000Z",
"end_time": "2011-10-05T14:48:00.000Z"
},
"location":
{
"latitude": 123123.4324,
"longitude": 313213.4324,
"place": "Shanghai"
},
"activity_id": 5432,
"time_location_id": 231,
"votes": 2
},
{
"time":
{
"start_time": "2011-10-05T14:48:00.000Z",
"end_time": "2011-10-05T14:48:00.000Z"
},
"location":
{
"latitude": 123123.4324,
"longitude": 313213.4324,
"place": "Fudan"
},
"activity_id": 5432,
"time_location_id": 324,
"votes": 22
}],
"photo_urls":["vsrgerf/fef/fae","fsdfvsd/fsdfsd/few"],
"status":2
}
| ErrNo | message |
|---|---|
| 0 | 获取活动成功 |
| 1 | 用户Token错误 |
| 2 | 活动不存在 |
接口地址:
全局所有活动: /api/activity/get/list/all
当前用户的活动: /api/activity/get/list/mine
当前用户好友的活动: /api/activity/get/list/friend
Request:
| Field | Type | Description |
|---|---|---|
| user_id | int | get the user's activities |
'Note: ignore user_id when requesting all activities'
getActivityList = {
user_id: 31
};
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | 错误信息 |
| activities | info array | 活动简介数组 |
{"activities":[
{
"title": "balabala",
"description": "bjrefaewf",
"startTime": 234242342123,
"location": "shanghai",
"activity_id": 7,
"status": 3,
"url": "fsfsd"
}
],"error":{"message":"OK","errNo":0}}`
| ErrNo | message |
|---|---|
| 0 | 获取用户活动成功 |
| 1 | 用户Token错误 |
接口地址:/api/position/post
Request:
| Field | Type | Description |
|---|---|---|
| token | String | token |
| latitude | Double | latitude |
| longitude | Double | longitude |
| time | Integer | current time |
postPositiion = {
token: "ff23U77W",
latitude: 4213.4234,
longitude: 32.4234,
time: 23423423
}
Response:
{"message":"OK","errNo":0}
接口地址:/api/position/get
Request:
| Field | Type | Description |
|---|---|---|
| token | String | token |
| activity_id | int | activity id |
getPosition = {
token: "fsref23",
activity_id: 7
}
Response:
| Field | Type | Description |
|---|---|---|
| error | Error Type | error |
| positions | position array | 其他人的地理信息 |
{
“error”:{"message":"OK","errNo":0},
"positions":[
{
user_id:1,
usermane:"fsdf",
photoURL:""gregve",
latitude:2314.1432,
longitude:12312.234
},
{
user_id:1,
usermane:"fsdf",
photoURL:""gregve",
latitude:2314.1432,
longitude:12312.234
}
]
}