shop.js
762 Bytes
/**
* 店铺
*/
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
const api = global.yoho.API;
/**
* 店铺品牌列表
*/
const getShopBrands = (shopId) => {
return api.get('', {
method: 'app.shops.getShopsBrands',
shop_id: shopId
}, {code: 200}).then(result => {
if (result && result.data) {
_.forEach(result.data, value => {
value.url = helpers.urlFormat('', {
shop_id: shopId,
brand: value.brand_id,
title: value.brand_name
}, 'list');
});
return result.data;
} else {
return [];
}
});
};
module.exports = {
getShopBrands
};