Authored by 毕凯

Merge branch 'hotfix/smslogin' into 'master'

Hotfix/smslogin



See merge request !1185
... ... @@ -172,8 +172,12 @@ class BuyNowController {
use_yoho_coin: req.body.use_yoho_coin
});
result.data.use_yoho_coin = paymentProcess.transPrice(_.get(result, 'data.use_yoho_coin'));
result.data.yohoCoinCompute = paymentProcess.yohoCoinCompute(result.data);
let finalResult = _.get(result, 'data', {});
if (finalResult) {
_.set(finalResult, 'use_yoho_coin', paymentProcess.transPrice(_.get(result, 'data.use_yoho_coin')));
_.set(finalResult, 'yohoCoinCompute', paymentProcess.yohoCoinCompute(result.data));
}
return res.json(result.data);
})().catch(next);
}
... ...
... ... @@ -6,6 +6,7 @@
'use strict';
const _ = require('lodash');
const helpers = global.yoho.helpers;
// const utils = '../../../utils';
... ... @@ -122,7 +123,7 @@ module.exports = class extends global.yoho.BaseModel {
let adList = result.data[0].data;
let build = [];
adList.forEach(ad => {
_.forEach(adList, ad => {
build.push({
img: helpers.image(ad.src, 640, 240),
url: ad.url
... ...
... ... @@ -285,7 +285,7 @@ class DetailModel extends global.yoho.BaseModel {
if (getArticleContent[i].text && textPosition === 1) {
descriptionText = _.get(getArticleContent[i], 'text.data.text');
_.set(result, 'getArticle.descriptionText', descriptionText.replace(/<\/?[^>]*>/g, ''));
_.set(result, 'getArticle.descriptionText', _.replace(descriptionText, /<\/?[^>]*>/g, ''));
textPosition++;
}
}
... ...
... ... @@ -139,10 +139,10 @@ exports.recordContent = (req, res, next) => {
req.ctx(indexModel).recordContent(uid, udid, page, limit).then((result) => {
if (result.browseRecord && result.browseRecord.length === 0) {
if (result && result.browseRecord && result.browseRecord.length === 0) {
res.json(false);
} else {
res.render('browse-record-content', Object.assign({
res.render('browse-record-content', _.assign({
layout: false
}, result));
}
... ...
'use strict';
const css = require('../css');
const mRoot = '../models';
const listModel = require(`${mRoot}/chanpin`);
const co = require('bluebird').coroutine;
exports.index = (req, res, next) => {
co(function* () {
let params = {
page: 1,
limit: 100,
sales: 'Y',
outlets: 2,
stocknumber: 1,
need_filter: 'no',
type: 'default',
order: 's_t_desc',
id: req.params.id
};
let list = yield req.ctx(listModel).index(params);
let goodsList = {
name: list.name || '',
list: list.list,
fuzzyWord: list.fuzzyWord
};
return res.render('list', Object.assign({
css: yield css('list.css'),
title: `${goodsList.name}价格_图片_品牌_怎么样-YOHO!BUY有货`,
mipUrl: `https://m.yohobuy.com${req.originalUrl}`,
mipFooter: true,
canonical: {
currentHref: `https://www.yohobuy.com/chanpin/${req.params.id}.html`
}
}, goodsList));
})().catch(next);
};
... ...
... ... @@ -212,7 +212,12 @@ const detailIndex = (req, res, next) => {
mipPublishTime: mipDate(detail.getArticle.publish_time * 1000),
mipPic: detail.getArticle.cover_image ? detail.getArticle.cover_image.split('?')[0] : '',
mipDes: detail.getArticle.article_summary,
mipUrl: `https://m.yohobuy.com${req.originalUrl}`
mipUrl: `https://m.yohobuy.com${req.originalUrl}`,
miphtml: `https://m.yohobuy.com/mip/guang/${id}.html`,
canonical: {
currentHref: `https://m.yohobuy.com/guang/${id}.html`
},
showAnaJson: true
}, data));
})().catch(next);
};
... ...
* {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.good-info {
float: left;
box-sizing: border-box;
-webkit-box-sizing: border-box;
width: 44%;
margin-left: 4%;
}
.good-detail-img {
position: relative;
width: 100%;
padding-top: 133.19%;
}
.good-detail-img img {
width: 100%;
}
.good-detail-img .mip-element {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
}
.good-info .tag-container {
overflow: hidden;
width: 100%;
height: 20px;
}
.good-info .tag-container .good-tag {
display: block;
float: left;
box-sizing: border-box;
margin-right: 4px;
height: 20px;
text-align: center;
font-size: 12px;
line-height: 20px;
}
.good-info .tag-container .good-tag:last-child {
margin-right: 0;
}
.good-info .tag-container .new-tag {
width: 40px;
background-color: #78dc7e;
color: #fff;
}
.good-info .tag-container .hot-tag {
width: 60px;
background-color: #ff575c;
color: #fff;
}
.good-info .tag-container .renew-tag {
width: 50px;
background-color: #78dc7e;
color: #fff;
}
.good-info .tag-container .sale-tag {
width: 40px;
background-color: #ff575c;
color: #fff;
}
.good-info .tag-container .new-festival-tag {
color: #000;
width: 50px;
background-image: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/new-festival.png");
background-repeat: no-repeat;
background-color: #fff;
background-size: 100px 28px;
}
.good-info .tag-container .limit-tag {
width: 60px;
border: 1px solid #000;
color: #000;
}
.good-info .tag-container .is-presell {
width: 40px;
background-color: #000;
color: #fff;
}
.good-info .tag-container .is-global {
padding: 3px 10px 0 8px;
color: #fff;
background-color: #462e3e;
line-height: 26px;
}
.good-info .tag-container .is-global span {
display: inline-block;
background-image: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/airplane.png");
background-repeat: no-repeat;
padding-left: 32px;
background-size: auto 95%;
}
.good-detail-img .good-islike {
position: absolute;
top: 0;
right: 0;
width: 60px;
height: 60px;
color: #b0b0b0;
text-align: center;
text-decoration: none;
font-size: 30px;
line-height: 60px;
}
.good-detail-img .good-like {
color: #d72928;
}
.good-detail-img img {
display: block;
width: 100%;
}
.good-detail-img .few-tag {
position: absolute;
bottom: 0;
width: 100%;
height: 24px;
background: #ffac5b;
color: #fff;
text-align: center;
font-size: 12px;
line-height: 24px;
}
.good-detail-img .out-tag {
position: absolute;
bottom: 0;
width: 100%;
height: 32px;
background: #b0b0b0;
color: #fff;
text-align: center;
font-size: 18px;
line-height: 32px;
}
.good-detail-img .no-storage {
width: 100%;
height: 100%;
overflow: hidden;
background-color: #000;
opacity: 0.4;
position: absolute;
top: 0;
}
.good-detail-img .no-storage .no-storage-img {
display: block;
width: 100%;
height: 100%;
background-image: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/outlet_sellout_bg.png");
background-repeat: no-repeat;
background-size: contain;
}
.good-detail-text {
position: relative;
}
.good-detail-text .name a {
transform: scale(0.9);
margin: 7px 0 5px;
min-height: 30px;
color: #444;
font-size: 12px;
line-height: 18px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
height: 36px;
}
.good-detail-text .price {
font-size: 12px;
line-height: 22px;
white-space: nowrap;
transform: scale(0.9);
}
.good-detail-text .price .sale-price {
color: #d62927;
}
.good-detail-text .price .sale-price.no-price {
color: #000;
}
.good-detail-text .price .market-price {
font-size: 12px;
margin: 0 0 0 5px;
color: #b0b0b0;
text-decoration: line-through;
}
.good-detail-text .vip-grade {
display: inline-block;
margin-right: 8px;
width: 26px;
height: 16px;
vertical-align: text-bottom;
}
.good-detail-text .vip-grade-1 {
background: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/silver.png") no-repeat;
background-size: contain;
}
.good-detail-text .vip-grade-2 {
background: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/golden.png") no-repeat;
background-size: contain;
}
.good-detail-text .vip-grade-3 {
background: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/platinum.png") no-repeat;
background-size: contain;
}
.good-detail-text .vip-info {
margin-top: 3px;
color: #444;
font-size: 12px;
line-height: 16px;
}
.good-detail-text .vip-info .vip-icon {
display: inline-block;
margin-right: 8px;
width: 44px;
height: 16px;
background: url("//cdn.yoho.cn/yohobuywap-node/6.2.37/img/product/vip-icon.png") no-repeat;
background-size: contain;
vertical-align: bottom;
}
.mip-footer {
clear: both;
position: relative;
}
.mip-footer .option {
font-size: 0;
}
.mip-footer .option a {
line-height: 50px;
font-size: 13px;
padding: 0 5%;
}
.mip-footer .option .login {
border-right: solid 1px #e0e0e0;
}
.mip-footer .option .back-to-top {
line-height: 50px;
font-size: 13px;
padding: 0 5%;
float: right;
}
.mip-footer .option .back-to-top span {
font-weight: bold;
margin-left: 5px;
transform: scaleY(0.5);
display: inline-block;
}
.mip-footer .copy-right {
background-color: #eee;
color: #666;
text-align: center;
line-height: 45px;
font-size: 13px;
}
.mip-footer .mip-fixed {
position: relative !important;
}
.mip-footer .mip-gototop {
display: inline;
}
.list-too-little {
padding: 2% 4%;
border-bottom: 1px solid #e6e6e6;
color: #444;
font-size: 12px;
}
.list-too-little .word {
display: inline-block;
padding: 5px 15px;
border-radius: 10px;
border: 1px solid #bbb;
margin-right: 6px;
margin-top: 5px;
}
... ...
'use strict';
const utils = '../../../utils';
const redis = require(`${utils}/redis`);
const _ = require('lodash');
const helpers = global.yoho.helpers;
const camelCase = global.yoho.camelCase;
class List extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
list(params) {
let options = {
data: {
method: 'web.search.forseo',
sales: params.sales,
outlets: params.outlets,
stocknumber: params.stocknumber,
need_filter: params.need_filter,
query: params.query,
type: params.type,
page: params.page || 1,
limit: params.limit || 24,
order: params.order || 0
},
param: {
code: 200
}
};
return this.get(options).then(result => {
return result;
});
}
getSearchKeywordDataById(params) {
return redis.all([
['get', `global:yoho:seo:keywords:id:${params.id}`]
]).then(redisData => {
return redisData;
});
}
index(params) {
return Promise.all([
this.getSearchKeywordDataById(params),
]).then(result => {
let resu = {
list: [],
fuzzyWord: []
};
if (_.get(result, '[0][0]')) {
let build = [];
let redisData = JSON.parse(result[0][0]);
return this.list(Object.assign(params, {query: redisData.name})).then(listData => {
_.forEach(_.slice(redisData.data, 0, 12), value => {
build.push({
name: value.keyword,
link: helpers.urlFormat(`/mip/list/${value.id}.html`, null)
});
});
resu.name = redisData.name;
resu.fuzzyWord = build;
if (_.get(listData, 'data.product_list')) {
resu.list = camelCase(listData.data.product_list);
_.forEach(resu.list, value => {
value.isSoonSoldOut = value.isSoonSoldOut === 'Y';
});
}
return resu;
});
} else {
return resu;
}
});
}
}
module.exports = List;
... ...
... ... @@ -12,10 +12,13 @@ const cRoot = './controllers';
const rewrite = require('../../doraemon/middleware/rewrite');
const mip = require('../../doraemon/middleware/mip');
const guang = require(`${cRoot}/guang`);
const chanpin = require(`${cRoot}/chanpin`);
router.use(mip);
router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get('/chanpin/:id.html', chanpin.index);
module.exports = router;
... ...
<div class="good-list-page search-page yoho-page">
{{> list}}
{{> mip-footer}}
</div>
... ...
{{#if fuzzyWord}}
<div class="word-content">
<div class="list-too-little">
{{# fuzzyWord}}
<span class="word"><a data-type="mip" href="{{link}}">{{name}}</a></span>
{{/ fuzzyWord}}
</div>
</div>
{{/if}}
{{#if list}}
{{#list}}
<div class="good-info {{#if @root.saleViplogin}}sale-vip{{/if}}" data-id="{{productSkn}}" data-bp-id="guang_goodList_{{productName}}_false">
<div class="tag-container clearfix">
{{#each tags}}
{{#if isNew}}
<p class="good-tag new-tag">NEW</p>
{{/if}}
{{#if isAdvance}}
<p class="good-tag renew-tag">再到着</p>
{{/if}}
{{#if isDiscount}}
<p class="good-tag sale-tag">SALE</p>
{{/if}}
{{#if isYohoood}}
<p class="good-tag running-man-tag">跑男同款</p>
{{/if}}
{{#if isLimited}}
<p class="good-tag limit-tag">限量商品</p>
{{/if}}
{{# isPresell}}
<p class="good-tag is-presell">预售</p>
{{/ isPresell}}
{{/each}}
</div>
<div class="good-detail-img">
<a class="good-thumb" href="//m.yohobuy.com/product/{{productSkn}}.html">
<mip-img src="{{image defaultImages 235 314}}"></mip-img>
</a>
{{!-- {{log isSoonSoldOut}} --}}
{{#if isSoonSoldOut}}
<p class="few-tag">即将售罄</p>
{{/if}}
{{#if noStorage}}
<div class="no-storage">
<div class="no-storage-img"></div>
</div>
{{/if}}
</div>
<div class="good-detail-text">
<div class="name">
<a href="//m.yohobuy.com/product/{{productSkn}}.html">{{productName}}</a>
</div>
<div class="price">
{{#if @root.saleViplogin}}
<i class="vip-grade vip-grade-{{@root.vipLevel}}"></i>
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥
{{#if @root.vipPrice1}}{{round vip1Price}}{{/if}}
{{#if @root.vipPrice2}}{{round vip2Price}}{{/if}}
{{#if @root.vipPrice3}}{{round vip3Price}}{{/if}}
</span>
{{else}}
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{round salesPrice}}</span>
{{/if}}
{{#marketPrice}}
<span class="market-price">¥{{round .}}</span>
{{/marketPrice}}
</div>
{{#if @root.saleVip}}
<div class="vip-info">
<i class="vip-icon"></i>更优惠
</div>
{{/if}}
</div>
</div>
{{/list}}
{{/if}}
... ...
<div class="mip-footer">
<div class="option">
<a href="//m.yohobuy.com/signin.html" class="login">登录</a>
<a href="//m.yohobuy.com/reg.html" class="reg">注册</a>
<mip-fixed class="mip-fixed" type="gototop">
<mip-gototop class="mip-gototop">
<span class="back-to-top">回到顶部<span></span></span>
</mip-gototop>
</mip-fixed>
</div>
<p class="copy-right">
CopyRight©2007-2017 南京新与力文化传播有限公司
</p>
</div>
\ No newline at end of file
... ...
... ... @@ -274,7 +274,7 @@ const local = {
passport.authenticate('local', (err, user) => {
if (err || !user) {
if (err.code === 4189) {
if (_.get(err, 'code') === 4189) {
let obj = {
code: 4189,
message: err || '登录出错请重试',
... ...
... ... @@ -199,7 +199,7 @@ class SmsLogin {
// 手机号码 没注册
if (r1.data.is_register !== 'Y') {
redirect = '/passport/sms_login?step=3';
redirect = '/passport/reg/index';
_.set(req.session, 'smsLogin.step', 3);
res.json({
... ...
... ... @@ -83,8 +83,9 @@ const keyId = (req, res, next) => {
description: `YOHO!BUY有货网yohobuy.com是国内专业的${queryKey}网上潮流购物商城,为您找到${_.get(result,
'total', 0)}${queryKey}、产品的详细参数,实时报价,价格行情,图片、评价、品牌等信息。买${queryKey},就上YOHO!BUY有货`,
pageFooter: true,
miphtml: `https://m.yohobuy.com/mip/chanpin/${req.params.id}.html`,
canonical: {
currentHref: `https://www.yohobuy.com${req.originalUrl}`
currentHref: `https://www.yohobuy.com/chanpin/${req.params.id}.html`
}
});
}).catch(next);
... ...
... ... @@ -416,9 +416,10 @@ const getCategoryGoods = (req, res, next) => {
params.limit = 24;
req.ctx(searchModel).getCategoryGoods(params).then((result) => {
if (result.data.product_list && result.data.product_list.length > 0) {
let productList = _.get(result, 'data.product_list', []);
let product_list = productProcess.processProductList(result.data.product_list || [], {
if (productList.length > 0) {
let product_list = productProcess.processProductList(productList, {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
... ... @@ -427,7 +428,7 @@ const getCategoryGoods = (req, res, next) => {
res.render('search/page', {
layout: false,
new: product_list,
total: result.data.total,
total: _.get(result, 'data.total', 0)
});
} else {
res.json({});
... ...
... ... @@ -62,7 +62,7 @@ module.exports = () => {
req.url = '/activity/couponSend';
}
if (/\/chanpin\/(.*).html/.test(req.url) || /\/so\/(.*).html/.test(req.url)) {
if (/^\/chanpin\/(.*).html/.test(req.url)) {
// 获取seo兼容
req.url = `/product/search${req.path}`;
}
... ...
... ... @@ -5,12 +5,15 @@
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<title>{{title}} | Yoho!Buy有货 | 潮流购物逛不停</title>
<link rel="stylesheet" type="text/css" href="https://mipcache.bdstatic.com/static/v1/mip.css">
<link rel="canonical" href="https://www.yohobuy.com/guang/{{mipId}}.html"/>
{{# canonical}}
<link rel="canonical" href="{{currentHref}}"/>
{{/ canonical}}
<style mip-custom>
.main-wrap{width: 100%;max-width: 750px;margin: 0 auto;}
{{css}}
{{localStyle}}
</style>
{{#if showAnaJson}}
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
... ... @@ -23,7 +26,8 @@
"description": "{{mipDes}}",
"pubDate": "{{mipPublishTime}}"
}
</script>
</script>
{{/if}}
</head>
<body>
<div class="main-wrap">{{{body}}}</div>
... ... @@ -34,5 +38,8 @@
<script src="https://mipcache.bdstatic.com/static/v1/mip-anim/mip-anim.js"></script>
<script src="https://mipcache.bdstatic.com/static/v1/mip-audio/mip-audio.js"></script>
<script src="https://mipcache.bdstatic.com/extensions/platform/v1/mip-cambrian/mip-cambrian.js"></script>
{{#if mipFooter}}
<script src="https://mipcache.bdstatic.com/static/v1/mip-gototop/mip-gototop.js"></script>
{{/if}}
</body>
</html>
... ...
{
"name": "yohobuywap-node",
"version": "6.3.2",
"version": "6.3.3",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -6,7 +6,6 @@ import Validate from 'plugin/validata';
const showErrTip = tip.show;
const trim = $.trim;
const $captcha = $('#js-img-check');
const useVerify = $captcha.data('userverify'); // 170406 是否使用验证
const validate = new Validate($captcha, {
useREM: {
rootFontSize: 40,
... ... @@ -88,15 +87,11 @@ class InternationalNew extends Page {
password: pwd
};
if (useVerify) {
validate.getResults().then((result) => {
this.selector.internationalLoginBtn.text('正在登录...').addClass('disable');
$.extend(params, result);
this.postInternationalLogin(params);
});
} else {
validate.getResults().then((result) => {
this.selector.internationalLoginBtn.text('正在登录...').addClass('disable');
$.extend(params, result);
this.postInternationalLogin(params);
}
});
} else {
showErrTip('账号或密码有错误,请重新输入');
this.selector.internationalLoginBtn.text('登录').addClass('disable');
... ...
... ... @@ -147,10 +147,23 @@ class SmsLoginNew extends Page {
checkPoint('YB_MOBILE_LOGIN_C'); // 埋点
if (res.newer) {
res.redirect = res.redirect + '&registerCode=' + res.registerCode;
let modal = new Modal2({
text: '手机号不存在,请先注册',
buttons: [{
text: '立即注册',
handler: function() {
this.hide();
location.href = res.redirect;
}
}]
});
modal.show();
}
location.href = res.redirect;
setTimeout(() => {
location.href = res.redirect;
}, 1000);
return;
}
tip.show(res.message);
... ...
... ... @@ -525,7 +525,9 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
if (value.collocation) {
_.forEach(value.collocation, (item, subKey) => {
_.forEach(item.goods, (thItem, thKey) => {
finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id];
if (thItem) {
finalDetail[key].collocation[subKey].goods[thKey] = goodsObj[thItem.id];
}
});
});
}
... ...