...
|
...
|
@@ -10,7 +10,7 @@ const helpers = global.yoho.helpers; |
|
|
* @param {[string]} url [需要转换的url]
|
|
|
* @return {[string]} [description]
|
|
|
*/
|
|
|
const _transHttpsUrl = (url) => {
|
|
|
const transHttpsUrl = (url) => {
|
|
|
return url.replace(/^\/\//g, 'http://');
|
|
|
};
|
|
|
|
...
|
...
|
@@ -19,7 +19,7 @@ const _transHttpsUrl = (url) => { |
|
|
* @param {[string]} url [url地址]
|
|
|
* @return {[strng]}
|
|
|
*/
|
|
|
const _getFilterUrl = (url) => {
|
|
|
const getFilterUrl = (url) => {
|
|
|
url = url.replace('.m.yohobuy.com', global.yoho.config.subDomains.host).replace('www.yohobuy.com', global.yoho.config.siteUrl);
|
|
|
|
|
|
const whiteDomains = ['m.yohobuy.com', 'cdn.yoho.cn/myohobuy'];
|
...
|
...
|
@@ -31,7 +31,7 @@ const _getFilterUrl = (url) => { |
|
|
}
|
|
|
|
|
|
if (url.includes('feature.yoho.cn')) {
|
|
|
url = _transHttpsUrl(url);
|
|
|
url = transHttpsUrl(url);
|
|
|
}
|
|
|
if (url.includes('openby:yohobuy=')) {
|
|
|
let filters = ['openby:yohobuy=', '&', '?'];
|
...
|
...
|
@@ -55,7 +55,7 @@ const _getFilterUrl = (url) => { |
|
|
* @param {[string]} reqQueryString [查询字符串]
|
|
|
* @return {[array | false]}
|
|
|
*/
|
|
|
const _formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryString) => {
|
|
|
const formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQueryString) => {
|
|
|
// 资讯ID不存在,则不显示
|
|
|
if (!articleData.id) {
|
|
|
return false;
|
...
|
...
|
@@ -73,7 +73,7 @@ const _formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQuerySt |
|
|
|
|
|
if (result.url.includes('feature.yoho.cn') ||
|
|
|
result.url.includes('cdn.yoho.cn')) {
|
|
|
result.url = _transHttpsUrl(result.url);
|
|
|
result.url = transHttpsUrl(result.url);
|
|
|
}
|
|
|
|
|
|
// 收藏
|
...
|
...
|
@@ -104,7 +104,7 @@ const _formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQuerySt |
|
|
// 判断是否显示作者信息
|
|
|
if (showAuthor && articleData.author) {
|
|
|
if (!isApp) {
|
|
|
articleData.author.url = _getFilterUrl(articleData.author.url);
|
|
|
articleData.author.url = getFilterUrl(articleData.author.url);
|
|
|
}
|
|
|
|
|
|
// 编辑人员 app跳转url处理 20160601
|
...
|
...
|
@@ -148,7 +148,7 @@ const _formatArticle = (articleData, showTag, isApp, showAuthor, uid, reqQuerySt |
|
|
* @param {[int]} type [类型]
|
|
|
* @return {[type]}
|
|
|
*/
|
|
|
const _getProductIcon = (type) => {
|
|
|
const getProductIcon = (type) => {
|
|
|
const icons = {
|
|
|
1: 'cloth',
|
|
|
3: 'pants',
|
...
|
...
|
@@ -218,7 +218,7 @@ const _procProductImg = (images, gender) => { |
|
|
* @param int gender 性别
|
|
|
* @return array | false
|
|
|
*/
|
|
|
const _formatProduct = (productData, showTags, showNew, showSale, width, height, isApp, showPoint, gender) => {
|
|
|
const formatProduct = (productData, showTags, showNew, showSale, width, height, isApp, showPoint, gender) => {
|
|
|
// 商品信息有问题,则不显示
|
|
|
if (!productData.product_skn || !productData.goods_list[0]) {
|
|
|
return false;
|
...
|
...
|
@@ -306,9 +306,9 @@ const _formatProduct = (productData, showTags, showNew, showSale, width, height, |
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
formatArticle: _formatArticle,
|
|
|
transHttpsUrl: _transHttpsUrl,
|
|
|
getFilterUrl: _getFilterUrl,
|
|
|
formatProduct: _formatProduct,
|
|
|
getProductIcon: _getProductIcon
|
|
|
formatArticle,
|
|
|
transHttpsUrl,
|
|
|
getFilterUrl,
|
|
|
formatProduct,
|
|
|
getProductIcon
|
|
|
}; |
...
|
...
|
|