[关闭]
@lina 2016-05-20T03:55:29.000000Z 字数 4787 阅读 730

益宠公益-用户端1.0 APP接口文档

益宠公益 api 1.0 iOS Android


第一部分 通用约定

1 通用请求字段

1.1.1 鉴权字段

  • token : [string] 登录后获取的登录认证信息

1.2 通用响应字段

1.2.1 状态字段

  • error_code: [int] 服务器状态码,0 为正常状态,异常状态待定。
  • error_message:[string] 错误信息,仅 error_code 不为 0 时返回

1.2.2 数据字段

  • data: [object] 数据字段,所有响应数据都在此字段中
  • list: [array],当返回数据为列表时会将数据放在该字段

1.2.3 分页字段

  • pageInfo: [object] 分页信息,当返回数组数据时会携带该字段
    • currentPage: [int] 当前页码
    • totalPage: [int] 总页数
    • pageSize: [int] 每页数量

示例

  1. {
  2. error_code: 0,
  3. data: {
  4. key: value,
  5. list: [{
  6. key: value
  7. }],
  8. pageInfo {
  9. }
  10. }
  11. }

1.3 通用接口

1.3.1 上传图片

通用上传文件服务

请求URL

POST

请求参数

  • token
  • file : 文件

响应

  1. {
  2. errorCode: 0,
  3. data: {
  4. id: "9d377b10ce778c4938b3c7e2c63a229a.jpg",
  5. w: 1024,
  6. h: 768
  7. }
  8. }
  • id : [string] 头像名称
  • w : [int] 头像宽度
  • h : [int]头像宽度

1.4 通用数据结构

1.4.1 宠物颜色

  1. {
  2. id: 123,
  3. name: '白色'
  4. }
  • id: [int] 颜色id
  • name: [string] 颜色显示名称:全部|白色|黑色|棕色|黄色|灰色|花色

1.4.2 犬体型

  1. {
  2. id: 123,
  3. name: '大型犬'
  4. }
  • id: [int] 体型id
  • name: [string] 体型显示名称:全部|小型犬|中型犬|大型犬

1.4.3 性别

  1. {
  2. id: 123,
  3. name: '女孩'
  4. }
  • id: [int] 性别id:0|1|2
  • name: [string] 性别显示名称:全部|男孩|女孩

1.4.4 地址

  1. {
  2. name: '鼓楼大街小区',
  3. fullAddress: '北京市鼓楼大街小区23号楼',
  4. latitude:106.3,
  5. longitude:39.6
  6. }
  • name: [string]
  • fullAddress: [string]
  • latitude: [float] 维度
  • longitude: [float] 经度

1.4.5 宠物列表信息

  1. {
  2. id: 123,
  3. pet_code: 'YC00001',
  4. name : '帅帅',
  5. age: '1岁5个月',
  6. profile: 'http://xxxxx',
  7. is_immuned : 1,
  8. is_sterilization: 1,
  9. color : '@宠物颜色',
  10. sex: '@性别',
  11. figure : '@犬体型',
  12. is_adopted: 0,
  13. adoption_time: 14839000,
  14. distance:13000,
  15. publisher: {helper:'@救助人',organization:'@救助机构',
  16. public_time: 1429549593193,
  17. },
  18. }
  • id: [int] 宠物ID
  • pet_code: [string] 宠物编码:【规则】YC大写00001~99999
  • name: [string] 名字
  • age: [string] 年龄
  • profile: [string] 头像Url(领养后由宠物主人上传;领养前为救助人或者机构上传)16:9
  • is_immuned : [bool] 是否免疫
  • is_sterilization : [bool] 是否绝育
  • color : [object] '@宠物颜色'
  • sex : [object] '@性别'
  • figure : [object] '@犬体形'
  • is_adopted : [bool] 是否被领养
  • adoption_time : [int] 领养时间戳
  • distance: [float]距离本手机定位的距离
  • publisher: [object] helper和organization人选其一
  • public_time: [int]发布时间

1.4.6 宠物详情

  1. {
  2. pet: '@宠物列表信息',
  3. publisher_comment : '这只狗狗非常的活泼温顺,xxxx'
  4. shop: ['@爱心商盟','@爱心商盟'],
  5. detail_image : ['http://xxxxx','http://xxxxx'],
  6. video: '@视频',
  7. }

1.4.7 用户

  1. {
  2. id: 1,
  3. name: '李娜',
  4. nickname:'老板',
  5. profile: 'http://xxxxxx',
  6. sex: '@性别',
  7. is_married:1
  8. is_allergy:1
  9. has_pet:1
  10. pet_habit:2
  11. moving_affect:3
  12. }
  • id: [int] 人 ID
  • name: [string] 名字
  • nickname: [string] 昵称
  • profile: [string] 头像地址
  • is_married: [bool] 是否已婚
  • is_allergy: [bool] 是否过敏
  • has_pet: [bool] 是否有宠物
  • pet_habit: [int] 是否了解宠物习惯:1:熟悉 2:一般 3:不知道
  • moving_affect: [int] 搬家是否有影响:1:没影响 2:有影响 3:不好说

1.4.8 救助人

  1. {
  2. id: 1,
  3. name: '李娜',
  4. nickname:'老板',
  5. profile: 'http://xxxxxx',
  6. sex: '@性别',
  7. telephone: '010-8900077',
  8. address: '@地址'
  9. }
  • id: [int] 人 ID
  • name: [string] 名字
  • nickname: [string] 昵称
  • profile: [string] 头像地址
  • sex: [object] 性别
  • telephone : [string] 电话可以是座机或者手机
  • address : [object]'@地址'

1.4.9 救助机构

  1. {
  2. id: 1,
  3. name: '北京领养日公益机构',
  4. logo: 'http://xxxxxx',
  5. telephone: '010-8900077',
  6. address: '@地址'
  7. }
  • id: [int] 机构 ID
  • name: [string] 名字
  • logo: [string] 机构图片1:1
  • telephone : [string] 电话可以是座机或者手机
  • address : [object]'@地址'

1.4.10 爱心商盟

  1. {
  2. id: 1,
  3. name: '北京领养日公益机构',
  4. logo: 'http://xxxxxx',
  5. telephone: '010-8900077',
  6. address: '@地址'
  7. introduction: '本医院位于xxx',
  8. service: '本宠物的洗澡美容由本医院免费提供,如果领养成功,本店继续提供',
  9. type: 1
  10. }
  • id: [int] 机构 ID
  • name: [string] 名字
  • logo: [string] 机构图片1:1
  • telephone : [string] 电话可以是座机或者手机
  • address : [object]'@地址'
  • introduction: [string] 简介
  • service: [string]爱心服务
  • type: [int] 1:宠物店 2:宠物医院

1.4.11 故事

  1. {
  2. id: 1,
  3. content: '益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动',
  4. public_time: 14899000,
  5. publisher:'@用户',
  6. pet:'@宠物列表信息',
  7. images:['http://xxxxxx','http://xxxxxx'],
  8. agree_num:100
  9. }
  • id: [int] 故事 ID
  • content: [string] 发布内容
  • public_time : [int] 发表时间:时间戳
  • publisher: [object] 发布人User
  • pet : [object]
  • images : [array] 发布图片数组1:1
  • agree_num : [int] 被赞的数目

1.4.12 活动

  1. {
  2. id: 1,
  3. title: '益宠公益开展领养人宠物知识培训活动',
  4. content: '益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动益宠公益开展领养人宠物知识培训活动',
  5. summary: '益宠公益开展领养人宠物知识培训活动',
  6. address: '@地址',
  7. telephone: '010-8900077',
  8. person_incharge: '李娜',
  9. thumbnail: 'http://xxxxxx',
  10. detail_image: 'http://xxxxxx',
  11. start_time: 14899000,
  12. public_time: 14899000
  13. detail_image: 'http://xxxxxx',
  14. }
  • id: [int] 活动 ID
  • title: [string] 活动名称
  • content: [string] 活动内容详情
  • summary: [string] 活动摘要
  • address : [object]'@地址'
  • telephone : [string] 电话可以是座机或者手机
  • person_incharge : [string]负责人
  • thumbnail : [string] 缩略图1:1
  • detail_image : [string] 详情图
  • start_time : [int] 活动时间
  • public_time : [int] 发表时间

1.4.13 视频

  1. {
  2. cover: 'http://xxxxxx',
  3. video: 'http://xxxxxx'
  4. }
  • cover: [string] 视频封面
  • video: [string] 视频地址

第二部分 API 接口

【测试Base】http://huiyangche.duapp.com/yc/mock
【线上Base】

请求 header Content-Type:application/json

2 领养

2.1 领养列表(狗+猫)

请求URL

POST /pet/list/dog
POST /pet/list/cat
【测试】狗
【测试】猫
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@宠物列表信息'
  6. ],
  7. pageInfo: [
  8. '@分页字段'
  9. ]
  10. }
  11. }

2.2 宠物详情

请求URL

POST /pet/detail/{id}
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. '@宠物详情'
  5. }
  6. }

3 故事

3.1 故事列表(Tab)

请求URL

POST /story/list
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@故事'
  6. ],
  7. pageInfo: [
  8. '@分页字段'
  9. ]
  10. }
  11. }

3.2 我的宠物故事列表(我的)

请求URL

POST /my/stories
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@故事'
  6. ],
  7. pageInfo: [
  8. '@分页字段'
  9. ]
  10. }
  11. }

4 活动

4.1 活动列表

请求URL

POST /activity/list
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@活动'
  6. ],
  7. pageInfo: [
  8. '@分页字段'
  9. ]
  10. }
  11. }

4.2 活动详情

请求URL

/activity/detail/{id}
POST
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. '@活动'
  5. }
  6. }

5 个人中心

5.1 我的宠物列表

请求URL

POST /my/pets
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@宠物列表'
  6. ]
  7. }

6 爱心商盟

4.1 shop列表

请求URL

POST /shop/list
【测试】
【正式】

响应

  1. {
  2. error_code: 0,
  3. data: {
  4. list: [
  5. '@爱心商盟'
  6. ],
  7. pageInfo: [
  8. '@分页字段'
  9. ]
  10. }
  11. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注