...
|
...
|
@@ -7,14 +7,33 @@ |
|
|
const library = '../../../library';
|
|
|
const API = require(`${library}/api`).API;
|
|
|
const sign = require(`${library}/sign`);
|
|
|
const _ = require('lodash');
|
|
|
const camelCase = require(`${library}/camel-case`);
|
|
|
const api = new API();
|
|
|
|
|
|
/**
|
|
|
* 折扣专场跳转链接处理
|
|
|
*/
|
|
|
const processSpecial = (list) => {
|
|
|
const formatData = [];
|
|
|
|
|
|
list = list || [];
|
|
|
list = camelCase(list);
|
|
|
|
|
|
_.forEach(list, (data) => {
|
|
|
data.specialUrl = `/product/specialDetail?id=${data.id}`;
|
|
|
formatData.push(data);
|
|
|
});
|
|
|
|
|
|
return formatData;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取首页数据
|
|
|
* @param {[object]} params
|
|
|
* @return {[object]}
|
|
|
*/
|
|
|
exports.getSaleDate = (params) => {
|
|
|
exports.getSaleData = (params) => {
|
|
|
|
|
|
return api.get('', sign.apiSign(Object.assign({
|
|
|
method: 'app.search.sales'
|
...
|
...
|
@@ -26,7 +45,8 @@ exports.getSaleDate = (params) => { |
|
|
* @param {[object]} params
|
|
|
* @return {[object]}
|
|
|
*/
|
|
|
exports.getSpecialDate = (params) => {
|
|
|
exports.getSpecialData = (params) => {
|
|
|
const specialData = {};
|
|
|
|
|
|
return api.get('', sign.apiSign(Object.assign({
|
|
|
method: 'app.activity.get',
|
...
|
...
|
@@ -34,7 +54,10 @@ exports.getSpecialDate = (params) => { |
|
|
plateform: 2
|
|
|
}, params))).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result;
|
|
|
specialData.data = processSpecial(result.data);
|
|
|
return specialData;
|
|
|
|
|
|
// return camelCase(result);
|
|
|
} else {
|
|
|
return Promise.reject('error');
|
|
|
}
|
...
|
...
|
@@ -42,3 +65,22 @@ exports.getSpecialDate = (params) => { |
|
|
};
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 获取折扣专场专题详情数据
|
|
|
* @param {[object]} params
|
|
|
* @return {[object]}
|
|
|
*/
|
|
|
exports.getSpecialDetailData = (params) => {
|
|
|
return api.get('', sign.apiSign(Object.assign({
|
|
|
method: 'app.activity.get',
|
|
|
sort: 2,
|
|
|
plateform: 2
|
|
|
}, params))).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return camelCase(result.data);
|
|
|
} else {
|
|
|
return Promise.reject('error');
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|