/// <summary> /// 授权判断,页面跳转 /// </summary> /// <param name="state"></param> /// <param name="targetUrl">目标地址</param> public void OAuth2BaseProc(Model.wx_userweixin model, string state, string targetUrl) { BLL.wx_property_info propertyBll = new BLL.wx_property_info(); Model.wx_property_info propertyEntity = propertyBll.GetModelByIName(wid, MXEnums.WXPropertyKeyName.OpenOauth.ToString()); if (propertyEntity.iContent == "0") { //关闭了网页授权 openid = MyCommFun.RequestOpenid(); } else { string code = MyCommFun.QueryString("code"); if (code == null || code.Trim() == "") { if (targetUrl == null || targetUrl.Trim() == "") { targetUrl = MyCommFun.getTotalUrl(); } //thisUrl = MyCommFun.getWebSite() + "/weixin/huodong/index.aspx"; string newUrl = OAuthApi.GetAuthorizeUrl(model.AppId, targetUrl, state, OAuthScope.snsapi_base); // WXLogs.AddLog(model.id, "OAuth授权跳转页面", "获得OAuth2BaseProc", newUrl); Response.Redirect(newUrl); } else { var result = OAuthApi.GetAccessToken(model.AppId, model.AppSecret, code); openid = result.openid; } } }
private void ShowInfo() { Model.wx_userweixin weixin = GetWeiXinCode(); lblWeixinName.Text = weixin.wxName; lblAppid.Text = weixin.AppId; BLL.wx_payment_wxpay wxpayBll = new wx_payment_wxpay(); Model.wx_payment_wxpay model = wxpayBll.GetModelByWid(weixin.id); if (model == null || model.id == 0) { //新增记录 } else { //修改 hidId.Value = model.id.ToString(); this.txtmch_id.Text = model.mch_id; this.txtpaykey.Text = model.paykey; this.txtcertInfoPath.Text = model.certInfoPath; this.txtcerInfoPwd.Text = model.cerInfoPwd; } BLL.wx_property_info propertyBll = new wx_property_info(); Model.wx_property_info propertyEntity = propertyBll.GetModelByIName(weixin.id, MXEnums.WXPropertyKeyName.OpenOauth.ToString()); if (propertyEntity != null) { radOpenOAuth.SelectedValue = propertyEntity.iContent; hidOpenOauthId.ID = propertyEntity.id.ToString(); } }