diff --git a/app.js b/app.js index c5d9e16..765c312 100644 --- a/app.js +++ b/app.js @@ -8,7 +8,9 @@ App({ this.jsonModel = jsonApi.JsonApiDataStoreModel this.globalData.code = wx.getStorageSync('code') - this.getUserInfo() + this.getUserInfo(function(res) { + that.globalData.wechatUserType = res.data.wechat_user_type + }) this.request({ url: `${that.globalData.API_URL}/manage_features`, success: function(res) { that.globalData.featureManager = res.data } @@ -122,6 +124,7 @@ App({ }, globalData:{ + wechatUserType: 'normal', featureManager: {}, userInfo: null, currentCustomer: null, diff --git a/utils/profile.js b/utils/profile.js index b5819d8..04e7160 100644 --- a/utils/profile.js +++ b/utils/profile.js @@ -58,6 +58,20 @@ function getPassCode (mobile, cb) { }) } +function postEncryptedData(resolve) { + app.request({ + method: 'POST', + url: `${app.globalData.API_URL}/sessions/wechat_user_type`, + data: { + code: app.globalData.code, + encrypted: app.globalData.encrypted, + userInfo: app.globalData.userInfo + }, + success: resolve, + fail: function(res) {} + }) +} + module.exports = { getZichanSlides (resolve) { return getZichanSlides(resolve) @@ -67,5 +81,9 @@ module.exports = { }, getPassCode (mobile, cb) { return getPassCode(mobile, cb) + }, + + postEncryptedData (resolve) { + return postEncryptedData(resolve) } } \ No newline at end of file