Showing
3 changed files
with
7 additions
and
7 deletions
@@ -26,7 +26,7 @@ const check = (req, res, next) => { | @@ -26,7 +26,7 @@ const check = (req, res, next) => { | ||
26 | }); | 26 | }); |
27 | } | 27 | } |
28 | 28 | ||
29 | - res.cookie('__NEW_USER', (result.data.isNew ? 1 : 0), {domain: config.cookieDomain}); | 29 | + res.cookie('__NEW_USER', (result.isNew ? 1 : 0), {domain: config.cookieDomain}); |
30 | 30 | ||
31 | return res.json({ | 31 | return res.json({ |
32 | code: 200, | 32 | code: 200, |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -const api = global.yoho.api; | 3 | +const api = global.yoho.API; |
4 | 4 | ||
5 | -exports.getUserOrders = (uid)=>{ | 5 | +exports.getUserSuccessfulOrders = (uid)=>{ |
6 | return api.get('', { | 6 | return api.get('', { |
7 | method: 'app.SpaceOrders.get', | 7 | method: 'app.SpaceOrders.get', |
8 | uid: uid, | 8 | uid: uid, |
@@ -4,18 +4,18 @@ const _ = require('lodash'); | @@ -4,18 +4,18 @@ const _ = require('lodash'); | ||
4 | const api = require('../models/new-user-api'); | 4 | const api = require('../models/new-user-api'); |
5 | 5 | ||
6 | const check = (uid) => { | 6 | const check = (uid) => { |
7 | - return api.getUserOrders(uid).then((result) => { | 7 | + return api.getUserSuccessfulOrders(uid).then((result) => { |
8 | if (result.code !== 200) { | 8 | if (result.code !== 200) { |
9 | return {}; | 9 | return {}; |
10 | } | 10 | } |
11 | 11 | ||
12 | - if (!_.isEmpty(_.get(result, 'data.order_list', []))) { | 12 | + if (_.get(result, 'data.total', 0) !== 0) { |
13 | return { | 13 | return { |
14 | - isNew: true | 14 | + isNew: false |
15 | }; | 15 | }; |
16 | } else { | 16 | } else { |
17 | return { | 17 | return { |
18 | - isNew: false | 18 | + isNew: true |
19 | }; | 19 | }; |
20 | } | 20 | } |
21 | 21 |
-
Please register or login to post a comment