outlets-api.js 1.83 KB
/*
 * @Author: Targaryen
 * @Date:   2016-06-01 14:37:03
 * @Last Modified by:   Targaryen
 * @Last Modified time: 2016-06-03 17:38:17
 */

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

/**
 * 获取奥莱活动列表接口
 * @param  {[int]} id 活动id 为空表示查询全部活动
 * @param  {[int ]} platform 活动平台 1--WEB,2--APP,3--WAP,4--IPAD
 * @param  {[int]} size 查询数量,默认查询全部
 * @param  {[int]} channel 频道: 1 || 2 || 3 || 4
 * @param  {[int]} type
 * @return {[type]} 0 活动列表,1 限时嗨购 2 即将结束 3.即将上线
 */
exports.getOutletsActivityOrigin = (params) => {
    return api.get('', sign.apiSign({
        method: 'app.outlets.activityGet',

        id: params.id || null,
        platform: params.platform || 1,
        size: params.size || 0,
        yh_channel: 1,
        type: params.type || 0
    }));
};

/**
 * 获取奥莱频道资源位数据
 * @param  {[object]} params
 * @return {[type]}
 */
exports.getChannelResouceData = (params) => {
    return serviceApi.get('operations/api/v5/resource/home', sign.apiSign(params));
};

/**
 * 获取奥莱潮品速递商品数据
 * @param  {[type]} params [description]
 * @return {[type]}        [description]
 */
exports.getOutletsTrendData = (params) => {
    return api.get('', sign.apiSign({
        method: 'app.search.trend',
        yh_channel: params.yh_channel || '1',
        order: params.order || 's_s_desc,s_n_desc',
        gender: params.gender || '1,3',
        stocknumber: 1, // 过滤出库存 > 1的商品
        limit: params.limit || 10,
        outlets: params.outlets || 1 // 默认取奥莱商品
    }));
};