index.js
4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/**
* Created by jing.li@yoho.cn.
* User: jing.li
* Date: 2016/9/5
* Time: 17:48
*/
'use strict';
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const singleAPI = global.yoho.SingleAPI;
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
/**
* 逛分类
*/
const _category = () => {
return serviceAPI.get('/guang/api/v1/category/get', {
}, {
code: 200
});
};
/**
* 逛内容列表
*/
const _article = (param) => {
return serviceAPI.get('/guang/api/v2/article/getList', {
gender: param.gender,
page: param.page || 1,
uid: param.uid,
udid: param.udid,
sort_id: param.type ? param.type : 1,
tag: param.tag ? param.tag : null,
author_id: param.authorId ? param.authorId : null,
limit: param.limit ? param.limit : null,
}, {
code: 200
}).then(result => {
return result;
});
};
/**
* 逛
* @param params
*/
const getArticle = (param) => {
let page = param.page ? param.page : 1;
Object.assign(param, { page: page });
return api.all([
_category(),
_article(param)
]).then(result => {
let resu = {
guang: {
infos: [{
show: true,
info: [{
'article_type': '1',
author: {
author_id: '8168296',
avatar: 'http://img10.static.yhbimg.com/author/2016/05/07/15/01bb3ae789c573502830726c3297d0c80a.png',
name: '雾萌萌',
url: 'http://guang.m.yohobuy.com/author/index?id=8168296'
},
'author_id': '8168296',
'category_id': '1',
'category_name': '话题',
'conver_image_type': '1',
'id': 34380,
text: '验证逛文章图片压缩测试验证逛文章图片压缩测试验证逛文章图片压缩测试',
'isFavor': 'N',
'isPraise': 'N',
'is_recommended': '1',
'praiseStatus': 'true',
'praise_num': '0',
publishTime: '09月02日 19:21',
'share': {
'url': 'http://guang.m.yohobuy.com/info/index?id=34380'
},
img: 'https://img13.static.yhbimg.com/article/2016/09/05/14/02d732942cdd9647465736cb79796b0ddd.jpg?imageView/2/w/640/h/640',
'title': '验证逛文章图片压缩测试',
'url': 'http://guang.m.yohobuy.com/info/index?id=34380',
pageView: '50'
}]
}],
navs: [{
typeId: '0',
type: '推荐',
focus: true
}, {
typeId: '1',
type: '话题'
}, {
typeId: '2',
type: '搭配'
}, {
typeId: '3',
type: '潮人'
}, {
typeId: '4',
type: '潮品'
}, {
typeId: '19',
type: '专题'
}],
swiper: [{
img: 'https://img11.static.yhbimg.com/yhb-img01/2016/09/01/10/017b5ce31285f9062469303ba9ca197660.jpg?imageView2/2/w/830/h/327',
url: 'http://feature.yoho.cn/0418RUNNINGMAN/index.html?title=兄弟在奔跑,潮流在有货&share_id=944'
}, {
img: 'https://img11.static.yhbimg.com/yhb-img01/2016/09/01/10/017b5ce31285f9062469303ba9ca197660.jpg?imageView2/2/w/830/h/327',
url: 'http://feature.yoho.cn/0418RUNNINGMAN/index.html?title=兄弟在奔跑,潮流在有货&share_id=944'
}]
}
};
return resu;
});
};
module.exports = {
getArticle
};