Authored by 郝肖肖

'个性化连接加is_red_shop参数和解码,不然iphone识别不了'

... ... @@ -4,6 +4,7 @@ const helpers = global.yoho.helpers;
const ROOTPATH = '../../../';
const contentCodeConfig = require(`${ROOTPATH}config/content-code`);
const productProcess = require(`${ROOTPATH}utils/product-process`);
const decodeURIComponent = require('../../../utils/string-process').decodeURIComponent;
class TideModel extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -21,7 +22,9 @@ class TideModel extends global.yoho.BaseModel {
resource: _.get(res[0], 'data', []),
contents: []
};
let sindex = _.findIndex(tide.resource, {template_name: 'image_list'});
let sindex = _.findIndex(tide.resource, {
template_name: 'image_list'
});
if (sindex > -1) {
tide.resource[sindex].title = '# 精彩活动 #';
... ... @@ -36,9 +39,9 @@ class TideModel extends global.yoho.BaseModel {
});
let tdata = {
sortInfo: Object.assign({}, item.sortInfo, {
url: helpers.urlFormat(`/list/mi${item.sortInfo.itemId}`, {
url: decodeURIComponent(helpers.urlFormat(`/list/mi${item.sortInfo.itemId}`, {
'openby:yohobuy': `{"action":"go.list","params":{"misort":"${item.sortInfo.itemId}"}}`
})
}))
}),
goods: goods
};
... ... @@ -109,7 +112,9 @@ class TideModel extends global.yoho.BaseModel {
shopInfo: [],
contents: []
};
let sindex = _.findIndex(tide.resource, {template_name: 'image_list'});
let sindex = _.findIndex(tide.resource, {
template_name: 'image_list'
});
if (sindex > -1) {
tide.resource[sindex].title = '# 精彩活动 #';
... ... @@ -118,9 +123,9 @@ class TideModel extends global.yoho.BaseModel {
let shopInfo = _.get(res[1], 'data.shopInfo', {});
if (shopInfo.shopId) {
shopInfo.url = helpers.urlFormat(`/shop/${shopInfo.shopDomain}-${shopInfo.shopId}.html`, {
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${shopInfo.shopId}","shop_template_type":"${shopInfo.shopTemplateType}","shop_name":"${shopInfo.shopName}"}}` //eslint-disable-line
});
shopInfo.url = decodeURIComponent(helpers.urlFormat(`/shop/${shopInfo.shopDomain}-${shopInfo.shopId}.html`, { //eslint-disable-line
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${shopInfo.shopId}","shop_template_type":"${shopInfo.shopTemplateType}","shop_name":"${shopInfo.shopName}","is_red_shop":${shopInfo.is_red_shop || 1}}}` //eslint-disable-line
}));
}
if (shopInfo.imageUrl || _.get(res[1], 'data.productList', []).length) {
... ... @@ -136,9 +141,9 @@ class TideModel extends global.yoho.BaseModel {
_.each(_.get(res[2], 'data', []), (item) => {
tide.brands.push(Object.assign({}, item, {
url: helpers.urlFormat(`/shop/${item.shopDomain}-${item.shopId}.html`, {
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${item.shopId}","shop_template_type":"${item.shopTemplateType}","shop_name":"${item.shopName}"}}` //eslint-disable-line
})
url: decodeURIComponent(helpers.urlFormat(`/shop/${item.shopDomain}-${item.shopId}.html`, { //eslint-disable-line
'openby:yohobuy': `{"action":"go.shop","params":{"shop_id":"${item.shopId}","shop_template_type":"${item.shopTemplateType}","shop_name":"${item.shopName}","is_red_shop":${item.is_red_shop || 1}}}` //eslint-disable-line
}))
}));
});
... ... @@ -163,7 +168,9 @@ class TideModel extends global.yoho.BaseModel {
platform: 'iphone'
}, params),
api: global.yoho.ServiceAPI,
param: {cache: true}
param: {
cache: true
}
}).then(result => {
return result;
});
... ...