Authored by htoooth

修改一些bug。

... ... @@ -32,9 +32,9 @@ const findByMobileAsync = (area, mobile) => {
*/
const findByEmailAsync = (email) => {
return api.get('', {
email: email,
method: 'app.passport.getProfileByEmail'
})
email: email,
method: 'app.passport.getProfileByEmail'
})
.then(result => {
if (!result.code || result.code !== 200 || !result.data || _.isEmpty(result.data)) {
return EMPTY;
... ... @@ -48,7 +48,15 @@ const findByEmailAsync = (email) => {
});
};
const getVipLevelAsync = (uid) => {
return api.get('', {
uid: uid,
method: 'app.passport.vip'
}, {code: 200}).then(result=> _.get(result, 'data', {}));
};
module.exports = {
findByMobileAsync,
findByEmailAsync
findByEmailAsync,
getVipLevelAsync
};
... ...
... ... @@ -22,7 +22,6 @@ class DetailAction extends YohoAction {
render() {
const req = this.request;
let vipLevel = 0;
let pid = req.params[0];
let gid = req.params[1];
let uid = req.user.uid || '';
... ... @@ -32,8 +31,7 @@ class DetailAction extends YohoAction {
gid: gid,
channel: this.getSessionChannel(),
gender: this.guessUserGender(),
uid: uid,
vipLevel: vipLevel
uid: uid
}).then(result=> {
const seo = result.seo;
... ...
... ... @@ -26,13 +26,15 @@ const searchAPI = require('./search-api');
const homeService = require('./home-service');
const HeaderModel = require('../../../doraemon/models/header');
const UserService = require('../../passport/models/user-service');
const BLANK_STR = ' ';
const cachedRequestData = {};
const _getProductAdditionInfoAsync = (data) => {
return co(function * () {
let productId = data.id;
let productId = data.id || 0;
let uid = data.uid ? data.uid : 0;
let skn = data.erpProductId;
let brandId = data.brand.id ? data.brand.id : 0;
... ... @@ -153,7 +155,7 @@ const _getVipDataByProductBaseInfo = (data, vipLevel, uid) => {
if (data.productPriceBo.vipPrices) {
if (vipLevel) {
data.productPriceBo.vipPrices.for(value => {
data.productPriceBo.vipPrices.forEach(value => {
vipData.prices.push({
level: value.vipLevel,
price: value.vipPrice,
... ... @@ -1341,10 +1343,12 @@ const _getSeoByGoodsInfo = function(goodsInfo, navs) {
/**
* 获取某一个商品详情主页面
*/
const showMainAsync = data => {
const showMainAsync = (data) => {
return co(function * () {
let vipLevel = yield UserService.getVipLevelAsync(data.uid);
let result = {};
let currentUserProductInfo = _.curry(_detailDataPkg)(_, data.uid, data.vipLevel);
let currentUserProductInfo = _.curry(_detailDataPkg)(_, data.uid, vipLevel);
// 获取商品信息
let productInfo = yield productAPI.getProductAsync(data.pid, data.uid).then(currentUserProductInfo);
... ...
... ... @@ -698,10 +698,10 @@ lazyLoad($('#details-html img'));
// 清空输入
$textarea.val('');
} else if (code === 403) {
} else if (code === 400) {
// 跳转登录页
location.href = data.data.url;
location.href = data.data.refer;
}
});
});
... ...