微信授权

 Api.pay.wechatGetOpenId().then(res => { // 请求授权接口
    if (res.data.openId === 'null') {
      let http = `${Api.pay.CHECK_OPENID}?url=${window.location.href}&activitycode="wechat"&channelCode=artron`
      location.href = http
    } else {
      let queryUrl = res.data
      localStorage['userDbId'] = queryUrl.memberId
      localStorage['unionId'] = queryUrl.unionId
      localStorage['openId'] = queryUrl.openId
    }
  })
var wechatApi_ = httpUrl.Host_P+httpUrl.WECHAT_PROJECT_NAME+"/wechat/getopenid"
  $.ajax({
        type: "GET",
        url: wechatApi_,
        dataType:'json',
        success: function(res){
          if (res.openId === 'null') {
          var http = httpUrl.Host_P+httpUrl.WECHAT_PROJECT_NAME+'/wechat/wechatindex?url='+window.location.href+'&activitycode="wechat"&channelCode=artron';
          location.href = http;
        } else {
          var queryUrl = res;
          localStorage['userDbId'] = queryUrl.memberId;
          localStorage['unionId'] = queryUrl.unionId;
          localStorage['openId'] = queryUrl.openId;
        }
      }
    }); 

你可能感兴趣的:(微信授权)