Authored by 陈峰

Merge branch 'release/10.10' into 'master'

Release/10.10



See merge request !1552
@@ -2,7 +2,7 @@ const shelljs = require('shelljs'); @@ -2,7 +2,7 @@ const shelljs = require('shelljs');
2 const yargs = require('yargs'); 2 const yargs = require('yargs');
3 const path = require('path'); 3 const path = require('path');
4 const cssnano = require('cssnano'); 4 const cssnano = require('cssnano');
5 -const request = require('request'); 5 +const rp = require('request-promise');
6 const fs = require('fs'); 6 const fs = require('fs');
7 const pkg = require('../package.json'); 7 const pkg = require('../package.json');
8 8
@@ -33,19 +33,30 @@ new Promise((resolve, reject) => { // 加载manifest.json文件 @@ -33,19 +33,30 @@ new Promise((resolve, reject) => { // 加载manifest.json文件
33 cpPaths.push(`dist/statics/yohobuywap-node/${pkg.version}/manifest.json`); 33 cpPaths.push(`dist/statics/yohobuywap-node/${pkg.version}/manifest.json`);
34 resolve(); 34 resolve();
35 } else { 35 } else {
36 - request({ 36 + return Promise.all([
  37 + rp({
37 url: `https://cdn.yoho.cn/yohobuywap-node/${pkg.version}/manifest.json`, 38 url: `https://cdn.yoho.cn/yohobuywap-node/${pkg.version}/manifest.json`,
38 gzip: true, 39 gzip: true,
39 json: true 40 json: true
40 - }, (error, response, data) => {  
41 - if (error || !data || data.error) {  
42 - return reject(`download manifest.json faild:${error || !data || data.error}`); 41 + }),
  42 + rp({
  43 + url: 'https://m.yohobuy.com/sw.js',
  44 + gzip: true
  45 + }),
  46 + ]).then(results => {
  47 + const [manifest, sw] = results;
  48 +
  49 + if (!manifest || !sw) {
  50 + throw 'manifest.json or sw.js download faild';
43 } 51 }
44 - fs.writeFileSync(path.join(distDir, 'manifest.json'), JSON.stringify(data), { 52 + fs.writeFileSync(path.join(distDir, 'manifest.json'), JSON.stringify(manifest), {
45 flag: 'w' 53 flag: 'w'
46 }); 54 });
47 - resolve(); 55 + fs.writeFileSync(path.join(__dirname, '../public/static/sw.js'), sw, {
  56 + flag: 'w'
48 }); 57 });
  58 + resolve();
  59 + }).catch(reject);
49 } 60 }
50 }).then(() => { // 拷贝node代码 61 }).then(() => { // 拷贝node代码
51 cpPaths.forEach(p => { 62 cpPaths.forEach(p => {
1 { 1 {
2 "name": "yohobuywap-node", 2 "name": "yohobuywap-node",
3 - "version": "6.7.13", 3 + "version": "6.7.14",
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": {
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 "xml2js": "^0.4.19", 88 "xml2js": "^0.4.19",
89 "yoho-express-session": "^2.0.0", 89 "yoho-express-session": "^2.0.0",
90 "yoho-md5": "^2.0.0", 90 "yoho-md5": "^2.0.0",
91 - "yoho-node-lib": "=0.6.32", 91 + "yoho-node-lib": "=0.6.33",
92 "yoho-zookeeper": "^1.0.10" 92 "yoho-zookeeper": "^1.0.10"
93 }, 93 },
94 "devDependencies": { 94 "devDependencies": {
@@ -244,13 +244,14 @@ cHammer.on('tap', function() { @@ -244,13 +244,14 @@ cHammer.on('tap', function() {
244 244
245 $search.on('touchend', function() { 245 $search.on('touchend', function() {
246 let $buriedpoint = $form.find('.buriedpoint'); 246 let $buriedpoint = $form.find('.buriedpoint');
  247 + let inputQuery = $buriedpoint.val();
247 248
248 - if ($buriedpoint.val() === '') {  
249 - $buriedpoint.val($('#default-terms').val()); 249 + if (inputQuery === '') {
  250 + inputQuery = $('#default-terms').val();
250 } 251 }
251 252
252 // 保存搜索的内容 253 // 保存搜索的内容
253 - writeSearch.setHistoryValFun($buriedpoint.val()); 254 + writeSearch.setHistoryValFun(inputQuery);
254 255
255 if (security.hasDangerInput()) { 256 if (security.hasDangerInput()) {
256 return false; 257 return false;
@@ -261,15 +262,14 @@ $search.on('touchend', function() { @@ -261,15 +262,14 @@ $search.on('touchend', function() {
261 op: 'YB_KEYWORD_SEARCH_C', 262 op: 'YB_KEYWORD_SEARCH_C',
262 param: JSON.stringify({ 263 param: JSON.stringify({
263 C_ID: C_ID, 264 C_ID: C_ID,
264 - KEYWORD: $buriedpoint.val(), 265 + KEYWORD: inputQuery,
265 POS_ID: 0, 266 POS_ID: 0,
266 FLR_INDEX: 0 267 FLR_INDEX: 0
267 }) 268 })
268 }, true); 269 }, true);
269 } 270 }
270 271
271 - $(this).closest('form').submit();  
272 - return false; 272 + goSearch(inputQuery);
273 }); 273 });
274 274
275 // 初始化历史搜索的内容 275 // 初始化历史搜索的内容
@@ -132,3 +132,4 @@ self.workbox.routing.registerRoute(args => { @@ -132,3 +132,4 @@ self.workbox.routing.registerRoute(args => {
132 }) 132 })
133 ]}).handle(args); 133 ]}).handle(args);
134 }); 134 });
  135 +
@@ -4778,9 +4778,9 @@ inflight@^1.0.4: @@ -4778,9 +4778,9 @@ inflight@^1.0.4:
4778 once "^1.3.0" 4778 once "^1.3.0"
4779 wrappy "1" 4779 wrappy "1"
4780 4780
4781 -influx-batch-sender@^0.1.6:  
4782 - version "0.1.6"  
4783 - resolved "http://npm.yohops.com/influx-batch-sender/-/influx-batch-sender-0.1.6.tgz#fe4fb11ac80ece3ca791e40c8de098ce0181d499" 4781 +influx-batch-sender@^0.1.7:
  4782 + version "0.1.7"
  4783 + resolved "http://npm.yohops.com/influx-batch-sender/-/influx-batch-sender-0.1.7.tgz#9f925bfc500e886cae27001b3cc20f2584fa464a"
4784 dependencies: 4784 dependencies:
4785 debug "^3.0.1" 4785 debug "^3.0.1"
4786 lodash "^4.17.4" 4786 lodash "^4.17.4"
@@ -11102,13 +11102,13 @@ yoho-md5@^2.0.0: @@ -11102,13 +11102,13 @@ yoho-md5@^2.0.0:
11102 version "2.1.0" 11102 version "2.1.0"
11103 resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.1.0.tgz#f0c00d343f775e77952ebce0826863ac52e0ad50" 11103 resolved "http://npm.yohops.com/yoho-md5/-/yoho-md5-2.1.0.tgz#f0c00d343f775e77952ebce0826863ac52e0ad50"
11104 11104
11105 -yoho-node-lib@=0.6.32:  
11106 - version "0.6.32"  
11107 - resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.32.tgz#285b9c89445ed3e6aed9e2cdd4efb7637652a375" 11105 +yoho-node-lib@=0.6.33:
  11106 + version "0.6.33"
  11107 + resolved "http://npm.yohops.com/yoho-node-lib/-/yoho-node-lib-0.6.33.tgz#fca4dadedb80438d30d06fbb386d09912a4f9ca6"
11108 dependencies: 11108 dependencies:
11109 dnscache "^1.0.1" 11109 dnscache "^1.0.1"
11110 handlebars "^4.0.5" 11110 handlebars "^4.0.5"
11111 - influx-batch-sender "^0.1.6" 11111 + influx-batch-sender "^0.1.7"
11112 lodash "^4.13.1" 11112 lodash "^4.13.1"
11113 lru-cache "^4.1.1" 11113 lru-cache "^4.1.1"
11114 md5 "^2.1.0" 11114 md5 "^2.1.0"