Authored by 郭成尧

Merge branch 'master' into feature/shopseo

@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
  8 +if (process.env.USE_APM === '1' && process.env.NODE_ENV === 'production') {
  9 + require('oneapm');
  10 +}
  11 +
8 const config = require('./config/common'); 12 const config = require('./config/common');
9 13
10 global.Promise = require('bluebird'); 14 global.Promise = require('bluebird');
@@ -76,7 +80,7 @@ app.use(session({ @@ -76,7 +80,7 @@ app.use(session({
76 app.use((req, res, next) => { 80 app.use((req, res, next) => {
77 req.user = {}; // 全局的用户数据 81 req.user = {}; // 全局的用户数据
78 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等 82 req.yoho = {}; // req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
79 - req.app.locals.wap = app.locals.wap; //zookeper对象赋值 83 + req.app.locals.wap = app.locals.wap; // zookeper对象赋值
80 if (!req.session.id) { 84 if (!req.session.id) {
81 req.session.id = uuid.v4(); 85 req.session.id = uuid.v4();
82 } 86 }
  1 +/**
  2 + * Created by yoho on 2016/11/8.
  3 + */
  4 +'use strict';
  5 +const helpers = global.yoho.helpers;
  6 +const crypto = global.yoho.crypto;
  7 +
  8 +exports.index = (req, res) => {
  9 + let quhUnion = crypto.encryption('', decodeURI(req.query._QYH_UNION));
  10 +
  11 + res.cookie('_QYH_UNION', quhUnion, {
  12 + domain: 'yohobuy.com',
  13 + expires: new Date(Date.now() + 24 * 60 * 60 * 1000)
  14 + });
  15 +
  16 + return res.redirect(req.query.target || helpers.urlFormat('/'));
  17 +};
  1 +/**
  2 + * sub app coupon
  3 + * @author: lixia.zhang<lixia.zhang@yoho.cn>
  4 + * @date: 2016/05/31
  5 + */
  6 +
  7 +var express = require('express'),
  8 + path = require('path'),
  9 + helpers = require(path.join(global.utils, 'helpers'));
  10 +
  11 +var app = express();
  12 +
  13 +// set view engin
  14 +var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root
  15 +
  16 +app.on('mount', function(parent) {
  17 + delete parent.locals.settings; // 不继承父 App 的设置
  18 + Object.assign(app.locals, parent.locals);
  19 +});
  20 +app.use(global.yoho.hbs({
  21 + extname: '.hbs',
  22 + defaultLayout: 'layout',
  23 + layoutsDir: doraemon,
  24 + partialsDir: path.join(__dirname, 'views/partial'),
  25 + views: path.join(__dirname, 'views/action'),
  26 + helpers: Object.assign({}, global.yoho.helpers, helpers)
  27 +}));
  28 +
  29 +// router
  30 +app.use(require('./router'));
  31 +
  32 +module.exports = app;
  1 +/**
  2 + * router of sub app coupon
  3 + * @author: lixia.zhang<lixia.zhang@yoho.cn>
  4 + * @date: 2016/05/31
  5 + */
  6 +
  7 +'use strict';
  8 +
  9 +const router = require('express').Router(); // eslint-disable-line
  10 +const cRoot = './controllers';
  11 +const ads = require(`${cRoot}/ads`);
  12 +
  13 +// routers
  14 +
  15 +router.get('/ads', ads.index);
  16 +
  17 +module.exports = router;
@@ -7,8 +7,7 @@ const couponModel = require(`${mRoot}/coupon`); // 领取优惠券 model @@ -7,8 +7,7 @@ const couponModel = require(`${mRoot}/coupon`); // 领取优惠券 model
7 exports.index = (req, res, next) => { 7 exports.index = (req, res, next) => {
8 var renderData = { 8 var renderData = {
9 module: 'activity', 9 module: 'activity',
10 - page: 'coupon',  
11 - appDownLoadLink: 'http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho' 10 + page: 'coupon'
12 }, 11 },
13 ordercode = req.query.ordercode, 12 ordercode = req.query.ordercode,
14 uid = req.query.uid, 13 uid = req.query.uid,
@@ -28,7 +27,6 @@ exports.index = (req, res, next) => { @@ -28,7 +27,6 @@ exports.index = (req, res, next) => {
28 // 获取信息成功 27 // 获取信息成功
29 couponData.ordercode = ordercode; 28 couponData.ordercode = ordercode;
30 } 29 }
31 - couponData.appDownLoadLink = renderData.appDownLoadLink;  
32 res.render('coupon', { 30 res.render('coupon', {
33 result: couponData, 31 result: couponData,
34 module: 'activity', 32 module: 'activity',
@@ -61,6 +59,7 @@ exports.getCoupon = (req, res, next) => { @@ -61,6 +59,7 @@ exports.getCoupon = (req, res, next) => {
61 // 获取信息成功 59 // 获取信息成功
62 couponData.ordercode = ordercode; 60 couponData.ordercode = ordercode;
63 } 61 }
  62 +
64 // console.log(couponData); 63 // console.log(couponData);
65 res.json({ 64 res.json({
66 result: couponData 65 result: couponData
@@ -94,6 +93,7 @@ exports.verify = (req, res, next) => { @@ -94,6 +93,7 @@ exports.verify = (req, res, next) => {
94 // 获取信息成功 93 // 获取信息成功
95 couponData.ordercode = ordercode; 94 couponData.ordercode = ordercode;
96 } 95 }
  96 +
97 // console.log(couponData); 97 // console.log(couponData);
98 res.json({ 98 res.json({
99 result: couponData 99 result: couponData
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 'use strict'; 7 'use strict';
8 8
9 const indexModel = require('../models/market'); 9 const indexModel = require('../models/market');
  10 +const _ = require('lodash');
10 11
11 exports.index = (req, res, next) => { 12 exports.index = (req, res, next) => {
12 13
@@ -21,3 +22,26 @@ exports.index = (req, res, next) => { @@ -21,3 +22,26 @@ exports.index = (req, res, next) => {
21 }).catch(next); 22 }).catch(next);
22 23
23 }; 24 };
  25 +
  26 +/**
  27 + * 市场推广活动升级版,自定义下载渠道
  28 + * @param req
  29 + * @param res
  30 + * @param next
  31 + */
  32 +exports.v2 = (req, res, next) => {
  33 +
  34 + indexModel.index({
  35 +
  36 + }).then((result) => {
  37 + if (_.has(result, 'download[0].url') && req.query.union_type) {
  38 + result.download[0].url = result.download[0].url.split('?')[0] +
  39 + '?union_type=' + req.query.union_type;
  40 + }
  41 + res.render('market/market', Object.assign(result, {
  42 + title: 'Yoho!Buy 有货'
  43 + }));
  44 +
  45 + }).catch(next);
  46 +
  47 +};
@@ -12,3 +12,27 @@ exports.wechatShare = (req, res, next) => { @@ -12,3 +12,27 @@ exports.wechatShare = (req, res, next) => {
12 res.jsonp(result); 12 res.jsonp(result);
13 }).catch(next); 13 }).catch(next);
14 }; 14 };
  15 +
  16 +/**
  17 + * 活动页<http://feature.yoho.cn/1101/1101ITEMBOY/index.html?title=%E7%94%B7%E7%94%9F%E5%88%86%E4%BC%9A%E5%9C%BA&share_id=814&mkt_code=1011111#a_01>
  18 + * <xiaoxiao.hao@yoho.cn>
  19 + * 2016/07/13
  20 + */
  21 +
  22 +// 活动页保存相应cookie的值
  23 +exports.feature = (req, res) => {
  24 + let mktCode = req.query.mkt_code || false;
  25 +
  26 + // 下载浮层,下载按钮会用到该参数
  27 + if (mktCode) {
  28 + res.cookie('mkt_code', mktCode, {
  29 + domain: '.yohobuy.com',
  30 + path: '/'
  31 + });
  32 + res.cookie('unionTypeYas', mktCode, {
  33 + path: '/'
  34 + });
  35 + }
  36 +
  37 + res.json({mktCode: mktCode});
  38 +};
@@ -17,18 +17,21 @@ const getPageInfo = (pageInfo) => { @@ -17,18 +17,21 @@ const getPageInfo = (pageInfo) => {
17 dest.activityID = pageInfo.id; 17 dest.activityID = pageInfo.id;
18 dest.title = pageInfo.data.h5Title; 18 dest.title = pageInfo.data.h5Title;
19 dest.activityDesc = pageInfo.data.activityDesc; 19 dest.activityDesc = pageInfo.data.activityDesc;
  20 + dest.formatActivityDesc = pageInfo.data.formatActivityDesc;
20 dest.couponPic = pageInfo.data.couponPic; 21 dest.couponPic = pageInfo.data.couponPic;
21 dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic; 22 dest.oldUserCouponPic = pageInfo.data.oldUserCouponPic;
22 dest.mobile = pageInfo.data.mobile; 23 dest.mobile = pageInfo.data.mobile;
23 dest.wechatShare = true; 24 dest.wechatShare = true;
  25 + dest.secondScreenPic = pageInfo.data.secondScreenPic;
  26 + dest.activityEndPic = pageInfo.data.activityEndPic;
  27 + dest.buttonLink = pageInfo.data.buttonLink;
24 28
25 - // 强制活动开始,活动上线产品要求这样设置  
26 - pageInfo.data.flag = 1;  
27 - if (pageInfo.data.flag === 1) {  
28 - dest.bgImg = pageInfo.data.activityNormalPic;  
29 - } else { 29 + if (pageInfo.data.flag === 3 || pageInfo.data.flag === 4 || pageInfo.data.flag === 5) {
  30 + // flag为3 表示活动结束 , 4 表示未开始
30 dest.bgImg = pageInfo.data.activityEndPic; 31 dest.bgImg = pageInfo.data.activityEndPic;
31 dest.ended = true; 32 dest.ended = true;
  33 + } else {
  34 + dest.bgImg = pageInfo.data.activityNormalPic;
32 } 35 }
33 dest.message = pageInfo.data.returnMsg; 36 dest.message = pageInfo.data.returnMsg;
34 } 37 }
@@ -91,7 +94,7 @@ exports.getCoupon = (data) => { @@ -91,7 +94,7 @@ exports.getCoupon = (data) => {
91 method: 'wap.order.drawOrderShareCoupon' 94 method: 'wap.order.drawOrderShareCoupon'
92 }, 95 },
93 96
94 - // 处理完成后,发给后端 97 + // 处理完成后,发给后端
95 phoneData = Object.assign(defaultParam, data); 98 phoneData = Object.assign(defaultParam, data);
96 99
97 return api.get('', phoneData).then(result => { 100 return api.get('', phoneData).then(result => {
@@ -108,10 +111,10 @@ exports.registerAndSendCoupon = (data) => { @@ -108,10 +111,10 @@ exports.registerAndSendCoupon = (data) => {
108 method: 'wap.order.registerAndSendCoupon' 111 method: 'wap.order.registerAndSendCoupon'
109 }, 112 },
110 113
111 - // 处理完成后,发给后端 114 + // 处理完成后,发给后端
112 verifyData = Object.assign(defaultParam, data); 115 verifyData = Object.assign(defaultParam, data);
113 116
114 return api.get('', verifyData).then(result => { 117 return api.get('', verifyData).then(result => {
115 return getUserStatus(result); 118 return getUserStatus(result);
116 - }); // 所有数据返回一个 Promise,方便 Promise.all 调用 119 + }); // 所有数据返回一个 Promise,方便 Promise.all 调用
117 }; 120 };
@@ -71,6 +71,7 @@ router.get('/invite', invite.checkType, invite.index); @@ -71,6 +71,7 @@ router.get('/invite', invite.checkType, invite.index);
71 router.get('/invite/index', invite.checkType, invite.index); 71 router.get('/invite/index', invite.checkType, invite.index);
72 72
73 router.get('/market', market.index); // 市场推广活动 73 router.get('/market', market.index); // 市场推广活动
  74 +router.get('/market/v2', market.v2); // 市场推广活动升级版,自定义下载渠道
74 75
75 router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share); 76 router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share);
76 77
@@ -116,4 +117,7 @@ router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck) @@ -116,4 +117,7 @@ router.get('/vip-day1028/crazy-luck', vipDay1028.beforeIn, vipDay1028.crazyLuck)
116 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin); 117 router.post('/vip-day1028/signin.json', vipDay1028.beforeIn, vipDay1028.signin);
117 router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent); 118 router.post('/vip-day1028/isStudent', vipDay1028.beforeIn, vipDay1028.checkIsStudent);
118 119
  120 +// 获取活动页传来的参数
  121 +router.get('/wechat/1111', wechat.feature);
  122 +
119 module.exports = router; 123 module.exports = router;
@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 <div class="receive-coupon-page"> 2 <div class="receive-coupon-page">
3 <div class="bg-contain"> 3 <div class="bg-contain">
4 <img src="{{image bgImg 640 1136}}"> 4 <img src="{{image bgImg 640 1136}}">
  5 + {{#if secondScreenPic}}
  6 + <img src="{{image secondScreenPic}}">
  7 + {{/if}}
5 </div> 8 </div>
6 <p class="hidden" id="orderCode">{{ordercode}}</p> 9 <p class="hidden" id="orderCode">{{ordercode}}</p>
7 <p class="hidden" id="oldUserCouponPic">{{image oldUserCouponPic}}</p> 10 <p class="hidden" id="oldUserCouponPic">{{image oldUserCouponPic}}</p>
@@ -24,7 +27,7 @@ @@ -24,7 +27,7 @@
24 <p>登录Yoho!Buy有货客户端即可使用</p> 27 <p>登录Yoho!Buy有货客户端即可使用</p>
25 28
26 <div class="use-coupon-btn"> 29 <div class="use-coupon-btn">
27 - <a href="{{appDownLoadLink}}">马上去Yoho!Buy有货使用</a> 30 + <a href="{{buttonLink}}">马上去Yoho!Buy有货使用</a>
28 </div> 31 </div>
29 <span class="description"></span> 32 <span class="description"></span>
30 </div> 33 </div>
@@ -57,6 +60,7 @@ @@ -57,6 +60,7 @@
57 </div> 60 </div>
58 61
59 <div class="tip-wrap hidden"> 62 <div class="tip-wrap hidden">
  63 + <img src="{{image activityEndPic 640 1136}}">
60 <div class="tip fail"> 64 <div class="tip fail">
61 <div class="header"> 65 <div class="header">
62 </div> 66 </div>
@@ -78,7 +82,12 @@ @@ -78,7 +82,12 @@
78 <div class="mask hidden"></div> 82 <div class="mask hidden"></div>
79 <div class="dialog hidden" id="message"> 83 <div class="dialog hidden" id="message">
80 <span class="close"></span> 84 <span class="close"></span>
81 - {{{activityDesc}}} 85 + <div class="activity-message">
  86 + <h3>活动说明</h3>
  87 + <div class="message">
  88 + {{{formatActivityDesc}}}
  89 + </div>
  90 + </div>
82 </div> 91 </div>
83 92
84 93
@@ -60,13 +60,14 @@ exports.ensure = (req, res, next) => { @@ -60,13 +60,14 @@ exports.ensure = (req, res, next) => {
60 let view; 60 let view;
61 61
62 if (paymentInfo.code !== 200) { 62 if (paymentInfo.code !== 200) {
63 - if (paymentInfo.message) {  
64 - view = {  
65 - orderEnsure: false,  
66 - message: paymentInfo.message  
67 - };  
68 - } else {  
69 - return Promise.reject(paymentInfo); 63 + view = {
  64 + orderEnsure: false,
  65 + message: paymentInfo.message
  66 + };
  67 +
  68 + // hotfix: nginx 接口限流, code:9999991时没message 信息
  69 + if (!view.message) {
  70 + view.message = '挤爆啦,系统繁忙';
70 } 71 }
71 } else { 72 } else {
72 // 渲染 73 // 渲染
@@ -12,10 +12,6 @@ @@ -12,10 +12,6 @@
12 {{/if}} 12 {{/if}}
13 <!--/tab-nav--> 13 <!--/tab-nav-->
14 14
15 - {{#if isApp}}  
16 - <div class='empty-height'></div>  
17 - {{/if}}  
18 -  
19 <div class="plusstar-resources"> 15 <div class="plusstar-resources">
20 <!--资源位数据模板--> 16 <!--资源位数据模板-->
21 </div><!--/plusstar-resources--> 17 </div><!--/plusstar-resources-->
@@ -55,7 +55,8 @@ const _reviewStatus = (res, req, uid, status) => { @@ -55,7 +55,8 @@ const _reviewStatus = (res, req, uid, status) => {
55 55
56 } else if (status === '3') { 56 } else if (status === '3') {
57 return { 57 return {
58 - error: true 58 + error: true,
  59 + failReason: '姓名、身份证、银行卡不匹配'
59 }; 60 };
60 } else if (status === '4') { 61 } else if (status === '4') {
61 return { 62 return {
@@ -63,6 +64,11 @@ const _reviewStatus = (res, req, uid, status) => { @@ -63,6 +64,11 @@ const _reviewStatus = (res, req, uid, status) => {
63 url: jumpUrl 64 url: jumpUrl
64 } 65 }
65 }; 66 };
  67 + } else if (status === '5') {
  68 + return {
  69 + error: true,
  70 + failReason: '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。'
  71 + };
66 } 72 }
67 }; 73 };
68 74
@@ -136,7 +142,7 @@ const index = (req, res) => { @@ -136,7 +142,7 @@ const index = (req, res) => {
136 142
137 return params; 143 return params;
138 }); 144 });
139 - } else if (openStatus === '1' || openStatus === '3' || openStatus === '4') { 145 + } else if (openStatus === '1' || openStatus === '3' || openStatus === '4' || openStatus === '5') {
140 res.redirect('/home/installment/review?status=' + openStatus); 146 res.redirect('/home/installment/review?status=' + openStatus);
141 } 147 }
142 }).then((result) => { 148 }).then((result) => {
@@ -326,6 +332,7 @@ const startingService = (req, res) => { @@ -326,6 +332,7 @@ const startingService = (req, res) => {
326 page: 'installment.starting-service', 332 page: 'installment.starting-service',
327 title: '开通有货分期', 333 title: '开通有货分期',
328 navTitle: '开通有货分期', 334 navTitle: '开通有货分期',
  335 + isInstallmentPage: true,
329 navBtn: false, 336 navBtn: false,
330 banks: banks.join('、') 337 banks: banks.join('、')
331 }); 338 });
@@ -290,7 +290,7 @@ const orderDetailData = (uid, orderCode) => { @@ -290,7 +290,7 @@ const orderDetailData = (uid, orderCode) => {
290 } 290 }
291 291
292 if (orderDetail.invoice) { 292 if (orderDetail.invoice) {
293 - orderDetail.invoice.type = orderDetail.invoice.type === '2'; 293 + orderDetail.invoice.type = (orderDetail.invoice.type + '' === '2');
294 } 294 }
295 295
296 // 取消订单原因列表 296 // 取消订单原因列表
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 <div class="error"> 22 <div class="error">
23 <i class="error-icon"></i> 23 <i class="error-icon"></i>
24 <p class="error-txt1">审核未通过暂时无法授信</p> 24 <p class="error-txt1">审核未通过暂时无法授信</p>
25 - <p class="error-txt2">可能原因:姓名、身份证、银行卡不匹配</p> 25 + <p class="error-txt2">可能原因:{{failReason}}</p>
26 <a href="/home/installment/starting-service" class="open-btn">重新申请</a> 26 <a href="/home/installment/starting-service" class="open-btn">重新申请</a>
27 </div> 27 </div>
28 {{/ error}} 28 {{/ error}}
@@ -140,7 +140,7 @@ const _shop = (req, res, shopId) => { @@ -140,7 +140,7 @@ const _shop = (req, res, shopId) => {
140 _.forEach(result.hotList, (value, key) => { 140 _.forEach(result.hotList, (value, key) => {
141 result.hotList[key].tags = {}; 141 result.hotList[key].tags = {};
142 result.hotList[key].is_soon_sold_out = false; 142 result.hotList[key].is_soon_sold_out = false;
143 - result.hotList[key].tags.isHot = true; 143 + result.hotList[key].tags.is_hot = true;
144 }); 144 });
145 145
146 // 有领券功能,不缓存 146 // 有领券功能,不缓存
@@ -503,6 +503,9 @@ const userCoupon = (req, res, next) => { @@ -503,6 +503,9 @@ const userCoupon = (req, res, next) => {
503 } 503 }
504 } 504 }
505 505
  506 + cryptCouponId = parseInt(cryptCouponId, 10);
  507 + uid = parseInt(uid, 10);
  508 +
506 if (uid) { 509 if (uid) {
507 listModel.receiveCoupon( 510 listModel.receiveCoupon(
508 uid, 511 uid,
@@ -25,106 +25,107 @@ const list = (req, res, next) => { @@ -25,106 +25,107 @@ const list = (req, res, next) => {
25 let isQuerySecondClass = false; // 标识用户搜的是不是二级品类 25 let isQuerySecondClass = false; // 标识用户搜的是不是二级品类
26 let domain = null; 26 let domain = null;
27 27
28 - if (params.query) {  
29 - let activity = _.get(searchModel.searchKeyActivity(params.query), 'data.urlobj.appUrl', '');  
30 -  
31 - if (activity) {  
32 - res.redirect(activity);  
33 - }  
34 - }  
35 -  
36 if (params.shop_id) { 28 if (params.shop_id) {
37 params.shopId = params.shop_id; 29 params.shopId = params.shop_id;
38 } 30 }
39 31
40 - /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */  
41 - Promise.all([  
42 - searchModel.getAllBrandNames(),  
43 - searchModel.getClassNames()  
44 - ]).then(result => {  
45 - if (query) {  
46 - query = query.toLowerCase();  
47 - _.forEach(result[0], obj => {  
48 -  
49 - if (query === obj.brandDomain) { // 精确查品牌域名  
50 - domain = query;  
51 - return false;  
52 - }  
53 -  
54 - if (query === obj.brandName || query === obj.brandName || query === obj.brandName) { // 精确查品牌名称  
55 - domain = obj.brandDomain;  
56 - return false;  
57 - }  
58 -  
59 - // if (obj.brandDomain.indexOf(query) > 0) { // 模糊查品牌域名  
60 - // domain = obj.brandDomain;  
61 - // return false;  
62 - // }  
63 - });  
64 -  
65 - // 跳转到品牌商品列表页  
66 - if (domain !== null && !params.shop_id) {  
67 - let url = helpers.urlFormat('', {  
68 - from: 'search',  
69 - query: query  
70 -  
71 - }, domain);  
72 -  
73 - return res.redirect(url);  
74 - } 32 + return searchModel.searchKeyActivity(params.query || '').then(activityResult => {
  33 + let activity = _.get(activityResult, 'urlobj.appUrl', '');
75 34
76 - // 品类名称为空时跳出  
77 - if (!result[1]) {  
78 - return;  
79 - } 35 + if (activity) {
  36 + return res.redirect(activity);
  37 + } else {
80 38
81 - _.forEach(result[1].first, (obj) => {  
82 - // 精确查一级品类  
83 - if (obj === query) {  
84 - isQueryFirstClass = true;  
85 - return false; 39 + /* 判断是不是品牌, 是品牌跳到品牌列表页(显示搜索框),判断是不是品类, 是品类加导航标题(不显示搜索框) */
  40 + return Promise.all([
  41 + searchModel.getAllBrandNames(),
  42 + searchModel.getClassNames()
  43 + ]).then(result => {
  44 + if (query) {
  45 + query = query.toLowerCase();
  46 + _.forEach(result[0], obj => {
  47 +
  48 + if (query === obj.brandDomain) { // 精确查品牌域名
  49 + domain = query;
  50 + return false;
  51 + }
  52 +
  53 + if (query === obj.brandName || query === obj.brandName || query === obj.brandName) { // 精确查品牌名称
  54 + domain = obj.brandDomain;
  55 + return false;
  56 + }
  57 +
  58 + // if (obj.brandDomain.indexOf(query) > 0) { // 模糊查品牌域名
  59 + // domain = obj.brandDomain;
  60 + // return false;
  61 + // }
  62 + });
  63 +
  64 + // 跳转到品牌商品列表页
  65 + if (domain !== null && !params.shop_id) {
  66 + let url = helpers.urlFormat('', {
  67 + from: 'search',
  68 + query: query
  69 +
  70 + }, domain);
  71 +
  72 + return res.redirect(url);
  73 + }
  74 +
  75 + // 品类名称为空时跳出
  76 + if (!result[1]) {
  77 + return;
  78 + }
  79 +
  80 + _.forEach(result[1].first, (obj) => {
  81 + // 精确查一级品类
  82 + if (obj === query) {
  83 + isQueryFirstClass = true;
  84 + return false;
  85 + }
  86 + });
  87 +
  88 + _.forEach(result[1].second, (obj) => {
  89 + // 精确查二级品类
  90 + if (obj === query) {
  91 + isQuerySecondClass = true;
  92 + return false;
  93 + }
  94 + });
  95 + } else {
  96 + params.query = '';
86 } 97 }
87 - });  
88 98
89 - _.forEach(result[1].second, (obj) => {  
90 - // 精确查二级品类  
91 - if (obj === query) {  
92 - isQuerySecondClass = true;  
93 - return false; 99 + // 搜索是一级品类
  100 + if (isQueryFirstClass) {
  101 + title = '全部' + query;
  102 + } else if (isQuerySecondClass) { // 搜索是二级品类
  103 + title = query;
  104 + } else { // 搜索其它内容
  105 + if (query || params.form) {
  106 + params.search = {
  107 + default: query === '' ? false : query,
  108 + url: helpers.urlFormat('', null, 'search')
  109 + };
  110 + }
  111 + title = '搜索';
94 } 112 }
95 - });  
96 - } else {  
97 - params.query = '';  
98 - }  
99 113
100 - // 搜索是一级品类  
101 - if (isQueryFirstClass) {  
102 - title = '全部' + query;  
103 - } else if (isQuerySecondClass) { // 搜索是二级品类  
104 - title = query;  
105 - } else { // 搜索其它内容  
106 - if (query || params.form) {  
107 - params.search = {  
108 - default: query === '' ? false : query,  
109 - url: helpers.urlFormat('', null, 'search')  
110 - };  
111 - }  
112 - title = '搜索'; 114 + title = params.title ? params.title : title;
  115 +
  116 + res.render('search/list', {
  117 + module: 'product',
  118 + page: 'search-list',
  119 + pageHeader: headerModel.setNav({
  120 + navTitle: title
  121 + }),
  122 + title: title,
  123 + goodList: params,
  124 + pageFooter: true
  125 + });
  126 + }).catch(next);
113 } 127 }
114 -  
115 - title = params.title ? params.title : title;  
116 -  
117 - res.render('search/list', {  
118 - module: 'product',  
119 - page: 'search-list',  
120 - pageHeader: headerModel.setNav({  
121 - navTitle: title  
122 - }),  
123 - title: title,  
124 - goodList: params,  
125 - pageFooter: true  
126 - });  
127 - }).catch(next); 128 + });
128 }; 129 };
129 130
130 /** 131 /**
@@ -132,6 +133,7 @@ const list = (req, res, next) => { @@ -132,6 +133,7 @@ const list = (req, res, next) => {
132 */ 133 */
133 const index = (req, res, next) => { 134 const index = (req, res, next) => {
134 let title = '搜索'; 135 let title = '搜索';
  136 +
135 ((render) => { 137 ((render) => {
136 if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) { 138 if (_.get(req, 'app.locals.wap.search.removeHotSearch', false)) {
137 render([]); 139 render([]);
@@ -140,7 +142,7 @@ const index = (req, res, next) => { @@ -140,7 +142,7 @@ const index = (req, res, next) => {
140 render(result); 142 render(result);
141 }).catch(next); 143 }).catch(next);
142 } 144 }
143 - 145 +
144 })((result) => { 146 })((result) => {
145 res.render('search/index', { 147 res.render('search/index', {
146 module: 'product', 148 module: 'product',
@@ -156,8 +158,8 @@ const index = (req, res, next) => { @@ -156,8 +158,8 @@ const index = (req, res, next) => {
156 } 158 }
157 159
158 }); 160 });
159 - })  
160 - 161 + });
  162 +
161 }; 163 };
162 164
163 /** 165 /**
1 -  
2 'use strict'; 1 'use strict';
3 2
4 const SECOND = 1; 3 const SECOND = 1;
@@ -43,6 +42,7 @@ const cachePage = { @@ -43,6 +42,7 @@ const cachePage = {
43 42
44 // 秒杀列表 43 // 秒杀列表
45 '/product/seckill': 30 * SECOND, 44 '/product/seckill': 30 * SECOND,
  45 + '/product/seckill/list': 30 * SECOND,
46 46
47 // 秒杀详情 47 // 秒杀详情
48 '/product/^\\/seckill\\/pro_([\\d]+)_([\\d]+)/': 30 * MINUTE, 48 '/product/^\\/seckill\\/pro_([\\d]+)_([\\d]+)/': 30 * MINUTE,
@@ -64,10 +64,17 @@ const cachePage = { @@ -64,10 +64,17 @@ const cachePage = {
64 '/brands': 5 * MINUTE, 64 '/brands': 5 * MINUTE,
65 '/brands/search': 1 * MINUTE, 65 '/brands/search': 1 * MINUTE,
66 66
67 - //活动 67 + // 直播活动
  68 + '/activity/live': 1 * MINUTE,
  69 +
  70 + // 单品日
68 '/activity/single-day': 1 * MINUTE, 71 '/activity/single-day': 1 * MINUTE,
  72 + '/activity/single-day/getSingleData': 30 * SECOND,
  73 + '/activity/single-day/getProductData': 30 * SECOND,
  74 +
  75 + // 店铺收藏
69 '/activity/shopCollect': 1 * MINUTE, 76 '/activity/shopCollect': 1 * MINUTE,
70 - '/activity/live': 1 * MINUTE 77 + '/activity/shopNav': 30 * SECOND
71 78
72 }; 79 };
73 80
@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - // api: 'http://api-test3.yohops.com:9999/',  
20 - // service: 'http://service-test3.yohops.com:9999/',  
21 - // liveApi: 'http://testapi.live.yohops.com:9999/',  
22 - // singleApi: 'http://api-test3.yohops.com:9999/' 19 + api: 'http://api-test3.yohops.com:9999/',
  20 + service: 'http://service-test3.yohops.com:9999/',
  21 + liveApi: 'http://testapi.live.yohops.com:9999/',
  22 + singleApi: 'http://api-test3.yohops.com:9999/'
23 23
24 - api: 'http://api.yoho.cn/',  
25 - service: 'http://service.yoho.cn/',  
26 - liveApi: 'http://api.live.yoho.cn/',  
27 - singleApi: 'http://single.yoho.cn/' 24 + // api: 'http://api.yoho.cn/',
  25 + // service: 'http://service.yoho.cn/',
  26 + // liveApi: 'http://api.live.yoho.cn/',
  27 + // singleApi: 'http://single.yoho.cn/'
28 }, 28 },
29 subDomains: { 29 subDomains: {
30 host: '.m.yohobuy.com', 30 host: '.m.yohobuy.com',
@@ -21,4 +21,7 @@ module.exports = app => { @@ -21,4 +21,7 @@ module.exports = app => {
21 21
22 // 分期付款 22 // 分期付款
23 app.use('/home', require('./apps/home')); 23 app.use('/home', require('./apps/home'));
  24 +
  25 + // 第三方服务处理
  26 + app.use('/3party', require('./apps/3party'));
24 }; 27 };
@@ -14,6 +14,10 @@ @@ -14,6 +14,10 @@
14 <link rel="dns-prefetch" href="//static.yohobuy.com"> 14 <link rel="dns-prefetch" href="//static.yohobuy.com">
15 <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> 15 <link rel="dns-prefetch" href="//img12.static.yhbimg.com">
16 <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> 16 <link rel="dns-prefetch" href="//img13.static.yhbimg.com">
  17 +
  18 + <!-- oneapm agent -->
  19 + <script type='text/javascript'>window.BWEUM||(BWEUM={});BWEUM.info = {"stand":true,"agentType":"browser","agent":"bi-collector.oneapm.com/static/js/bw-send-411.4.9.js","beaconUrl":"bi-collector.oneapm.com/beacon","licenseKey":"NQVuf~6yrQbvJnqr","applicationID":2283639};</script><script type="text/javascript">/*!OneAPM-v411.4.9 */!function(){window.NREUM||(window.NREUM={}),window.BWEUM||(window.BWEUM=window.NREUM);var a;window.BWEUM.require=a,window.apmFirstbyte=window.apmUserFirstbyte||(new Date).getTime(),a=function b(c,d,e){function f(h,i){if(!d[h]){if(!c[h]){var j="function"==typeof a&&a;if(!i&&j)return j(h,!0);if(g)return g(h,!0);var k=new Error("Cannot find module '"+h+"'");throw k.code="MODULE_NOT_FOUND",k}var l=d[h]={exports:{}};c[h][0].call(l.exports,function(a){var b=c[h][1][a];return f(b?b:a)},l,l.exports,b,c,d,e)}return d[h].exports}for(var g="function"==typeof a&&a,h=0;h<e.length;h++)f(e[h]);return f}({38:[function(a,b){b.exports=function(a){var b=document.createElement("a"),c=window.location,d={};b.href=a,d.port=b.port;var e=b.href.split("://");return!d.port&&e[1]&&(d.port=e[1].split("/")[0].split(":")[1]),d.port&&"0"!==d.port||(d.port="https"===e[0]?"443":"80"),d.hostname=b.hostname||c.hostname,d.pathname=b.pathname,"/"!==d.pathname.charAt(0)&&(d.pathname="/"+d.pathname),d.sameOrigin=!b.hostname||b.hostname===document.domain&&b.port===c.port&&b.protocol===c.protocol,d}},{}],34:[function(a,b){function c(){var a=m.info=window.BWEUM.info;if(a&&a.agent&&a.licenseKey&&a.applicationID&&i&&i.body){m.proto="https"===l.split(":")[0]||a.sslForHttp?"https://":"http://",g("mark",["onload",f()]);var b=i.createElement("script");b.src=0==a.agent.indexOf("//")?a.agent:m.proto+a.agent,b.src+="?v=411.4.9 ",i.body.appendChild(b)}}function d(){o||"complete"===i.readyState&&e()}function e(){g("mark",["domContent",f()])}function f(){return(new Date).getTime()}var g=a("handle"),h=window,i=h.document,j="addEventListener",k="attachEvent",l=(""+location).split("?")[0],m=b.exports={offset:window.apmFirstbyte||f(),origin:l,features:{}};g("mark",["firstbyte",window.apmFirstbyte||f()]),"complete"===document.readyState?(e(),c()):i[j]?(i[j]("DOMContentLoaded",e,!1),h[j]("load",c,!1)):(i[k]("onreadystatechange",d),h[k]("onload",c));var n=!1,o=!1;try{n=null==window.frameElement&&document.documentElement}catch(m){}n&&n.doScroll&&!function p(){if(!o){try{n.doScroll("left")}catch(a){return setTimeout(p,50)}o=!0,e()}}()},{handle:33}],33:[function(a,b){function c(a,b,c){return d.listeners(a).length?d.emit(a,b,c):(e[a]||(e[a]=[]),void e[a].push(b))}var d=a("ee").create(),e={};b.exports=c,c.ee=d,d.q=e},{ee:31}],36:[function(a,b){function c(a,b,c){b||(b=0),"undefined"==typeof c&&(c=a?a.length:0);for(var d=-1,e=c-b||0,f=new Array(0>e?0:e);++d<e;)f[d]=a[b+d];return f}b.exports=c},{}],31:[function(a,b){function c(a){function b(b,c,g){a&&a(b,c,g),g||(g={});var i=h(b),j=i.length,k={};try{k=f(g,e,d)}catch(l){}for(var m=0;j>m;m++)i[m].apply(k,c);return k}function g(a,b){j[a]=h(a).concat(b)}function h(a){return j[a]||[]}function i(){return c(b)}var j={};return{on:g,emit:b,create:i,listeners:h,_events:j}}function d(){return{}}var e="bw@context",f=a("gos");b.exports=c()},{gos:32}],32:[function(a,b){function c(a,b,c){if(d.call(a,b))return a[b];var e=c();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(a,b,{value:e,writable:!0,enumerable:!1}),e}catch(f){}try{a[b]=e}catch(f){}return e}var d=Object.prototype.hasOwnProperty;b.exports=c},{}]},{},[]),a=function c(b,d,e){function f(h,i){if(!d[h]){if(!b[h]){var j="function"==typeof a&&a;if(!i&&j)return j(h,!0);if(g)return g(h,!0);var k=new Error("Cannot find module '"+h+"'");throw k.code="MODULE_NOT_FOUND",k}var l=d[h]={exports:{}};b[h][0].call(l.exports,function(a){var c=b[h][1][a];return f(c?c:a)},l,l.exports,c,b,d,e)}return d[h].exports}for(var g="function"==typeof a&&a,h=0;h<e.length;h++)f(e[h]);return f}({1:[function(a){a("loader"),a("errorload"),a("xhrload"),a("perfload")},{errorload:5,loader:34,perfload:6,xhrload:7}],7:[function(a){function b(a){if("string"==typeof a&&a.length)return a.length;if("object"!=typeof a)return void 0;if("undefined"!=typeof ArrayBuffer&&a instanceof ArrayBuffer&&a.byteLength)return a.byteLength;if("undefined"!=typeof Blob&&a instanceof Blob&&a.size)return a.size;if("undefined"!=typeof FormData&&a instanceof FormData)return void 0;try{return JSON.stringify(a).length}catch(b){return void 0}}function c(a,b){return b}function d(a){a.send=o.wrapOld(a.send,"send-xhr-",c),a.onreadystatechange=o.wrapOld(a.onreadystatechange,"iexhr-onreadystatechange-",c),a.onerror=o.wrapOld(a.onerror,"iexhr-onerror-",c)}function e(a){var c=this.params,d=this.metrics;if(!this.ended){if(this.ended=!0,a.removeEventListener)for(var e=0;m>e;e++)a.removeEventListener(l[e],this.listener,!1);if(!c.aborted){if(d.duration=(new Date).getTime()-this.startTime,4===a.readyState){c.status=a.status;var f=a.responseType,g="arraybuffer"===f||"blob"===f||"json"===f?a.response:a.responseText,h=b(g);h&&(d.rxSize=h)}else c.status=0;d.cbTime=this.cbTime,c&&c.pathname&&c.pathname.indexOf("beacon/resources")<0&&i("xhr",[c,d,this.startTime,this.creatType])}}}function f(a,b){var c=j(b),d=a.params;d.host=c.hostname+":"+c.port,d.pathname=c.pathname,a.sameOrigin=c.sameOrigin}var g=window,h=(g.performance,window.XMLHttpRequest);if(h&&h.prototype&&!/CriOS/.test(navigator.userAgent)){a("loader").features.xhr=!0;var i=a("handle"),j=a("parse-url"),k=a("ee"),l=["load","error","abort","timeout"],m=l.length,n=a("loader_id"),o=a("wrap-function")(k);a("wrap-events"),a("wrap-xhr"),k.on("new-xhr",function(){this.totalCbs=0,this.called=0,this.cbTime=0,this.end=e,this.ended=!1,this.xhrGuids={}}),k.on("open-xhr-start",function(a){this.params={method:a[0]},f(this,a[1]),this.metrics={}}),k.on("open-xhr-end",function(a,b){b.__oldie&&d(b)}),k.on("send-xhr-start",function(a,c){var d=this.metrics,e=a[0],f=this;if(d&&e){var g=b(e);g&&(d.txSize=g)}if(this.startTime=(new Date).getTime(),this.listener=function(a){try{"abort"===a.type&&(f.params.aborted=!0),("load"!==a.type||f.called===f.totalCbs&&(f.onloadCalled||"function"!=typeof c.onload))&&f.end&&f.end(c)}catch(b){try{k.emit("internal-error",[b])}catch(d){}}},c.addEventListener)for(var h=0;m>h;h++)c.addEventListener(l[h],this.listener,!1)}),k.on("iexhr-onreadystatechange-start",function(a,b){if(1==b.readyState){var d=b.onreadystatechange;setTimeout(function(){b.onreadystatechange!==d&&(b.onreadystatechange=o.wrapOld(b.onreadystatechange,"iexhr-onreadystatechange-",c))},0)}4==b.readyState&&(this.xhrCbStart=(new Date).getTime())}),k.on("iexhr-onreadystatechange-end",function(a,b){var c=this;this.xhrCbStart&&k.emit("xhr-cb-time",[(new Date).getTime()-this.xhrCbStart,this.onload,b],b),4==b.readyState&&c.end(b)}),k.on("xhr-cb-time",function(a,b,c){this.cbTime+=a,b?this.onloadCalled=!0:this.called+=1,this.called!==this.totalCbs||!this.onloadCalled&&"function"==typeof c.onload||this.end(c)}),k.on("xhr-load-added",function(a,b){var c=""+n(a)+!!b;this.xhrGuids&&!this.xhrGuids[c]&&(this.xhrGuids[c]=!0,this.totalCbs+=1)}),k.on("xhr-load-removed",function(a,b){var c=""+n(a)+!!b;this.xhrGuids&&this.xhrGuids[c]&&(delete this.xhrGuids[c],this.totalCbs-=1)}),k.on("addEventListener-end",function(a,b){b instanceof XMLHttpRequest&&"load"===a[0]&&k.emit("xhr-load-added",[a[1],a[2]],b)}),k.on("removeEventListener-end",function(a,b){b instanceof XMLHttpRequest&&"load"===a[0]&&k.emit("xhr-load-removed",[a[1],a[2]],b)}),k.on("fn-start",function(a,b,c){b instanceof XMLHttpRequest&&("onload"===c&&(this.onload=!0),("load"===(a[0]&&a[0].type)||this.onload)&&(this.xhrCbStart=(new Date).getTime()))}),k.on("fn-end",function(a,b){this.xhrCbStart&&k.emit("xhr-cb-time",[(new Date).getTime()-this.xhrCbStart,this.onload,b],b)})}},{ee:31,handle:33,loader:34,loader_id:35,"parse-url":38,"wrap-events":28,"wrap-function":39,"wrap-xhr":30}],35:[function(a,b){function c(a){var b=typeof a;return!a||"object"!==b&&"function"!==b?-1:a===window?0:f(a,e,function(){return d++})}var d=1,e="bw@id",f=a("gos");b.exports=c},{gos:32}],6:[function(a){var b=window.performance;if(b&&b.timing&&b.getEntriesByType){var c=a("ee"),d=a("handle"),e=(a("wrap-timer"),a("loader"));e.features.stn=!0,c.on("fn-start",function(a){var b=a[0];b instanceof Event&&(this.bstStart=Date.now())}),c.on("fn-end",function(a,b){var c=a[0];c instanceof Event&&d("bst",[c,b,this.bstStart,Date.now()])})}},{ee:31,handle:33,loader:34,"wrap-timer":29}],5:[function(a){function b(a,b,d,g,i){try{j?j-=1:e("err",[i||new c(a,b,d)])}catch(k){try{e("ierr",[k,(new Date).getTime(),!0])}catch(l){}}return"function"==typeof h?h.apply(this,f(arguments)):!1}function c(a,b,c){this.message=a||"Uncaught error with no additional information",this.sourceURL=b,this.line=c}function d(a){e("err",[a,(new Date).getTime()])}var e=a("handle"),f=a("lodash._slice"),g=a("ee"),h=window.onerror,i=!1,j=0;a("loader").features.err=!0,window.onerror=b,window.BWEUM.noticeError=d;var k=window.XMLHttpRequest;try{throw new Error}catch(l){"stack"in l&&(a("wrap-timer"),"addEventListener"in window&&a("wrap-events"),k&&k.prototype&&k.prototype.addEventListener&&a("wrap-xhr"),i=!0)}g.on("fn-start",function(){i&&(j+=1)}),g.on("fn-err",function(a,b,c){i&&(this.thrown=!0,d(c))}),g.on("fn-end",function(){i&&!this.thrown&&j>0&&(j-=1)}),g.on("internal-error",function(a){e("ierr",[a,(new Date).getTime(),!0])})},{ee:31,handle:33,loader:34,"lodash._slice":36,"wrap-events":28,"wrap-timer":29,"wrap-xhr":30}],30:[function(a,b){function c(){j.inPlace(this,m,"fn-")}function d(a,b){j.inPlace(b,["onreadystatechange"],"fn-")}function e(a){a.open=j.wrapOld(a.open,"open-xhr-",f)}function f(a,b){return b}var g=a("ee").create(),h=a("wrap-events"),i=a("wrap-function"),j=i(g),k=i(h),l=window.XMLHttpRequest,m=["onload","onerror","onabort","onloadstart","onloadend","onprogress","ontimeout"];b.exports=g,window._ApmXMLHttpRequest=window.XMLHttpRequest,window.XMLHttpRequest=function(a){var b=new l(a);try{g.emit("new-xhr",[],b),l.prototype.addEventListener?(k.inPlace(b,["addEventListener","removeEventListener"],"-",function(a,b){return b}),b.addEventListener("readystatechange",c,!1)):(b.__oldie=!0,e(b))}catch(d){try{g.emit("internal-error",[d])}catch(f){}}return b},window.XMLHttpRequest.prototype=l.prototype,j.inPlace(XMLHttpRequest.prototype,["open","send"],"-xhr-",f),g.on("send-xhr-start",d),g.on("open-xhr-start",d)},{ee:31,"wrap-events":28,"wrap-function":39}],29:[function(a,b){function c(a,b,c){var d=a[0];"string"==typeof d&&(d=new Function(d)),a[0]=e(d,"fn-",null,c)}var d=(a("lodash._slice"),a("ee").create()),e=a("wrap-function")(d);b.exports=d,e.inPlace(window,["setTimeout","setInterval","setImmediate"],"setTimer-"),d.on("setTimer-start",c)},{ee:31,"lodash._slice":36,"wrap-function":39}],28:[function(a,b){function c(a){f.inPlace(a,["addEventListener","removeEventListener"],"-",d)}function d(a){return a[1]}var e=(a("lodash._slice"),a("ee").create()),f=a("wrap-function")(e),g=a("gos");if(b.exports=e,c(window),"getPrototypeOf"in Object){for(var h=document;h&&!h.hasOwnProperty("addEventListener");)h=Object.getPrototypeOf(h);h&&c(h);for(var i=XMLHttpRequest.prototype;i&&!i.hasOwnProperty("addEventListener");)i=Object.getPrototypeOf(i);i&&c(i)}else Object.prototype.hasOwnProperty.call(XMLHttpRequest,"addEventListener")&&c(XMLHttpRequest.prototype);e.on("addEventListener-start",function(a){if(a[1]){var b=a[1];"function"==typeof b?this.wrapped=a[1]=g(b,"bw@wrapped",function(){return f(b,"fn-",null,b.name||"anonymous")}):"function"==typeof b.handleEvent&&f.inPlace(b,["handleEvent"],"fn-")}}),e.on("removeEventListener-start",function(a){var b=this.wrapped;b&&(a[1]=b)})},{ee:31,gos:32,"lodash._slice":36,"wrap-function":39}],39:[function(a,b){function c(a){return!(a&&"function"==typeof a&&a.apply&&!a[f])}var d=a("ee"),e=a("lodash._slice"),f="bw@wrapper",g=Object.prototype.hasOwnProperty;b.exports=function(a){function b(a,b,d,g,i){function j(){var c=this;return h(a,b,c,e(arguments),d,g,i)}if(c(a))return a;b||(b="");try{j[f]=!0}catch(k){}return l(a,j),j}function h(a,b,c,d,e,f){var d,c,g,h;try{g=e&&e(d,c)||{}}catch(i){m([i,"",[d,c,f],g])}_apmfnName=a.name||"",k(b+"start",[d,c,f,_apmfnName],g);try{return h=a.apply(c,d)}catch(j){var l=window.console;throw void 0!=l&&l.error&&l.log&&void 0!=j.stack&&(l.log("OneAPM catch error"),l.error(j.stack)),k(b+"err",[d,c,j],g),j}finally{k(b+"end",[d,c,h,_apmfnName],g)}}function i(a,b,c){var a=a||function(){},b=b||"-";return function(){var d=this;return h(a,b,d,e(arguments),c)}}function j(a,d,e,f){e||(e="");var g,h,i,j="-"===e.charAt(0);for(i=0;i<d.length;i++)h=d[i],g=a[h],c(g)||(a[h]=b(g,j?h+e:e,f,h,a))}function k(b,c,d){try{a.emit(b,c,d)}catch(e){m([e,b,c,d])}}function l(a,b){if(Object.defineProperty&&Object.keys)try{var c=Object.keys(a);return c.forEach(function(c){Object.defineProperty(b,c,{get:function(){return a[c]},set:function(b){return a[c]=b,b}})}),b}catch(d){m([d])}for(var e in a)g.call(a,e)&&(b[e]=a[e]);return b}function m(b){try{a.emit("internal-error",b)}catch(c){}}return a||(a=d),b.inPlace=j,b.flag=f,b.wrapOld=i,b}},{ee:31,"lodash._slice":36}]},{},[1]),window.BWEUM.require=a}();</script>
  20 +
17 {{#if width750}} 21 {{#if width750}}
18 <script type="text/javascript"> 22 <script type="text/javascript">
19 (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); 23 (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
  1 +/**
  2 + * OneAPM agent configuration
  3 + */
  4 +
  5 +const commonConfig = require('./config/common');
  6 +
  7 +exports.config = {
  8 + app_name: [commonConfig.appName],
  9 + license_key: 'BwEGA1dRDlQ6357HHQ1AD1xJVkbc9fNfWRtQUwhQG41c5QFWGFIDSQoHc0e8AgMaUlcUVw0=',
  10 + logging: {
  11 + level: 'info'
  12 + },
  13 + transaction_events: {
  14 + enabled: true
  15 + }
  16 +};
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.1.8", 3 + "version": "5.1.12",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 "dev": "nodemon -e js,hbs -i public/ app.js", 12 "dev": "nodemon -e js,hbs -i public/ app.js",
13 "online": "NODE_ENV=\"production\" node app.js", 13 "online": "NODE_ENV=\"production\" node app.js",
14 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js", 14 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
15 - "lint-js": "eslint -c .eslintrc --cache --fix .", 15 + "lint-js": "eslint -c .eslintrc --cache .",
16 "lint-css": "stylelint --config .stylelintrc public/scss/**/*.css", 16 "lint-css": "stylelint --config .stylelintrc public/scss/**/*.css",
17 "precommit": "node lint.js" 17 "precommit": "node lint.js"
18 }, 18 },
@@ -30,6 +30,7 @@ @@ -30,6 +30,7 @@
30 "md5": "^2.1.0", 30 "md5": "^2.1.0",
31 "moment": "^2.15.1", 31 "moment": "^2.15.1",
32 "morgan": "^1.7.0", 32 "morgan": "^1.7.0",
  33 + "oneapm": "^1.2.20",
33 "passport": "^0.3.2", 34 "passport": "^0.3.2",
34 "passport-local": "^1.0.0", 35 "passport-local": "^1.0.0",
35 "passport-qq": "0.0.3", 36 "passport-qq": "0.0.3",
@@ -329,14 +329,30 @@ $('.close').on('click', function() { @@ -329,14 +329,30 @@ $('.close').on('click', function() {
329 $('.dialog').addClass('hidden'); 329 $('.dialog').addClass('hidden');
330 $('.mask').addClass('hidden'); 330 $('.mask').addClass('hidden');
331 $('#dialog .content').html(' '); 331 $('#dialog .content').html(' ');
  332 + $('body').css({
  333 + overflow: 'auto',
  334 + position: ''
  335 + });
  336 +});
  337 +$('.mask').on('touchmove', function() {
  338 + return false;
332 }); 339 });
  340 +
333 $('.coupon-description span').on('click', function() { 341 $('.coupon-description span').on('click', function() {
334 $('#message').removeClass('hidden'); 342 $('#message').removeClass('hidden');
335 $('.mask').removeClass('hidden'); 343 $('.mask').removeClass('hidden');
  344 + $('body').css({
  345 + overflow: 'hidden',
  346 + position: 'fixed'
  347 + });
336 }); 348 });
337 $('.description').on('click', function() { 349 $('.description').on('click', function() {
338 $('#message').removeClass('hidden'); 350 $('#message').removeClass('hidden');
339 $('.mask').removeClass('hidden'); 351 $('.mask').removeClass('hidden');
  352 + $('body').css({
  353 + overflow: 'hidden',
  354 + position: 'fixed'
  355 + });
340 }); 356 });
341 357
342 $('.use-coupon-btn').on('click', function() { 358 $('.use-coupon-btn').on('click', function() {
@@ -127,6 +127,8 @@ var singleDay = { @@ -127,6 +127,8 @@ var singleDay = {
127 $swiperTab.on('click', function() { 127 $swiperTab.on('click', function() {
128 var index = $(this).index(); 128 var index = $(this).index();
129 129
  130 + $('body').scrollTop(0);
  131 +
130 $swiperTab.removeClass('active').eq(index).addClass('active'); 132 $swiperTab.removeClass('active').eq(index).addClass('active');
131 133
132 if (self.$productTab.eq(index).find('li').length > 0) { 134 if (self.$productTab.eq(index).find('li').length > 0) {
@@ -399,7 +399,7 @@ function givePoint(parameter) { @@ -399,7 +399,7 @@ function givePoint(parameter) {
399 break; 399 break;
400 } 400 }
401 } else { 401 } else {
402 - header.removeClass('girls', 'life-style', 'kids'); 402 + header.removeClass('girls', 'life-style', 'kids').addClass('boys');
403 } 403 }
404 }()); 404 }());
405 405
@@ -4,8 +4,7 @@ var $ = require('yoho-jquery'), @@ -4,8 +4,7 @@ var $ = require('yoho-jquery'),
4 loading = require('../plugin/loading'), 4 loading = require('../plugin/loading'),
5 debounce = require('lodash/debounce'); 5 debounce = require('lodash/debounce');
6 6
7 -var plusstar = {},  
8 - $footer = $('#yoho-footer'); 7 +var plusstar = {};
9 8
10 var windowHeight = $(window).height(); 9 var windowHeight = $(window).height();
11 var scrollFn, 10 var scrollFn,
@@ -186,6 +185,9 @@ plusstar = { @@ -186,6 +185,9 @@ plusstar = {
186 return true; 185 return true;
187 } 186 }
188 187
  188 + // 固定底部去除
  189 + window.rePosFooter();
  190 +
189 // 记录切换tab位置 191 // 记录切换tab位置
190 $(document).scrollTop(window.cookie(code) || 0); 192 $(document).scrollTop(window.cookie(code) || 0);
191 193
@@ -303,23 +305,17 @@ $(function() { @@ -303,23 +305,17 @@ $(function() {
303 apt: window.queryString.client_type || '', 305 apt: window.queryString.client_type || '',
304 sid: window.queryString.session_id || '', 306 sid: window.queryString.session_id || '',
305 }; 307 };
306 - }  
307 -  
308 - // 男:1,女:2,潮童:3,创意生活:4  
309 - speckParamApp.CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;  
310 308
311 - if (!isApp) { 309 + $('.plusstar-resources').css({'margin-top': $('.tab-nav').height()});
  310 + } else {
312 $('.tab-nav').css({ 311 $('.tab-nav').css({
313 position: 'relative' 312 position: 'relative'
314 }); 313 });
315 -  
316 - $footer.css({  
317 - 'max-width': '650px'  
318 - }).before(  
319 - '<div style="height: ' + parseInt($footer.css('height'), 0) + 'px"></div>'  
320 - );  
321 } 314 }
322 315
  316 + // 男:1,女:2,潮童:3,创意生活:4
  317 + speckParamApp.CID = window.queryString.yh_channel || window._ChannelVary[window.cookie('_Channel')] || 1;
  318 +
323 plusstar.init(); 319 plusstar.init();
324 320
325 // 滚动翻页 321 // 滚动翻页
@@ -14,6 +14,8 @@ var tip = require('../../plugin/tip'); @@ -14,6 +14,8 @@ var tip = require('../../plugin/tip');
14 var trim = $.trim; 14 var trim = $.trim;
15 var showErrTip = tip.show; 15 var showErrTip = tip.show;
16 16
  17 +require('../../common');
  18 +
17 api.bindEyesEvt({ 19 api.bindEyesEvt({
18 status: 'open' // 默认眼睛打开 20 status: 'open' // 默认眼睛打开
19 }); 21 });
@@ -49,6 +51,16 @@ $btnSure.on('touchstart', function() { @@ -49,6 +51,16 @@ $btnSure.on('touchstart', function() {
49 var res = data.data; 51 var res = data.data;
50 52
51 if (data.code === 200) { 53 if (data.code === 200) {
  54 + // 统计代码:用于统计从哪个渠道注册成功的
  55 + if (window._yas && window._yas.sendCustomInfo) {
  56 + window._yas.sendCustomInfo({
  57 + op: 'YB_REGISTER_SUCCESS_L',
  58 + param: JSON.stringify({
  59 + C_ID: window._ChannelVary[window.cookie('_Channel')] || 1,
  60 + UNION_TYPE: window.queryString.union_type || window.cookie('unionTypeYas') || false
  61 + })
  62 + }, true);
  63 + }
52 showErrTip('注册成功'); 64 showErrTip('注册成功');
53 65
54 location.href = res.href; 66 location.href = res.href;
@@ -199,7 +199,7 @@ function getPageGoods(info) { @@ -199,7 +199,7 @@ function getPageGoods(info) {
199 url: info.url, 199 url: info.url,
200 data: info.data, 200 data: info.data,
201 success: function(data) { 201 success: function(data) {
202 - if (data === ' ') { 202 + if (data === '') {
203 nav.end = true; 203 nav.end = true;
204 } 204 }
205 205
@@ -325,6 +325,7 @@ var theY; @@ -325,6 +325,7 @@ var theY;
325 */ 325 */
326 function reNav1Pos() { 326 function reNav1Pos() {
327 var sTop = theY ? theY : 0; 327 var sTop = theY ? theY : 0;
  328 +
328 if (sTop < imgH + main1oH + nav1H) { 329 if (sTop < imgH + main1oH + nav1H) {
329 if ($nav1.hasClass('hide')) { 330 if ($nav1.hasClass('hide')) {
330 $nav1.removeClass('hide'); 331 $nav1.removeClass('hide');
@@ -385,6 +386,7 @@ function scrollHandler() { @@ -385,6 +386,7 @@ function scrollHandler() {
385 if (sTop + winH * 2 > scH) { 386 if (sTop + winH * 2 > scH) {
386 scrollCall = function() { 387 scrollCall = function() {
387 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)'; 388 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
  389 +
388 $nav1.css({ 390 $nav1.css({
389 transform: translate, 391 transform: translate,
390 '-moz-transform': translate, 392 '-moz-transform': translate,
@@ -681,7 +683,7 @@ function search(opt) { @@ -681,7 +683,7 @@ function search(opt) {
681 break; 683 break;
682 } 684 }
683 685
684 - if (data === ' ') { 686 + if (data === '') {
685 nav.end = true; 687 nav.end = true;
686 688
687 if (nav.reload) { 689 if (nav.reload) {
@@ -929,6 +931,7 @@ $nav2.on('touchstart', 'li', function(e) { @@ -929,6 +931,7 @@ $nav2.on('touchstart', 'li', function(e) {
929 931
930 $('.shop-foot-wrapper .buriedpoint').click(function() { 932 $('.shop-foot-wrapper .buriedpoint').click(function() {
931 var subGroup = $(this).find('.sub-group'); 933 var subGroup = $(this).find('.sub-group');
  934 +
932 if (subGroup.hasClass('hide')) { 935 if (subGroup.hasClass('hide')) {
933 subGroup.removeClass('hide'); 936 subGroup.removeClass('hide');
934 } else { 937 } else {
@@ -187,7 +187,7 @@ @@ -187,7 +187,7 @@
187 .dialog { 187 .dialog {
188 width: 84%; 188 width: 84%;
189 height: 410px; 189 height: 410px;
190 - position: absolute; 190 + position: fixed;
191 background: #fff; 191 background: #fff;
192 border-radius: 0.6rem; 192 border-radius: 0.6rem;
193 left: 8%; 193 left: 8%;
@@ -232,7 +232,7 @@ @@ -232,7 +232,7 @@
232 .activity-message { 232 .activity-message {
233 width: 100%; 233 width: 100%;
234 height: 410px; 234 height: 410px;
235 - overflow: scroll; 235 + overflow: auto;
236 } 236 }
237 237
238 .activity-message h3 { 238 .activity-message h3 {
@@ -277,17 +277,20 @@ @@ -277,17 +277,20 @@
277 .tip-wrap { 277 .tip-wrap {
278 width: 100%; 278 width: 100%;
279 height: 100%; 279 height: 100%;
280 - background: #9d1a15;  
281 position: fixed; 280 position: fixed;
282 top: 0; 281 top: 0;
283 left: 0; 282 left: 0;
284 z-index: 3; 283 z-index: 3;
  284 +
  285 + img {
  286 + width: 100%;
  287 + height: 100%;
  288 + }
285 } 289 }
286 290
287 .tip { 291 .tip {
288 width: 100%; 292 width: 100%;
289 height: 100%; 293 height: 100%;
290 - background: #9d1a15;  
291 position: absolute; 294 position: absolute;
292 top: 0; 295 top: 0;
293 left: 0; 296 left: 0;
@@ -18,12 +18,13 @@ @@ -18,12 +18,13 @@
18 position: fixed; 18 position: fixed;
19 z-index: 10; 19 z-index: 10;
20 background-color: #fff; 20 background-color: #fff;
  21 + top: 0;
21 22
22 li { 23 li {
23 display: block; 24 display: block;
24 float: left; 25 float: left;
25 height: 100%; 26 height: 100%;
26 - width: 33.33%; 27 + width: 50%;
27 line-height: 60px; 28 line-height: 60px;
28 color: #999; 29 color: #999;
29 white-space: nowrap; 30 white-space: nowrap;
@@ -207,6 +207,7 @@ @@ -207,6 +207,7 @@
207 color: #bbb; 207 color: #bbb;
208 line-height: 40px; 208 line-height: 40px;
209 margin: 30px 0 90px; 209 margin: 30px 0 90px;
  210 + padding: 0 50px;
210 } 211 }
211 } 212 }
212 213
@@ -376,6 +377,10 @@ @@ -376,6 +377,10 @@
376 377
377 .installment-body { 378 .installment-body {
378 background: #efefef; 379 background: #efefef;
  380 +
  381 + .main-wrap {
  382 + max-width: 100%;
  383 + }
379 } 384 }
380 385
381 .installment-result-page .installment-only { 386 .installment-result-page .installment-only {
1 .installment-starting-service-page { 1 .installment-starting-service-page {
2 background: #fff; 2 background: #fff;
  3 + height: calc(100vh);
3 4
4 .exclamation { 5 .exclamation {
5 background-color: #ff7f7f; 6 background-color: #ff7f7f;