ArticleContentController_API1.md
4.9 KB
ArticleContentController获取逛的详情内容
方法:getArticleContent()
请求参数
<table>
<tr><th>参数名称</th><th>参数类型</th><th>可否为空</th><th>示例</th><th>默认值</th><th>备注</th></tr>
<tr><td>article\_id</td><td>string</td><td>否</td><td>5</td><td>0</td><td>文章id</td></tr>
<tr><td>client\_type</td><td>string</td><td>否</td><td>h5</td><td>h5</td><td>客户端类型</td></tr>
</table>
实现逻辑:
1、ArticleContentController.getArticleContent()方法中调用sns.guang.getArticleContent服务;
2、对参数article_id文章id是否为空或是否小于0进行验证,若为空则抛出文章id不能为空的异常或文章id错误异常;对参数client_type进行是否为空验证,若为空则设为默认值"h5";
3、根据article_id查询数据库表article_block获取该文章id对应的blocks信息,包括详情内容信息和内容键值等信息;
4、对blocks对象进行转换,返回封装的ArticleContentRspBO对象;
返回:
{
"alg": "SALT_MD5",
"code": 200,
"data": [
{
"singleImage": {
"data": [
{
"alt": "",
"imgId": "0",
"src": "http://img11.static.yhbimg.com/yhb-img01/2015/05/20/21/01814149701999001dfbcfdb330faa835c.jpg?imageView/{mode}/w/{width}/h/{height}",
"title": "",
"url": ""
}
],
"template_intro": "一张图片",
"template_name": "single_image"
}
},
{
"text": {
"data": {
"text": "近年来,阔腿裤因其简单大方的宽松轮廓以及修饰腿型的作用而风靡女装界。没有瘦腿裤那样的束缚感,其舒适的穿着体验让它无论是休闲还是工作都可以轻松胜任。如果男生选择阔腿裤,则可以相应的选择一件线条硬朗的牛仔外套来中和阔腿裤的阴柔气质,同时更能提升整体的复古气质。"
},
"template_name": "text"
}
},
{
"goods": {
"data": [
{
"id": "51089154",
"src": "http://img12.static.yhbimg.com/goodsimg/2015/04/08/04/02bea7e4264fb50b359d58b42d4a697d9c.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51099177",
"src": "http://img13.static.yhbimg.com/goodsimg/2015/04/23/08/02bbf846531154372380001c16ce7e02ed.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51084637",
"src": "http://img11.static.yhbimg.com/goodsimg/2015/01/27/18/014f3a8f45569be08e96d1cff644bcf0bf.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51006271",
"src": "http://img10.static.yhbimg.com/goodsimg/2014/07/09/05/015ca75647a5db9a58bae538a1212b0009.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51089332",
"src": "http://img12.static.yhbimg.com/goodsimg/2015/04/01/09/02f3fc94d79d86957d1ae3c43bf560c83a.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51082653",
"src": "http://img12.static.yhbimg.com/goodsimg/2015/04/10/06/02fecd43129f5322c4df29a723d62ed0af.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
},
{
"id": "51074098",
"src": "http://img11.static.yhbimg.com/goodsimg/2014/10/21/07/014a48606fdbbba5c834ccfdd1ef833e98.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90"
}
],
"template_intro": "添加商品",
"template_name": "goods"
}
}
],
"md5": "2bdb1055a60ba4663772544a157434dd",
"message": "get article content success"
}