protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["code"] != null && Request.QueryString["state"] != null) { if (Oauth2Obj == null) { Oauth2Obj = wx.GetOauth2ByCode(Request.QueryString["code"]); code.Value = Oauth2Obj.openid; } var res = wx.Decode(Request.QueryString["state"]).Split(';'); Image1.ImageUrl = "Image/gift.png"; Label1.Text = "恭喜你获得赠品【" + res[2] + "】,数量【" + res[3] + "】,请确认。"; Label2.Text = "恭喜你获得赠品【" + res[2] + "】,数量【" + res[3] + "】。"; } else { Image1.ImageUrl = "Image/error_o.png"; Label1.Text = "用户未授权"; } if (!IsPostBack) jsConfig = wx.GetWXConfigStr(false, System.Configuration.ConfigurationManager.AppSettings["UrlHost"] + Request.Url.PathAndQuery, new string[] { "hideAllNonBaseMenuItem" }); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Params["code"] != null) { if (Oauth2Obj == null) { Oauth2Obj = wx.GetOauth2ByCode(Request.Params["code"]); code.Value = Oauth2Obj.openid; } var res = wx.GetUserInfoJson(Oauth2Obj.openid); if (WxMp.Common.JsonHepler.GetJsonValueByKey(res, "groupid") != "101") { content.InnerHtml = "您所在的用户组无此功能"; } else { if (!IsPostBack) jsConfig = wx.GetWXConfigStr(false, System.Configuration.ConfigurationManager.AppSettings["UrlHost"] + Request.Url.PathAndQuery, new string[] { "scanQRCode", "hideAllNonBaseMenuItem" }); } } }