checksession的完整流程是这样吗?
wx.checkSession({ success() { console.log( "checksession success" ) wx.getStorage({ key: '3rd_session' , success: function (res) { console.log(res) var url = "url" ; var data = res.data; var method = "POST" ; var header = { 'content-type' : 'application/json' } http.ajax(url, method, data, header) .then( function (res) { console.log(res) }) . catch ( function (err) { }) }, }) }, // 检查3rd_session失败 fail() { // 登陆 wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId console.log(res.code);
var method = "POST" var data = { code: res.code, nickName: nick, avatarUrl: avatar }; var header = { 'content-type' : 'application/json' }; http.ajax(url, method, data, header) .then( function (response) { console.log(response.data.token) wx.setStorage({ key: '3rd_session' , data: response.data.token, }); }) . catch ( function (error) { console.log(error) }) } }) } }) |
请问一下是否是这样的?