Authored by 毕凯

Merge remote-tracking branch 'origin/hotfix/error' into release/6.4

... ... @@ -10,7 +10,7 @@ const utils = '../../../utils';
const api = global.yoho.API;
const _ = require('lodash');
const camelCase = global.yoho.camelCase;
const decodeURIComponentExt = require(`${utils}/string-code`).decodeURIComponentExt;
const decodeURIComponentExt = require(`${utils}/string-process`).decodeURIComponent;
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ...
... ... @@ -5,7 +5,7 @@
const utils = '../../../utils';
const api = global.yoho.API;
const _ = require('lodash');
const decodeURIComponentExt = require(`${utils}/string-code`).decodeURIComponentExt;
const decodeURIComponentExt = require(`${utils}/string-process`).decodeURIComponent;
const exchange = {
// 获取 换货列表
... ...
... ... @@ -83,10 +83,10 @@ module.exports = class extends global.yoho.BaseModel {
summary: contents.summary,
tag: contents.tag,
syncTypeName: contents.syncTypeName || 'YOHO潮流志',
publishTime: contents.update_time && moment(contents.update_time * 1000).format('MM月DD HH:mm'),
publishTime: contents.update_time && moment.unix(contents.update_time).format('MM月DD HH:mm'),
};
let content = newsUtils.filterPhtml(
contents.content.replace(/www.yohobuy.com\/chanpin\//ig, 'm.yohobuy.com/chanpin/'),
_.get(contents, 'content', '').replace(/www.yohobuy.com\/chanpin\//ig, 'm.yohobuy.com/chanpin/'),
[
'阅读原文',
'点击这里',
... ...
... ... @@ -64,7 +64,8 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
return res.redirect(redirectTo);
});
} else {
return Promise.reject('missing third party login openId or nickname');
log.error(`missing third party login openId or nickname, url:${req.url}`);
return res.redirect(loginPage);
}
}
... ...
/**
* URL 重写(主要用于兼容原来PHP的连接)
*/
const stringProcess = require('./../../utils/string-process');
module.exports = () => {
return (req, res, next) => {
req.url = stringProcess.decodeURIComponent(req.url) || '/404';// 错误的网址编码重定向404
if (/^\/home\/orders\/paynew/.test(req.url)) {
// 支付中心,由于微信安全配置限制在 home/orders 路径下,需要转发,误删!!!
req.url = `/cart${req.url}`;
... ...
... ... @@ -44,7 +44,7 @@ class FamilyIndex extends Page {
downLoadInfo
};
this.vipInfo;
this.vipInfo = {};
this.init();
}
... ... @@ -313,14 +313,13 @@ class FamilyIndex extends Page {
let isLogin = $this.data('login');
let isNoOpen = $this.data('noopen');
if (isLogin && !isNoOpen) {
if (this.vipInfo[appType]) {
this.selector.$diaC.append(this.view.vipDetailInfo(this.vipInfo[appType]));
} else {
this.viewVipInfo();
if (!this.vipInfo || !this.vipInfo[appType]) {
this.viewVipInfo();
return false;
}
this.selector.$diaC.append(this.view.vipDetailInfo(this.vipInfo[appType]));
}
if (isLogin && !isNoOpen) {
this.selector.$diaC.append(this.view.vipDetailInfo(this.vipInfo[appType]));
$('.vip-detail').addClass(appType);
... ...
... ... @@ -15,7 +15,7 @@ module.exports = function() {
let _appId, _timestamp, _nonceStr, _signature;
if (!wx) {
if (typeof wx === 'undefined') {
return;
}
... ...
... ... @@ -14,20 +14,7 @@ const hexToUtf8 = (string) => {
return buf.toString('utf8');
};
const decodeURIComponentExt = (string) => {
try {
string = decodeURIComponent(string);
} catch (e) {
string = '';
console.error(`${string}, err: ${e.message}`);
}
return string;
};
module.exports = {
utf8ToHex,
hexToUtf8,
decodeURIComponentExt
hexToUtf8
};
... ...