Showing
2 changed files
with
21 additions
and
1 deletions
@@ -6,6 +6,10 @@ const cache = global.yoho.cache; | @@ -6,6 +6,10 @@ const cache = global.yoho.cache; | ||
6 | const sign = global.yoho.sign; | 6 | const sign = global.yoho.sign; |
7 | const api = global.yoho.API; | 7 | const api = global.yoho.API; |
8 | 8 | ||
9 | +const Promise = require('bluebird'); | ||
10 | + | ||
11 | +const cartApi = require('./cart-api'); | ||
12 | + | ||
9 | const Auth = { | 13 | const Auth = { |
10 | signin(type, area, profile, password, shoppingKey) { | 14 | signin(type, area, profile, password, shoppingKey) { |
11 | let _that = this; | 15 | let _that = this; |
@@ -108,7 +112,7 @@ const Auth = { | @@ -108,7 +112,7 @@ const Auth = { | ||
108 | return api.get('', param); | 112 | return api.get('', param); |
109 | }, | 113 | }, |
110 | syncUserSession(uid, req, res) { | 114 | syncUserSession(uid, req, res) { |
111 | - return Auth.profile(uid).then((userInfo) => { | 115 | + return Promise.all([Auth.profile(uid), cartApi.goodsCount(uid)]).spread((userInfo, count) => { |
112 | let token = sign.makeToken(uid); | 116 | let token = sign.makeToken(uid); |
113 | let data = userInfo.data; | 117 | let data = userInfo.data; |
114 | let encryptionUid = aes.encryptionUid(data.uid); | 118 | let encryptionUid = aes.encryptionUid(data.uid); |
apps/passport/models/cart-api.js
0 → 100644
-
Please register or login to post a comment