Authored by ccbikai(👎🏻🍜)

Merge branch 'gray' of git.yoho.cn:fe/yohobuywap-node into gray

@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 'use strict'; 5 'use strict';
6 const mRoot = '../models'; 6 const mRoot = '../models';
7 const share = require(`${mRoot}/share`); 7 const share = require(`${mRoot}/share`);
  8 +const _ = require('lodash');
8 9
9 exports.getShareContent = (req, res, next) => { 10 exports.getShareContent = (req, res, next) => {
10 if (!req.query.shareId) { 11 if (!req.query.shareId) {
@@ -14,6 +15,13 @@ exports.getShareContent = (req, res, next) => { @@ -14,6 +15,13 @@ exports.getShareContent = (req, res, next) => {
14 }); 15 });
15 } 16 }
16 17
  18 + if (!_.isNumber(+req.query.shareId)) {
  19 + return res.jsonp({
  20 + code: 400,
  21 + message: 'shareId is invalid'
  22 + });
  23 + }
  24 +
17 share.getShareContent({ 25 share.getShareContent({
18 shareId: req.query.shareId 26 shareId: req.query.shareId
19 }).then(result => { 27 }).then(result => {
@@ -19,7 +19,7 @@ const _activity = () => { @@ -19,7 +19,7 @@ const _activity = () => {
19 19
20 const _user = (params) => { 20 const _user = (params) => {
21 if (!params.uid) { 21 if (!params.uid) {
22 - return {}; 22 + return Promise.resolve({});
23 } 23 }
24 return api.get('', { 24 return api.get('', {
25 method: 'app.passport.profile', 25 method: 'app.passport.profile',
@@ -387,6 +387,9 @@ const order = (params) => { @@ -387,6 +387,9 @@ const order = (params) => {
387 const getOrders = (params) => { 387 const getOrders = (params) => {
388 let finalResult = []; 388 let finalResult = [];
389 389
  390 + if (!params.uid) {
  391 + return Promise.resolve({});
  392 + }
390 return _getOrderData(params).then(result => { 393 return _getOrderData(params).then(result => {
391 if (result.data && result.data.page_total && params.page <= result.data.page_total && result.data.order_list) { 394 if (result.data && result.data.page_total && params.page <= result.data.page_total && result.data.order_list) {
392 let count = 0; 395 let count = 0;
@@ -3,17 +3,12 @@ @@ -3,17 +3,12 @@
3 */ 3 */
4 'use strict'; 4 'use strict';
5 const serviceApi = global.yoho.ServiceAPI; 5 const serviceApi = global.yoho.ServiceAPI;
6 -const _ = require('lodash');  
7 6
8 /** 7 /**
9 * 从接口获取 share 内容 8 * 从接口获取 share 内容
10 * @returns {*|Promise.<TResult>} 9 * @returns {*|Promise.<TResult>}
11 */ 10 */
12 const getShareContent = (params) => { 11 const getShareContent = (params) => {
13 - if (!_.isNumber(params.shareId)) {  
14 - return Promise.resolve({});  
15 - }  
16 -  
17 return serviceApi.get('operations/api/v5/webshare/getShare', { 12 return serviceApi.get('operations/api/v5/webshare/getShare', {
18 share_id: params.shareId 13 share_id: params.shareId
19 }).then(result => { 14 }).then(result => {