Authored by ccbikai(👎🏻🍜)

Merge branch 'master' into release/5.4

... ... @@ -6,7 +6,7 @@ const helpers = global.yoho.helpers;
const crypto = global.yoho.crypto;
exports.index = (req, res) => {
let quhUnion = crypto.encryption('', decodeURI(req.query._QYH_UNION));
let quhUnion = encodeURIComponent(crypto.encryption('', decodeURIComponent(req.query._QYH_UNION)));
res.cookie('_QYH_UNION', quhUnion, {
domain: 'yohobuy.com',
... ...
... ... @@ -13,16 +13,16 @@ exports.productLst = function(req, res, next) {
} else if (req.query.brand) {
params.brand = req.query.brand;
}
if (req.query.enum) {
params.specified_sort = req.query.enum;
}
if (req.query.pd) {
params.p_d = req.query.pd;
}
if (req.query.limit) {
params.limit = req.query.limit;
}
model.productLst(params).then((result) => {
res.jsonp(result);
}).catch(next);
... ...
... ... @@ -94,7 +94,7 @@
{{/activities}}
<section class='s-section clearfix'>
<h1>学生专享商品<a class="more iconfont" href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{@root.http}}//search.m.yohobuy.com/','param':{'students':'1','title':'学生专享商品','uid':'{{uid}}'}}}">&#xe618;</a></h1>
<h1>学生专享商品<a class="more iconfont" href='//search.m.yohobuy.com/?students=1&title=学生专享商品&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"{{@root.http}}//search.m.yohobuy.com/","param":{"students":"1","title":"学生专享商品"}}}'>&#xe618;</a></h1>
<div class='goods-list clearfix'>
{{#each goods}}
<div class="good-info">
... ... @@ -139,7 +139,7 @@
</div>
{{/each}}
</div>
<a class='s-more' href="//search.m.yohobuy.com/?students=1&title=学生专享商品&uid={{uid}}{{#isApp}}&app_version={{@root.app_version}}{{/isApp}}?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{@root.http}}//search.m.yohobuy.com/','param':{'students':'1','title':'学生专享商品','uid':'{{uid}}'}}}">查看更多</a>
<a class='s-more' href='//search.m.yohobuy.com/?students=1&title=学生专享商品&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"{{@root.http}}//search.m.yohobuy.com/","param":{"students":"1","title":"学生专享商品"}}}'>查看更多</a>
</section>
{{#loginUrl}}
... ...
... ... @@ -76,6 +76,8 @@ const getBrandByChannel = (channel) => {
};
break;
default:
channel = 1;
break;
}
return _packageAd(params).then(result => {
... ...
... ... @@ -10,7 +10,6 @@ const optModel = require(`${mRoot}/opt`);
const brandModel = require(`${mRoot}/brand`);
const helpers = global.yoho.helpers;
const stringProcess = require(`${global.utils}/string-process`);
const crypto = global.yoho.crypto;
const _ = require('lodash');
/**
... ... @@ -113,7 +112,7 @@ const favoriteBrand = (req, res, next) => {
/* 判断参数是否有效 */
let id = req.body.id,
opt = req.body.opt || 'ok',
uid = req.user.uid || (req.body.uid && parseInt(crypto.decrypt(null, req.body.uid))) || req.cookies.appUid,
uid = req.user.uid || (req.body.uid && parseInt(req.body.uid, 10)) || req.cookies.appUid,
isBrand = req.body.isBrand;
if (!stringProcess.isNumeric(id) || !stringProcess.isNumeric(uid)) {
... ...
... ... @@ -6,12 +6,9 @@
'use strict';
const mRoot = '../models';
const express = require('express');
const app = express();
const plustarModel = require(`${mRoot}/plustar`);
const htmlProcess = require(`${global.utils}/html-process`);
const headerModel = require('../../../doraemon/models/header'); // 头部model
const crypto = global.yoho.crypto;
const _ = require('lodash');
let channels = {
... ... @@ -93,7 +90,7 @@ const getDetailData = (req, res, next) => {
if (isApp) {
if (req.query.uid) {
uid = crypto.encryption('', req.query.uid + '');
uid = req.query.uid;
}
} else {
uid = req.user.uid;
... ... @@ -140,7 +137,7 @@ const getDetailData = (req, res, next) => {
* [品牌详情异步数据]
*/
const getDetailDataAsync = (req, res, next) => {
let uid = req.user.uid;
let uid;
let udid = req.sessionID || 'yoho';
let clientType = req.body.client_type || '';
let brandId = req.body.brand_id || 0;
... ... @@ -148,8 +145,10 @@ const getDetailDataAsync = (req, res, next) => {
if (isApp) {
if (req.body.uid) {
uid = parseInt(crypto.decrypt(null, req.body.uid));
uid = parseInt(req.body.uid, 10);
}
} else {
uid = parseInt(req.user.uid, 10);
}
if (!brandId) {
... ... @@ -160,7 +159,7 @@ const getDetailDataAsync = (req, res, next) => {
isLike: result.isLike,
infos: result.infos
});
});
}).catch(next);
};
module.exports = {
... ...
... ... @@ -7,7 +7,6 @@ const _ = require('lodash');
const logger = global.yoho.logger;
const helpers = global.yoho.helpers;
const htmlProcess = require(`${global.utils}/html-process`);
const crypto = global.yoho.crypto;
const imageProcess = require(`${global.utils}/image`);
const privateKeyList = {
... ... @@ -314,7 +313,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
if (isApp) {
url = '?openby:yohobuy={"action":"go.brand","params":{"brand_id":"' + brandId + '","is_different":"' + isDifferent + '"}}';
uid = parseInt(crypto.decrypt(null, uid));
uid = parseInt(uid, 10);
} else {
url = '//' + brandDomain + '.m.yohobuy.com';
}
... ...
... ... @@ -8,8 +8,8 @@ exports.get = (req, res, next) => {
};
return imgCheckAPI.gen().then(result => {
if (result.code === 200) {
let codeStr = result.data.degrees.reduce((str, rotate) => {
if (result.code === 200 && result.data) {
let codeStr = result.data.degrees.reduce((str, rotate) => {
return str.concat((4 - rotate / 90 % 4) % 4);
}, '');
... ...
... ... @@ -285,7 +285,7 @@ const wechat = {
doPassportCallback(openId, nickname, 'wechat', req, res).catch(next);
})(req, res, next);
} else {
return next(new Error('Auth State Mismatch'));
return next('Auth State Mismatch');
}
}
};
... ... @@ -310,7 +310,7 @@ const sina = {
doPassportCallback(openId, nickname, 'sina', req, res).catch(next);
})(req, res, next);
} else {
return next(new Error('Auth State Mismatch'));
return next('Auth State Mismatch');
}
}
};
... ...
... ... @@ -20,7 +20,7 @@ const list = (req, res, next) => {
cartUrl: helpers.urlFormat('/cart/index/index')
}, req.query);
let title = '';
let query = decodeURIComponent(req.query.query);
let query = req.query.query;
let isQueryFirstClass = false; // 标识用户搜的是不是一级品类
let isQuerySecondClass = false; // 标识用户搜的是不是二级品类
let domain = null;
... ...
... ... @@ -145,7 +145,7 @@ let _getShopsInfo = (brandId) => {
}, {
cache: true
}).then(shops => {
if (shops.code === 200) {
if (shops && shops.code === 200) {
return _processShopsInfo(shops.data);
}
... ... @@ -160,7 +160,7 @@ let _getPromotionInfo = (skn) => {
}, {
cache: true
}).then((result) => {
if (result.code === 200) {
if (result && result.code === 200) {
return result.data;
}
... ... @@ -180,7 +180,7 @@ let _getFavorite = (productId, uid) => {
uid: uid,
id: productId
}).then((result) => {
if (result.code === 200) {
if (result && result.code === 200) {
return result.data;
}
... ... @@ -211,7 +211,7 @@ let getProductData = (data) => {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
if (!result || result.code === 500 || !result.data) {
return {};
}
result = result.data;
... ... @@ -418,7 +418,7 @@ const _cartCount = (uid, shoppingKey) => {
uid: uid,
shopping_key: shoppingKey
}).then((result) => {
if (result.code === 200) {
if (result && result.code === 200) {
var count = result.data.cart_goods_count || 0;
if (count > 99) {
... ... @@ -464,7 +464,7 @@ let getNewProductAsyncData = (data) => {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
if (!result || result.code === 500 || !result.data) {
return {};
}
result = result.data;
... ... @@ -556,7 +556,7 @@ let getProductAsyncData = (data) => {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
if (!result || result.code === 500 || !result.data) {
return {};
}
... ...
... ... @@ -117,7 +117,7 @@ const _getShopInfo = (shopId, uid) => {
shop_id: shopId,
uid: uid || 0
}, {code: 200}).then((result) => {
return result.data;
return result && result.data;
});
};
... ... @@ -131,7 +131,7 @@ const getShopIntro = (shopId, uid) => {
shop_id: shopId,
uid: uid
}, {code: 200}).then(result => {
return result.data;
return result && result.data;
});
};
... ... @@ -148,7 +148,7 @@ const _getShopCategory = (shopId, channel, gender) => {
gender: gender || '1,3',
shop_id: shopId
}, {code: 200, cache: true}).then(result => {
return result.data;
return result && result.data;
});
};
... ... @@ -711,7 +711,7 @@ const getBrandBanner = (brandId) => {
}, {
cache: true
}).then((result) => {
if (result && result.code === 200) {
if (result && result.code === 200 && result.data) {
if (result.data.banner) {
return helpers.image(result.data.banner, 640, 150);
} else {
... ... @@ -878,7 +878,7 @@ const shopCouponsList = (params) => {
let shopCoupons = [];
let couPonstatus;
if (result.data) {
if (result && result.data) {
_.forEach(result.data, value => {
couPonstatus = parseInt(value.status, 10);
... ... @@ -919,7 +919,7 @@ const brandCouponsList = (params) => {
let shopCoupons = [];
let couPonstatus;
if (result.data && result.data.coupons) {
if (result && result.data && result.data.coupons) {
_.forEach(result.data.coupons, value => {
couPonstatus = parseInt(value.status, 10);
... ...
... ... @@ -275,7 +275,7 @@ const newDetail = {
code: 200,
cache: true
}).then(result => {
if (result.code === 500 || !result.data) {
if (!result || result.code === 500 || !result.data) {
return {};
}
... ... @@ -359,7 +359,7 @@ const newDetail = {
return api.get('', params, cacheConf)
.then(result => {
if (result.code === 200) {
if (result && result.code === 200) {
return tool.processShopsInfo(result.data);
}
return [];
... ...
... ... @@ -158,6 +158,10 @@ const _searchGoods = (params) => {
params.app_type = 1;
}
if (params.students) {
method = 'app.student.discount';
}
return api.get('', _.assign({
method: method
}, params), {
... ...
... ... @@ -3,7 +3,8 @@ const _ = require('lodash');
// 黑名单参数
const BLACK_LIST = [
'client_secret',
'method'
'method',
'openby:yohobuy'
];
module.exports = () => {
... ...
... ... @@ -12,7 +12,7 @@
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.1.0/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.1.1/yas.js', '_yas'));
var _hmt = _hmt || [];
... ... @@ -56,7 +56,7 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.1.0', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '2.1.1', 'yohobuy_m', uid, '', '');
}
// 非登录状态,加载百度统计
... ...
... ... @@ -85,3 +85,7 @@
{{#if yhChannel}}
<input class="query-param" type="hidden" data-attr="yhChannel" value="{{yhChannel}}">
{{/if}}
{{#if students}}
<input class="query-param" type="hidden" data-attr="students" value="{{students}}">
{{/if}}
\ No newline at end of file
... ...
{
"name": "m-yohobuy-node",
"version": "5.3.12",
"version": "5.3.13",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -85,13 +85,16 @@ function setPassword() {
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_REGISTER_SUCCESS_L',
ud: window.getUid(),
param: JSON.stringify({
C_ID: window._ChannelVary[window.cookie('_Channel')] || 1,
UNION_TYPE: window.queryString.union_type || window.cookie('unionTypeYas') || false
})
}, true);
}
location.href = res.href;
setTimeout(function() {
location.href = res.href;
}, 1500);
} else {
showErrTip(data.message);
}
... ...
... ... @@ -97,7 +97,8 @@ $btnNext.on('touchstart', function() {
data: {
areaCode: areaCode.replace('+', ''),
phoneNum: pn,
captcha: captcha
captcha: captcha,
yohobuy: $('#yohobuy').val()
},
success: function(data) {
if (data.code === 200) {
... ...
... ... @@ -8,8 +8,7 @@ var $ = require('yoho-jquery'),
security = require('../../plugin/security'),
tip = require('../../plugin/tip'),
Hammer = require('yoho-hammer'),
dialog = require('../../plugin/dialog'),
Swiper = require('yoho-swiper');
dialog = require('../../plugin/dialog');
var $input = $('#search-input input');
... ... @@ -30,7 +29,7 @@ var writeSearch = require('./write-search');
var ranToken = writeSearch.getRanToken();
var historyval = writeSearch.getHistoryval();
var chHammer, cHammer, navSwiper;
var chHammer, cHammer;
var C_ID, POS_ID, FLR_INDEX, prdLoad, querys, prdids = [];
... ... @@ -212,8 +211,9 @@ $('.search-items .search-group').on('click', 'li', function(event) {
$('.hot-term').on('click', function(event) {
var Hotquery = '';
POS_ID = 2;
FLR_INDEX = 2;
POS_ID = 2;
FLR_INDEX = 2;
if (event.target.nodeName === 'A') {
Hotquery = $(event.target).html();
... ... @@ -236,7 +236,7 @@ $('.hot-term').on('click', function(event) {
}
goSearch(Hotquery);
})
});
inputAction();
... ...
... ... @@ -37,7 +37,7 @@ var $input = $('#search-input input'),
$buriedpoint = $('.buriedpoint'),
$search = $('#search');
var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version;
var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students;
var size, color, style, standard, gender, price, p_d, query, limited, specialoffer, specialsale_id, promotion;
... ... @@ -245,6 +245,7 @@ limited = getQueryString('limited');
specialoffer = getQueryString('specialoffer');
specialsale_id = getQueryString('specialsale_id');
promotion = getQueryString('promotion');
students = getQueryString('students');
if ($fsgc.children().length > 0) {
var fsgcgoods = [],
... ... @@ -505,6 +506,10 @@ function search(opt) {
params.promotion = promotion;
}
if (students) {
params.students = students;
}
if (firstScreen) {
// 如果首屏加载了,则去掉12条记录
params.start = 12;
... ...