...
|
...
|
@@ -4,8 +4,6 @@ |
|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const api = global.yoho.API;
|
|
|
const singleAPI = global.yoho.SingleAPI;
|
|
|
const stringProcess = require(`${global.utils}/string-process`);
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -28,10 +26,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* 店铺品牌列表
|
|
|
*/
|
|
|
getShopBrands(shopId) {
|
|
|
return api.get('', {
|
|
|
method: 'app.shops.getShopsBrands',
|
|
|
shop_id: shopId
|
|
|
}, {code: 200}).then(result => {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.shops.getShopsBrands',
|
|
|
shop_id: shopId
|
|
|
},
|
|
|
api: global.yoho.API,
|
|
|
param: {code: 200}
|
|
|
}).then(result => {
|
|
|
if (result && result.data) {
|
|
|
_.forEach(result.data, value => {
|
|
|
value.url = helpers.urlFormat('', {
|
...
|
...
|
@@ -70,7 +72,10 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
|
|
|
return api.get('', finalParams);
|
|
|
return this.get({
|
|
|
data: finalParams,
|
|
|
api: global.yoho.API
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -79,11 +84,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @return array | false
|
|
|
*/
|
|
|
getBrandLogoByDomain(domain) {
|
|
|
return api.get('', {
|
|
|
method: 'web.brand.byDomain',
|
|
|
domain: domain
|
|
|
}, {
|
|
|
cache: true
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'web.brand.byDomain',
|
|
|
domain: domain
|
|
|
},
|
|
|
api: global.yoho.API,
|
|
|
param: {cache: true}
|
|
|
}).then(result => {
|
|
|
if (result && result.data) {
|
|
|
let formatData = result.data;
|
...
|
...
|
@@ -117,11 +124,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
|
|
|
return api.get('', _.assign({
|
|
|
method: 'app.brand.getBrandIntro',
|
|
|
brand_id: brandId
|
|
|
}, param), {
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'app.brand.getBrandIntro',
|
|
|
brand_id: brandId
|
|
|
}, param),
|
|
|
api: global.yoho.API,
|
|
|
param: {code: 200}
|
|
|
}).then(result => {
|
|
|
if (result && result.data) {
|
|
|
let list = result.data;
|
...
|
...
|
@@ -144,11 +153,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @return array banner数据
|
|
|
*/
|
|
|
getBrandBanner(brandId) {
|
|
|
return api.get('', {
|
|
|
method: 'app.brand.banner',
|
|
|
brand_id: brandId
|
|
|
}, {
|
|
|
cache: true
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.brand.banner',
|
|
|
brand_id: brandId
|
|
|
},
|
|
|
api: global.yoho.API,
|
|
|
param: {cache: true}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200 && result.data) {
|
|
|
if (result.data.banner) {
|
...
|
...
|
@@ -173,7 +184,11 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
shop_id: shopId
|
|
|
};
|
|
|
|
|
|
return api.get('', params, {cache: true, code: 200});
|
|
|
return this.get({
|
|
|
data: params,
|
|
|
api: global.yoho.API,
|
|
|
param: {cache: true, code: 200}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -188,7 +203,10 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
shop_id: shopId
|
|
|
};
|
|
|
|
|
|
return api.get('', params, {cache: true, code: 200});
|
|
|
return this.get({
|
|
|
data: params,
|
|
|
param: {cache: true, code: 200}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -198,10 +216,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @return array
|
|
|
*/
|
|
|
getShopCategory(shopId, channel) {
|
|
|
return api.get('', {
|
|
|
method: 'app.shop.getSortInfo',
|
|
|
yh_channel: yhChannel[channel],
|
|
|
shop_id: shopId
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.shop.getSortInfo',
|
|
|
yh_channel: yhChannel[channel],
|
|
|
shop_id: shopId
|
|
|
},
|
|
|
api: global.yoho.API
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -223,7 +244,10 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
});
|
|
|
}
|
|
|
|
|
|
return singleAPI.get('favorite', finalParams);
|
|
|
return this.get({
|
|
|
url: 'favorite',
|
|
|
data: finalParams
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -232,12 +256,15 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
* @return array
|
|
|
*/
|
|
|
getShopDecorator(shopId) {
|
|
|
return api.get('', {
|
|
|
method: 'app.shopsdecorator.getList',
|
|
|
shop_id: shopId
|
|
|
}, {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.shopsdecorator.getList',
|
|
|
shop_id: shopId
|
|
|
},
|
|
|
param: {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
return (result && result.data) || {};
|
|
|
});
|
...
|
...
|
|