Showing
2 changed files
with
49 additions
and
8 deletions
@@ -93,12 +93,14 @@ class ArticleModel extends global.yoho.BaseModel { | @@ -93,12 +93,14 @@ class ArticleModel extends global.yoho.BaseModel { | ||
93 | * @returns {*} | 93 | * @returns {*} |
94 | */ | 94 | */ |
95 | getSingleArticle(articleId, actId) { | 95 | getSingleArticle(articleId, actId) { |
96 | - return mysqlCli.query(`select act_article.id,content,good_count, | ||
97 | - act_article_img.img_url from ${TABLE_ACT_ARTICLE} | ||
98 | - join ${TABLE_ACT_ARTICLE_IMG} | ||
99 | - where act_article_img.article_id = act_article.id | ||
100 | - and act_article.act_id = :actId | ||
101 | - and act_article.id = :articleId;`, | 96 | + return mysqlCli.query(`SELECT AA.id AS id,AA.content AS content,AA.good_count AS good_count, |
97 | + DATE_FORMAT(AA.create_time, '%Y-%m-%d %H:%i:%S') AS create_time, | ||
98 | + AAI.img_url | ||
99 | + FROM ${TABLE_ACT_ARTICLE} AS AA | ||
100 | + INNER JOIN ${TABLE_ACT_ARTICLE_IMG} AS AAI | ||
101 | + WHERE AAI.article_id = AA.id | ||
102 | + AND AA.act_id = :actId | ||
103 | + AND AA.id = :articleId;`, | ||
102 | { | 104 | { |
103 | actId, | 105 | actId, |
104 | articleId | 106 | articleId |
@@ -10,8 +10,8 @@ | @@ -10,8 +10,8 @@ | ||
10 | 10 | ||
11 | **请求参数** | 11 | **请求参数** |
12 | 12 | ||
13 | -| 名称 | 类型 | 描述 | 备注 | ||
14 | -| ---- | ----- |---- | --- | 13 | +| 名称 | 类型 | 描述 | 备注 | aaa |
14 | +| ---- | ----- |---- | --- | --- | ||
15 | | mobile|string|手机号| | 15 | | mobile|string|手机号| |
16 | | area | string|区域码| 默认:86 | 16 | | area | string|区域码| 默认:86 |
17 | 17 | ||
@@ -195,4 +195,43 @@ | @@ -195,4 +195,43 @@ | ||
195 | 195 | ||
196 | 196 | ||
197 | ### 六、图片详情 | 197 | ### 六、图片详情 |
198 | +**请求路径** | ||
199 | +> {host}/article/querySingle | ||
200 | + | ||
201 | +**请求方法** | ||
202 | +> GET | ||
198 | 203 | ||
204 | +**请求参数** | ||
205 | + | ||
206 | +|名称 | 类型 |必填| 描述 | ||
207 | +|------|-------|-----|---- | ||
208 | +|actId|string |是|活动Id | ||
209 | +|articleId|string |是|文章Id | ||
210 | + | ||
211 | +**应答参数** | ||
212 | + | ||
213 | +| 名称 | 描述 | ||
214 | +| -------| ------- | ||
215 | +| id | 文章ID | ||
216 | +| content | 文章内容 | ||
217 | +| good_count | 点赞数 | ||
218 | +| img_url | 图片地址 | ||
219 | +| create_time | 创建时间 | ||
220 | + | ||
221 | + | ||
222 | +### Request (URL) | ||
223 | + ?actId=1&articleId=1 | ||
224 | +### Result | ||
225 | + { | ||
226 | + "code": 200, | ||
227 | + "data": [ | ||
228 | + { | ||
229 | + "id": 1, | ||
230 | + "content": "减肥的萨克雷;放假啊到路口;非金属矿了;法电视剧付款啦第三节课了scriptalert('aaa')/script", | ||
231 | + "good_count": 0, | ||
232 | + "create_time": "2017-07-03 13:57:13", | ||
233 | + "img_url": "http://img01.yohoboys.com/o_1bk3gc79c11p21c4l1e4ksk0vdl7.jpg?imageMogr2/auto-orient/thumbnail/626/strip/gravity/Center/quality/60/crop/626x530/format/jpg" | ||
234 | + } | ||
235 | + ], | ||
236 | + "message": "获取文章详情成功" | ||
237 | + } |
-
Please register or login to post a comment