material.js 1.08 KB
'use strict';

const platformApi = new global.yoho.ApiBase(global.yoho.config.domains.platformApi, {
    name: 'imCs',
    cache: global.yoho.cache,
    useCache: false
});
const api = global.yoho.API;

const canLogin = (uid) => {
    return platformApi.get('/platform/product/material/canlogin', {
        uid: uid
    }).then(result => {
        if (result && result.code === 200) {
            return result.data.canLogin;
        }
    });
};

const newBrandList = (req) => {
    let channel = req.query.yh_channel || 1;

    return api.get('', { method: 'app.brand.newBrandList', yh_channel: channel });
};

const getCategory = () => {
    return api.get('', {method: 'web.regular.groupsort'});
};

const getList = (params) => {
    return platformApi.get('/platform/product/material/getList', params, {
        code: 200
    });
};

const getRecommendlist = () => {
    return platformApi.get('/platform/product/material/getRecommendlist', {
        page: 1
    }, {
        code: 200
    });
};

module.exports = {
    canLogin,
    newBrandList,
    getCategory,
    getList,
    getRecommendlist
};