sale.js 1.38 KB
/*
 * @Author: Targaryen
 * @Date:   2016-05-19 10:20:08
 * @Last Modified by:   Targaryen
 * @Last Modified time: 2016-05-19 17:27:36
 */

'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const api = new API();

/**
 * 处理 sale 首页原始数据
 * @param  {Object} origin [原始数据]
 * @return {Object}        [结果]
 */
const handleSaleData = (origin) => {
    var dest = {};

    dest = origin;
    return dest;
};

/**
 * 处理商品列表数据
 * @param  {[type]} origin [description]
 * @return {[type]}        [description]
 */
const handleSaleGoodsListData = (origin) => {
    var dest = {};

    dest = origin;

    return dest;
};

/**
 * 获取首页数据
 * @return {[type]} [description]
 */
exports.getSaleDate = () => {
    return api.get('', sign.apiSign({
        method: 'app.activity.get',
        sort: 2,
        plateform: 2
    })).then(result => {

        return handleSaleData(result);
    });
};

/**
 * 获取商品列表数据
 * @return {[type]} [description]
 */
exports.getSaleGoodsListData = () => {

    return api.get('', sign.apiSign({
        method: 'app.search.sales',
        limit: 20,
        order: 's_t_desc',
        page: 1,
        productSize: '384x511',
        yh_channel: 1
    })).then(result => {
        return handleSaleGoodsListData(result);
    });
};