[关闭]
@AliceXT 2016-01-05T03:16:54.000000Z 字数 28355 阅读 438

芳芳分享API说明

芳芳分享


config.php

// 用户的路由
'accounts/:login_email/:password'=>"User/login",
'accounts/:uid'=>'User/all',
'accounts'=>"User/all",
// 认证路由
'realNames/:rid'=>'RealName/all',
'realNames'=>'RealName/all',
// 收藏路由
'collections/:tid'=>'Collection/all',
'collections'=>'Collection/all',
// 关注路由
'focuss/focus/:uid'=>'Focus/focus',//取出uid用户所有关注
'focuss/fans/:uid'=>'Focus/fans',//取出用户所有粉丝
'focuss/:aim_id'=>'Focus/all',//添加关注、取消关注
'focuss'=>'Focus/all',//取出当前用户所有关注
// 信息路由
'msgs/system'=>'Msg/system',//系统信息
'msgs/:fliter'=>'Msg/all',//发送、收到的用户信息
'msgs'=>'Msg/all',//发送用户消息
// 上传路由
'upload/:folderName'=>'Base/upload',
'upload'=>'Base/upload',
// 文章、捐赠、心愿、帮助、领取的路由
':type/:id/comments/:cid'=>'Comment/all',
':type/:id/comments'=>'Comment/all',
':type/:id'=>'Base/init',
':type'=>'Base/init',

总述


模块

用户

登录

get accounts/:login_email/:password

参数 类型 描述
login_email varchar(50) 用户登录email
password char(32) md5加密后的密码

例子

GET http://localhost/fffx/api.php/Home/accounts/8jing8jing8@163.com/0f2c969417057086f35a0978d8745144

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 06:41:48 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"uid":"18","weibo":"","qq":"0","login_email":"8jing8jing8@163.com","password":"0f2c969417057086f35a0978d8745144","token":"edfef6b119b5ee35d2fbc128e40c83b5","token_exptime":"2015-08-06 08:59:23","state":"0","info":{"uid":"18","name":"User18","tel":"","email":"","gender":"\u7537","birth":"0000-00-00","constellation":"\u767d\u7f8a\u5ea7","hometown":"","address":"","busniess":"","content":"","cover":"","work_public":"\u516c\u5f00"},"sum":{"score":"100","essay":"0","fans":"0","focus":"0","collect":"0"},"real":"0"}

注册

post /accounts

参数 类型 描述
login_email varchar(50) 用户登录email
password char(32) md5加密后的密码

例子
request

POST http://localhost/fffx/api.php/Home/accounts
Content-Type: application/json
{
"login_email":"8jing8jing8@163.com",
"password":"0f2c969417057086f35a0978d8745144"
}

-- response --

201 Created
Server:  nginx/1.6.2
Date:  Wed, 05 Aug 2015 00:59:24 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"uid":18}

修改

put /accounts/:uid

参数 类型 描述
uid int(11) 用户ID
name varchar(50) 昵称
tel varchar(30) 固定电话或手机号码
email varchar(50) 收邮件的email,可与登录email不同
gender enum('男', '女') 性别
birth date 生日格式1993-11-07
constellation enum('白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天枰座', '天蝎座', '射手座', '魔蝎座', '水瓶座', '双鱼座') 星座
hometown varchar(50) 家乡,格式广西区/百色市/那坡县,斜杠必须
address varchar(50) 现住住址,格式同上
busniess varchar(100) 职业
content text 个人简介
cover varchar(50) 用户封面地址,如Person/cover/2015-07-27/55b5dae12ad82.jpg
work_public enum('公开', '不公开') 个人工作经历是否公开
password char(32) 新的密码

例子

PUT http://localhost/fffx/api.php/Home/accounts/9
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
        "content": "[em_18][em_38][em_41][em_43]"
    }
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:16:27 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

查看

get /accounts/:uid

参数 类型 描述
uid int(11) 用户ID,非必须

例子

查看所有

GET http://localhost/fffx/api.php/Home/accounts

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:19:56 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[数据略]

查看单个

GET http://localhost/fffx/api.php/Home/accounts/9

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:21:51 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{
"uid": "9",
"name": "方雪婷b",
"tel": "13854656464656",
"email": "634771820@qq.com",
"gender": "女",
"birth": "1993-11-07",
"constellation": "天蝎座",
"hometown": "广西区/百色市/那坡县",
"address": "广东省/肇庆市/封开县",
"busniess": "在校学生",
"content": "[em_18][em_38][em_41][em_43]",
"cover": "Person/cover/2015-08-06/55c343c795308.jpg",
"work_public": "公开",
"sum": {
    "score": "130",
    "essay": "7",
    "fans": "1",
    "focus": "2",
    "collect": "4"
},
"real": "1"

}

文章

获取

get /essays/:id

参数 类型 描述
id int(11) 文章ID

例子
查看所有

GET http://localhost/fffx/api.php/Home/essays

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:29:19 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[数据略]

查看单个

GET http://localhost/fffx/api.php/Home/essays/33

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:30:54 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"tid":"33","title":"\u540e\u53f0\u6587\u7ae0\u5206\u9875\u6d4b\u8bd5","uid":"10","content":"\u540e\u53f0\u6587\u7ae0\u5206\u9875\u6d4b\u8bd5","create_time":"2015-07-30 00:00:00","update_time":"2015-07-31 00:00:00","watch":"0"}

添加

post /essays

参数 类型 描述
title varchar(50) 文章标题
content text 文章内容
watch int(13) 被浏览的次数,默认为0

例子

POST http://localhost/fffx/api.php/Home/essays
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "后台文章分页测试",
    "content": "后台文章分页测试",
    "create_time": "2015-07-30 00:00:00",
    "update_time": "2015-07-31 00:00:00",
    "watch": "0"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:40:29 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改

put /essays/:id

参数 类型 描述
id int(11) 文章ID
title varchar(50) 文章标题
content text 文章内容
create_time datetime 文章创建时间,格式2015-08-05 14:14:52
update_time datetime 文章更新时间,格式同上
watch int(13) 被浏览的次数,默认为0

例子

PUT http://localhost/fffx/api.php/Home/essays/71
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "api更改测试",
    "content": "api更改测试",
    "create_time": "2015-07-30 12:12:12",
    "update_time": "2015-07-31 12:12:12:",
    "watch": "0"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:45:51 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

查看评论

get /essays/{id}/comments/{cid}

参数 类型 描述
id int(11) 文章ID
cid int(11) 评论ID

例子
查看单个

GET http://localhost/fffx/api.php/Home/essays/68/comments/24
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:52:24 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"essay","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}

查看所有

GET http://localhost/fffx/api.php/Home/essays/68/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:51:43 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"essay","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}]

添加评论

post /essays/{id}/comments

参数 类型 描述
id int(11) 文章ID
content text 评论内容

例子

POST http://localhost/fffx/api.php/Home/essays/68/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content": "api评论测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:56:09 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改评论

put /essays/{id}/comments/{cid}

参数 类型 描述
id int(11) 文章ID
cid int(11) 评论ID
content text 评论内容

例子

PUT http://localhost/fffx/api.php/Home/essays/68/comments/24
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content":"api评论修改测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:58:31 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

捐赠

获取

get /donates/:id

参数 类型 描述
id int(11) 捐献ID

例子
查看所有

GET http://localhost/fffx/api.php/Home/donates

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Tue, 11 Aug 2015 02:03:06 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.4.33
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache


[略数据]

查看单个

GET http://localhost/fffx/api.php/Home/donates/27

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Tue, 11 Aug 2015 02:04:20 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.4.33
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"did":"27","title":"\u6350\u5584\u6b3e","uid":"10","type":"\u4e2a\u4eba\u6350\u8d60","start_time":"2015-07-25","end_time":"2015-07-25","watch":"1","content":"","cover":"","value":"200","number":"0","currency":"\u4eba\u6c11\u5e01","note":""}

添加

post /donates

参数 类型 描述
title varchar(50) 标题
type enum('企业捐赠', '个人捐赠') 捐赠类型
start_time date 开始时间,缺省时为提交时间
end_time date 结束时间,缺省时为提交时间的10天后
content text 内容
cover varchar(50) 封面图片地址
value int(13) 项目价值
number int(13) 捐赠个数
currency varchar(20) 币种,比如“人民币”
note varchar(50) 备注,比如“包邮”

例子

POST http://localhost/fffx/api.php/Home/donates
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "捐善款",
    "type": "个人捐赠",
    "start_time": "2015-07-25",
    "end_time": "2015-07-25",
    "watch": "1",
    "content": "api测试捐献提交",
    "cover": "",
    "value": "200",
    "number": "0",
    "currency": "人民币",
    "note": ""
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:22:02 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改

put /donates/:id

参数 类型 描述
id int{11) 捐献ID
title varchar(50) 标题
type enum('企业捐赠', '个人捐赠') 捐赠类型
start_time date 开始时间,缺省时为提交时间
end_time date 结束时间,缺省时为提交时间的10天后
content text 内容
cover varchar(50) 封面图片地址
value int(13) 项目价值
number int(13) 捐赠个数
currency varchar(20) 币种,比如“人民币”
note varchar(50) 备注,比如“包邮”

例子

PUT http://localhost/fffx/api.php/Home/donates/108
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "捐善款",
    "type": "个人捐赠",
    "start_time": "2015-07-25",
    "end_time": "2015-07-25",
    "watch": "1",
    "content": "api测试捐献更改提交",
    "cover": "",
    "value": "200",
    "number": "0",
    "currency": "人民币",
    "note": ""
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:24:47 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

查看评论

get /donates/{id}/comments/{cid}

参数 类型 描述
id int(11) 文章ID
cid int(11) 评论ID

例子
查看单个

GET http://localhost/fffx/api.php/Home/donates/68/comments/24
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:52:24 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"donate","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}

查看所有

GET http://localhost/fffx/api.php/Home/donates/68/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:51:43 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"donate","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}]

添加评论

post /donates/{id}/comments

参数 类型 描述
id int(11) 捐献ID
content text 评论内容

例子

POST http://localhost/fffx/api.php/Home/donates/108/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content":"api捐献评论测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:26:58 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改评论

put /donates/{id}/comments/{cid}

参数 类型 描述
id int(11) 捐献ID
cid int(11) 评论ID
content text 评论内容

例子

PUT http://localhost/fffx/api.php/Home/donates/108/comments/31
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content":"api捐献评论更改测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:34:35 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

心愿

获取

get /wishs/:id

参数 类型 描述
id int(11) 心愿ID

例子
查看所有

GET http://localhost/fffx/api.php/Home/wishs

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:29:19 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[数据略]

查看单个

GET http://localhost/fffx/api.php/Home/wishs/27

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:09:34 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"did":"27","title":"\u6350\u5584\u6b3e","uid":"10","type":"\u4e2a\u4eba\u6350\u8d60","start_time":"2015-07-25","end_time":"2015-07-25","watch":"1","content":"","cover":"","value":"200","number":"0","currency":"\u4eba\u6c11\u5e01","note":""}

添加

post /wishs

参数 类型 描述
title varchar(50) 标题
type enum('企业心愿', '个人心愿') 心愿类型
start_time date 开始时间,缺省时为提交时间
end_time date 结束时间,缺省时为提交时间的10天后
content text 内容
cover varchar(50) 封面图片地址
value int(13) 项目价值
number int(13) 心愿个数
currency varchar(20) 币种,比如“人民币”
note varchar(50) 备注,比如“包邮”

例子

POST http://localhost/fffx/api.php/Home/wishs
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "捐善款",
    "type": "个人心愿",
    "start_time": "2015-07-25",
    "end_time": "2015-07-25",
    "watch": "1",
    "content": "api测试捐献提交",
    "cover": "",
    "value": "200",
    "number": "0",
    "currency": "人民币",
    "note": ""
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:22:02 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改

put /wishs/:id

参数 类型 描述
id int{11) 捐献ID
title varchar(50) 标题
type enum('企业心愿', '个人心愿') 心愿类型
start_time date 开始时间,缺省时为提交时间
end_time date 结束时间,缺省时为提交时间的10天后
content text 内容
cover varchar(50) 封面图片地址
value int(13) 项目价值
number int(13) 心愿个数
currency varchar(20) 币种,比如“人民币”
note varchar(50) 备注,比如“包邮”

例子

PUT http://localhost/fffx/api.php/Home/wishs/108
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "title": "捐善款",
    "type": "个人心愿",
    "start_time": "2015-07-25",
    "end_time": "2015-07-25",
    "watch": "1",
    "content": "api测试捐献更改提交",
    "cover": "",
    "value": "200",
    "number": "0",
    "currency": "人民币",
    "note": ""
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:24:47 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

查看评论

get /wishs/{id}/comments/{cid}

参数 类型 描述
id int(11) 文章ID
cid int(11) 评论ID

例子
查看单个

GET http://localhost/fffx/api.php/Home/wishs/68/comments/24
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:52:24 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"wish","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}

查看所有

GET http://localhost/fffx/api.php/Home/wishs/68/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:51:43 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[{"cid":"24","uid":"9","content":"[em_18][em_38][em_41][em_43]","type":"wish","target_id":"68","time":"2015-07-29 15:39:26","state":"\u663e\u793a"}]

添加评论

post /wishs/{id}/comments

参数 类型 描述
id int(11) 捐献ID
content text 评论内容

例子

POST http://localhost/fffx/api.php/Home/wishs/108/comments
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content":"api捐献评论测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:26:58 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改评论

put /wishs/{id}/comments/{cid}

参数 类型 描述
id int(11) 捐献ID
cid int(11) 评论ID
content text 评论内容

例子

PUT http://localhost/fffx/api.php/Home/wishs/108/comments/31
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
"content":"api捐献评论更改测试"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:34:35 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

帮助

获取

get /helps/:id

参数 类型 描述
id int(11) 帮助ID

例子
查看所有

GET http://localhost/fffx/api.php/Home/helps

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:29:19 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[数据略]

查看单个

GET http://localhost/fffx/api.php/Home/helps/32

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:42:43 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"hid":"32","wid":"75","value":"0","method":"\u5feb\u9012","currecy":"","note":"\u6559\u80b2","uid":"9","time":"2015-07-31 10:48:11","number":"4","type":"\u4e2a\u4eba\u6350\u8d60","content":"HI","cover":"Wish\/help\/2015-07-31\/55bae1ebc67e1.jpg","sort":"\u5176\u4ed6"}

添加

post /helps

参数 类型 描述
wid int(11) 心愿ID
value int(13) 帮助的物品价值
method varchar(50) 快递方式,例如“包邮”
currecy varchar(50) 币种
note varchar(50) 备注,填写物品名称,例如"苹果"
number int(13) 物品的个数
type enum('个人捐赠', '企业捐赠', '物品捐赠') 捐赠类型
content text 捐赠内容
cover varchar(50) 捐赠封面
sort varchar(50) 物品类型,比如“家居”

例子

POST http://localhost/fffx/api.php/Home/helps
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "wid": "75",
    "value": "0",
    "method": "快递",
    "currecy": "",
    "note": "教育",
    "uid": "9",
    "time": "2015-07-31 10:48:11",
    "number": "4",
    "type": "个人捐赠",
    "content": "HI",
    "cover": "Wish/help/2015-07-31/55bae1ebc67e1.jpg",
    "sort": "其他"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:50:17 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改

put /helps/:id

参数 类型 描述
id int{11) 帮助ID
wid int(11) 心愿ID
value int(13) 帮助的物品价值
method varchar(50) 快递方式,例如“包邮”
currecy varchar(50) 币种
note varchar(50) 备注,填写物品名称,例如"苹果"
time datetime 捐献时间,缺省为提交时间
number int(13) 物品的个数
type enum('个人捐赠', '企业捐赠', '物品捐赠') 捐赠类型
content text 捐赠内容
cover varchar(50) 捐赠封面
sort varchar(50) 物品类型,比如“家居”

例子

PUT http://localhost/fffx/api.php/Home/helps/34
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
    "wid": "75",
    "value": "0",
    "method": "快递",
    "currecy": "",
    "note": "教育",
    "uid": "9",
    "time": "2015-07-31 10:48:11",
    "number": "4",
    "type": "个人捐赠",
    "content": "API帮助修改测试",
    "cover": "Wish/help/2015-07-31/55bae1ebc67e1.jpg",
    "sort": "其他"
}
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 08:53:32 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

领取

获取

get /receives/:id

参数 类型 描述
id int(11) 领取ID

例子
查看所有

GET http://localhost/fffx/api.php/Home/receives

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 07:29:19 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[数据略]

查看单个

GET http://localhost/fffx/api.php/Home/receives/9

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 09:11:47 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

{"rid":"9","did":"28","uid":"9","address":"\u6c5f\u82cf\u7701\u6dee\u5b89\u5e02\u6e05\u6d66\u533a\u6a1f\u6728\u5934","value":null,"method":"\u5feb\u9012\u4e0d\u5305\u90ae","currecy":null,"number":null,"time":"2015-07-27 10:03:53","note":"API\u9886\u53d6\u66f4\u6539\u6d4b\u8bd5","state":"\u5f85\u9886\u53d6","name":"\u65b9\u96ea\u5a77a","tel":"13825010619"}

添加

post /receives

参数 类型 描述
did int(11) 捐赠ID
address varchar(50) 收货地址
value int(13) 物品价值,可空
method varchar(50) 邮寄方式,如“快递不包邮”
currecy varchar(24) 币种,可空
number int(13) 数量,默认为1,可空
note varchar(50) 备注,可空
state enum('待领取', '已领取', '未知') 领取状态,默认为已领取
name varchar(50) 收货人姓名
tel varchar(11) 收货人电话

例子

POST http://localhost/fffx/api.php/Home/receives
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
        "did": "28",
        "address": "江苏省淮安市清浦区樟木头",
        "value": null,
        "method": "快递不包邮",
        "currecy": null,
        "number": null,
        "time": "2015-07-27 10:03:53",
        "note": null,
        "state": "待领取",
        "name": "方雪婷a",
        "tel": "13825010619"
    }
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 09:05:54 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

修改

put /receives/:id

参数 类型 描述
id int{11) 领取ID
did int(11) 捐赠ID
address varchar(50) 收货地址
value int(13) 物品价值,可空
method varchar(50) 邮寄方式,如“快递不包邮”
currecy varchar(24) 币种,可空
number int(13) 数量,默认为1,可空
note varchar(50) 备注,可空
state enum('待领取', '已领取', '未知') 领取状态,默认为已领取
name varchar(50) 收货人姓名
tel varchar(11) 收货人电话

例子

PUT http://localhost/fffx/api.php/Home/receives/14
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e
Content-Type: application/json
{
        "did": "28",
        "address": "江苏省淮安市清浦区樟木头",
        "value": null,
        "method": "快递不包邮",
        "currecy": null,
        "number": null,
        "time": "2015-07-27 10:03:53",
        "note": "API领取更改测试",
        "state": "待领取",
        "name": "方雪婷a",
        "tel": "13825010619"
    }
 -- response --
201 Created
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 09:09:11 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

收藏

查看

get /collections

添加

post /collections/:tid

参数 类型 描述
tid int(11) 文章ID

取消

delete /collections/:tid

参数 类型 描述
tid int(11) 文章ID

例子

DELETE http://localhost/fffx/api.php/Home/collections/18
Authorization: 05723b6db9b3aad5cd9d9373c7b04f6e

 -- response --
204 No Content
Server:  nginx/1.6.2
Date:  Thu, 06 Aug 2015 09:17:56 GMT
Content-Type:  application/json; charset=UTF-8
Connection:  keep-alive
X-Powered-By:  PHP/5.3.29
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

关注

查看关注

get /focuss/focus/:uid

参数 类型 描述
uid int(11) 目标用户ID

查看粉丝

get /focuss/fans/:uid

参数 类型 描述
uid int(11) 目标用户ID

添加

post /focuss/:aim_id

参数 类型 描述
aim_id int(11) 目标用户ID

取消

delete /focuss/:aim_id

参数 类型 描述
aim_id int(11) 目标用户ID

消息

所有报文都要添加Authorization

查看系统消息

get /msgs/system

查看用户间的消息

get /msgs/:fliter

参数 类型 描述
fliter enum('send','receive') 收到的消息还是发送的消息

修改

put /msgs

参数 类型 描述
content varchar(50) 发送内容
aim_id int(11) 目标用户ID
state enum('已读', '未读', '已删除') 消息状态
time datetime 提交的时间
uid int(11) 用户ID

添加

post /msgs

参数 类型 描述
content varchar(50) 发送内容
aim_id int(11) 目标用户ID

实名认证

所有报文都要添加Authorization

查看

get /realNames/:rid

参数 类型 描述
rid int(11) 实名认证ID

添加

post /realNames

参数 类型 描述
real_name varchar(50) 真实姓名
id_number char(18) 用户身份证号码
position varchar(50) 正面照片地址
opposite varchar(50) 反面照片地址

修改

put /realNames

参数 类型 描述
time datetime 时间
state enum('申请', '未通过', '通过') 申请状态
real_name varchar(50) 真实姓名
id_number char(18) 用户身份证号码
position varchar(50) 正面照片地址
opposite varchar(50) 反面照片地址

图片上传

post /upload/:folderName

参数 类型 描述
folderName string 图片分类名称,上传的图片会放在网站根目录Uploads/App/folderName/文件夹下

例子

POST http://localhost/fffx/api.php/Home/upload
请求头部
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost/fffx/index.php/Home/Person/cover
Cookie: thinkphp_show_page_trace=0|0; pgv_pvi=4254707712; bdshare_firstime=1435810109991; PHPSESSID=7pcc1965g8flm76k35img23n73
Connection: keep-alive
请求主体
Content-Type: multipart/form-data; boundary=---------------------------28021590218102
Content-Length: 794135

-----------------------------28021590218102
Content-Disposition: form-data; name="pic"; filename="IMG_20150616_163956.jpg"
Content-Type: image/jpeg

[图片数据略]

工作经历

查看

get /work_exps/:id

参数 类型 描述
id int(11) 工作经历ID

添加

post /work_exps

参数 类型 描述
start_time date 入职时间
end_time date 结束时间
company varchar(50) 公司名称
post varchar(50) 职位名称

修改

put /work_exps/:id

参数 类型 描述
id int(11) 工作经历ID
start_time date 入职时间
end_time date 结束时间
company varchar(50) 公司名称
post varchar(50) 职位名称

指定数量查询

get /:type/:id/:count

参数 类型 描述
type emun(essays,donates,wishs) 查询的表的名字
id int(11) 查询定位ID
count int 正数,查询获取的数量

例子

GET http://localhost/fffx/api.php/Home/donates/27/3

 -- response --
200 OK
Server:  nginx/1.6.2
Date:  Tue, 11 Aug 2015 03:01:01 GMT
Content-Type:  application/json; charset=UTF-8
Transfer-Encoding:  chunked
Connection:  keep-alive
X-Powered-By:  PHP/5.4.33
Expires:  Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:  no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:  no-cache

[{"title":"\u6350\u5584\u6b3e","uid":"10","type":"\u4e2a\u4eba\u6350\u8d60","start_time":"2015-07-25","end_time":"2015-07-25","watch":"1","content":"","cover":"","value":"200","number":"0","currency":"\u4eba\u6c11\u5e01","note":"","id":"27"},{"title":"\u4e00\u53ea\u95f2\u7f6e\u7684\u5c0f\u82f9\u679c","uid":"10","type":"\u4e2a\u4eba\u6350\u8d60","start_time":"2015-07-31","end_time":"2015-08-29","watch":"2","content":"\u4e00\u53ea\u95f2\u7f6e\u7684\u5c0f\u82f9\u679c","cover":"","value":"0","number":"1","currency":"\u98df\u54c1a","note":"","id":"28"},{"title":"\u4e00\u53ea\u95f2\u7f6e\u7684\u5c0f\u82f9\u679c","uid":"10","type":"\u4e2a\u4eba\u6350\u8d60","start_time":"2015-07-31","end_time":"2015-08-29","watch":"0","content":"\u4e00\u53ea\u95f2\u7f6e\u7684\u5c0f\u82f9\u679c","cover":"","value":"0","number":"0","currency":"","note":"","id":"29"}]
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注