Commit 7c9e9aecb60d1ae63c6443bd7bcd9db6ae50ec9d

Authored by vking
1 parent a63ecd00

welcome

@@ -125,12 +125,16 @@ App({ @@ -125,12 +125,16 @@ App({
125 }) 125 })
126 }) 126 })
127 }, 127 },
128 - async _getLiteOpenidByCode(code){ 128 + async _getLiteOpenidByCode(code,app_unionid){
129 return new Promise((success,fail)=>{ 129 return new Promise((success,fail)=>{
  130 + let params={code:code}
  131 + if(app_unionid){
  132 + params.unionid=app_unionid
  133 + }
130 wx.request({ 134 wx.request({
131 url: uri_dc.HOST__LINE+'App.Reserve.GetLiteOpenid', 135 url: uri_dc.HOST__LINE+'App.Reserve.GetLiteOpenid',
132 method: 'POST', 136 method: 'POST',
133 - data: {code:code}, 137 + data: params,
134 header: { 138 header: {
135 'content-type': 'application/x-www-form-urlencoded' 139 'content-type': 'application/x-www-form-urlencoded'
136 }, 140 },
@@ -152,20 +156,20 @@ App({ @@ -152,20 +156,20 @@ App({
152 }) 156 })
153 }) 157 })
154 }, 158 },
155 - async _getOpenid(){ 159 + async _getOpenid(app_unionid){
156 try{ 160 try{
157 let login_res=await this._login(); 161 let login_res=await this._login();
158 - let openid=await this._getLiteOpenidByCode(login_res.code) 162 + let openid=await this._getLiteOpenidByCode(login_res.code,app_unionid)
159 return openid 163 return openid
160 }catch(e){ 164 }catch(e){
161 console.log('_getOpenid.catch',e) 165 console.log('_getOpenid.catch',e)
162 return this._getOpenid(); 166 return this._getOpenid();
163 } 167 }
164 }, 168 },
165 - async getOpenid(){ 169 + async getOpenid(app_unionid=''){
166 let openid=wx.getStorageSync('customer_openid'); 170 let openid=wx.getStorageSync('customer_openid');
167 if(!openid){ 171 if(!openid){
168 - openid= await this._getOpenid(); 172 + openid= await this._getOpenid(app_unionid);
169 } 173 }
170 this.openid=openid 174 this.openid=openid
171 return openid; 175 return openid;
@@ -12,7 +12,9 @@ Page({ @@ -12,7 +12,9 @@ Page({
12 * 生命周期函数--监听页面加载 12 * 生命周期函数--监听页面加载
13 */ 13 */
14 onLoad: function (options) { 14 onLoad: function (options) {
15 - 15 + if(options.unionid){
  16 + getApp().getOpenid(options.unionid)
  17 + }
16 }, 18 },
17 19
18 /** 20 /**