首先我们需要获取到用户的openid:
onLaunch:function(){
wx.login({
success: function (res) {
wx.request({
url: 'https://api.weixin.qq.com/sns/jscode2session?appid=' + d.ID + '&secret=' + d.Secret + '&js_code=' + res.code + '&grant_type=authorization_code',
method: 'get',
success: function (res) {
that.globalData.openid = res.data.openid;
console.log("0:"+that.globalData.openid);
console.log("openid:"+res.data.openid);
console.log(res);
}
})
}, fail: function (res) {
r