Authored by 李奇

修改文档

... ... @@ -7,15 +7,9 @@ const _ = require('lodash');
const camelcase = require('camelcase');
const ArticleModel = require('../models/article');
const ADD_ARTICLE_SUCCESS = '文章发表成功';
const GET_ARTICLES_SUCCESS = '获取文章列表成功';
const GET_ARTICLE_SUCCESS = '获取文章详情成功';
const INVALID_ACTIVITY_ID = '活动ID[actId]不能为空';
const INVALID_IMG = '图片[imgUrl]不能为空';
const INVALID_CONTENT = '内容[content]都不能为空';
const MISS_PARAMS = '缺少参数';
const INVALID_ORDER = '排序[order]值为asc或desc';
const INVALID_ORDER_BY = '排序字段[orderBy]非法';
const POST_SUCCESS = '操作成功';
const GET_SUCCESS = '获取成功';
const INVALID_PARAMS = '参数错误';
const article = {
/**
... ... @@ -42,14 +36,14 @@ const article = {
if (order !== 'asc' && order !== 'desc') {
return res.json({
code: 400,
message: INVALID_ORDER
message: INVALID_PARAMS
});
}
if (orderByFields.indexOf(orderBy) === -1) {
return res.json({
code: 400,
message: INVALID_ORDER_BY
message: INVALID_PARAMS
});
}
... ... @@ -81,7 +75,7 @@ const article = {
pageSize,
totalCount,
totalPage: Math.ceil(totalCount / pageSize),
message: GET_ARTICLES_SUCCESS
message: GET_SUCCESS
});
});
});
... ... @@ -99,9 +93,9 @@ const article = {
const imgUrl = req.body.imgUrl;
const content = req.body.content;
!imgUrl && (errorMsg = INVALID_IMG);
!content && (errorMsg = INVALID_CONTENT);
!actId && (errorMsg = INVALID_ACTIVITY_ID);
if (!imgUrl || !content || !actId) {
errorMsg = INVALID_PARAMS;
}
if (errorMsg) {
return res.json({
... ... @@ -123,7 +117,7 @@ const article = {
res.json({
code: 200,
data: {id},
message: ADD_ARTICLE_SUCCESS
message: POST_SUCCESS
});
});
});
... ... @@ -139,8 +133,9 @@ const article = {
const actId = req.query.actId;
const articleId = req.query.articleId;
!actId && (errorMsg = MISS_PARAMS);
!articleId && (errorMsg = MISS_PARAMS);
if (!actId || !articleId) {
errorMsg = INVALID_PARAMS;
}
if (errorMsg) {
return res.json({
... ... @@ -154,7 +149,7 @@ const article = {
res.json({
code: 200,
data: ret,
message: GET_ARTICLE_SUCCESS
message: GET_SUCCESS
});
});
},
... ... @@ -171,7 +166,7 @@ const article = {
if (!actId || !articleId) {
return res.json({
code: 400,
message: MISS_PARAMS
message: INVALID_PARAMS
});
}
... ... @@ -181,7 +176,7 @@ const article = {
.then(() => {
res.json({
code: 200,
message: '点赞成功'
message: POST_SUCCESS
});
});
});
... ...
## 基础服务
## 登录(只支持短信验证登录)
[验证码登录](http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录)
- [发送验证码](http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md)
- [手机号自动登录](http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/手机号自动登录.md)
- [校验是否是注册用户](http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/校验是否是注册用户.md)
- [验证验证码](http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md)
... ...
### 一、点赞
**请求路径**
> {host}/article/like
**请求方法**
> POST
**请求参数**
| 名称 | 类型 | 描述 | 备注 |
| ---- | ----- |---- | --- |
| artId|string|活动ID|
| article | string|文章ID|
### Request (JSON)
{
"actId": 1,
"articleId": 1
}
### Result
{
"code": 200,
"message": "操作成功"
}
### 二、发送验证码
**请求路径**
> {host}/passport/sms/sendCOde
... ... @@ -126,7 +150,7 @@
"pageSize": 10,
"totalCount": 21,
"totalPage": 3,
"message": "获取文章列表成功"
"message": "获取成功"
}
### 五、发布文章
... ... @@ -164,7 +188,7 @@
"data": {
id: 3
},
"message": "文章发表成功"
"message": "操作成功"
}
... ... @@ -207,5 +231,5 @@
"imgUrl": "http://img01.yohoboys.com/o_1bk3gc79c11p21c4l1e4ksk0vdl7.jpg?imageMogr2/auto-orient/thumbnail/626/strip/gravity/Center/quality/60/crop/626x530/format/jpg"
}
],
"message": "获取文章详情成功"
"message": "获取成功"
}
... ...