students.js
3.77 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
/**
* 学生营销数据处理
* @date: 2016-08-06 14:24:04
* @author: name<emial@yoho.cn>
*/
'use strict';
// const utils = '../../../utils';
// const logger = global.yoho.logger;
// const camelCase = global.yoho.camelCase;
const api = global.yoho.API;
const studentsApi = require('./students-api');
const stuHandler = require('./students-handler');
// const productProcess = require(`${utils}/product-process`);
// const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header');
const serviceApi = global.yoho.ServiceAPI;
// 学生营销资源码
const studentsCode = '989396a17443bf61e3e269702e51ef04'; // h5 a83b7d55324fb65f96c1f85a3387ebd8
/**
* 获取学生营销页面数据
* @params channel Object 频道
* @return name returnType 返回值描述
*/
exports.getStudentsData = (channel) => {
return api.all([
headerModel.requestHeaderData(channel),
serviceApi.get('operations/api/v5/resource/get', {content_code: studentsCode})
]).then(result => {
let responseData = {
module: 'product',
page: 'students',
// 头部数据
headerData: result[0],
footerTop: true
};
// 资源位数据
if (result[1].code === 200) {
Object.assign(responseData, stuHandler.studentResource(result[1].data));
}
return responseData;
});
};
/**
* 测试数据
*/
exports.getTestData = () => {
return {
module: 'product',
page: 'students',
headerData: {
Header: true,
headerType: 'boys'
},
footerTop: true,
mainBanner: {
list: [{src: 'http://img11.static.yhbimg.com/yhb-img01/2016/06/01/20/01a88a4e626a954eb5ec0302a0470e0b3f.jpg?imageView2/2/w/1920/h/450/q/70', url: 'http://www.yohobuy.com'}]
},
sortItem: [{title: '学生权益介绍'}, {title: '我要验证身份'}, {title: '学生热门单品'}, {title: '更多活动推荐'}],
proItem: [
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: '12'},
salesPrice: {round: 12},
forStu: true},
{url: '',
productName: 'Dickies 炫色小脚裤',
marketPrice: {round: 12.3},
salesPrice: {round: 12.3},
forStu: true}]
};
};
/**
* 获取学校地区数据
* @return Object 接口数据
*/
exports.getSchoolArea = () => {
return studentsApi.getArea().then(result => {
return result;
});
};
/**
* 根据地区码查询学校列表
* @params areaCode int 地区码
* @return Object 接口数据
*/
exports.getSchoolList = (areaCode) => {
return studentsApi.getSchool(areaCode).then(result => {
return result;
});
};