protected void Application_End(object sender, EventArgs e) { // 在应用程序关闭时运行的代码 //解决应用池回收问题 //System.Threading.Thread.Sleep(5000); //Random rd = new Random(); //string strUrl = CommonHelp.GetConfig("APITX") + "&r=" + rd.Next(); //HttpWebResponse ResponseDataXS = CommonHelp.CreateHttpResponse(strUrl, null, 0, "", null, "GET"); //string Returndata = new StreamReader(ResponseDataXS.GetResponseStream(), Encoding.UTF8).ReadToEnd(); //更新AccessToken new JH_Auth_LogB().InsertLog("Application_End", "Application关闭", "Global.asax", "System", "www.lstobacco.com", 0, ""); WXFWHelp.UpdateTokenByTimer(); }
protected void Page_Load(object sender, EventArgs e) { //零售系统的消费者授权页面 if (!string.IsNullOrWhiteSpace(code)) { //OAuthAccessTokenResult u = WXFWHelp.GetWXUserOAuth(code); WX_User u = WXFWHelp.GetWXUserInfoWithUpdateLocal(code); if (u != null) { string redirectpage = "http://order.lstobacco.com:5222/tobacco_customer?openId=" + u.Openid; Response.Redirect(redirectpage); } else { Response.Write("获取用户信息失败!"); } } else { Response.Write("参数错误!"); } }
protected void Page_Load(object sender, EventArgs e) { bool IsZiLvXiaoZu = false; //授权返回 if (code.Length > 0) { WX_User u = WXFWHelp.GetWXUserInfoWithUpdateLocal(code); JH_Auth_User userInfo = new JH_Auth_UserB().GetEntity(d => d.WXopenid == u.Openid && d.IsWX == 1); if (userInfo != null)//已绑定手机号和姓名 { WXFWHelp.UpdateCookieAfterSignIn(userInfo); IsZiLvXiaoZu = userInfo.ZiLvXiaoZu?.Trim().Length > 0; } else//未绑定手机号和姓名 { DateTime expires = DateTime.Now.AddMinutes(30); CommonHelp.SetCookie("openid", u.Openid, expires); Response.Redirect("/WX/BindPhone.html"); } } string redirect_uri = CommonHelp.GetCookieString("pagehistory"); if (redirect_uri.Trim().Length > 0) { Response.Redirect(HttpUtility.UrlDecode(redirect_uri)); } else//默认返回页面 { if (IsZiLvXiaoZu) { Response.Redirect("/WX/ZLXZ/Home.html"); } else { Response.Redirect("/WX/BGXT/Index.html"); } } }
protected void Page_Load(object sender, EventArgs e) { //客户零售系统的授权页面 if (!string.IsNullOrWhiteSpace(code)) { //OAuthAccessTokenResult u = WXFWHelp.GetWXUserOAuth(code); WX_User u = WXFWHelp.GetWXUserInfoWithUpdateLocal(code); if (u != null) { JH_Auth_User userInfo = new JH_Auth_UserB().GetEntity(d => d.WXopenid == u.Openid && d.IsWX == 1); if (userInfo != null)//已绑定手机号和姓名 { //如果姓名、身份证、手机号、专卖证号其中一项为空,则跳转到绑定页面 if (string.IsNullOrEmpty(userInfo.IDCard) || string.IsNullOrEmpty(userInfo.UserRealName) || string.IsNullOrEmpty(userInfo.mobphone) || string.IsNullOrEmpty(userInfo.ToMonoLicense)) { RedirectTomo(u.Openid); } else { string redirectpage = "http://order.lstobacco.com:5222/tobacco_logist?licenseCode=" + userInfo.ToMonoLicense; Response.Redirect(redirectpage); } } else { RedirectTomo(u.Openid); } } else { Response.Write("获取用户信息失败!"); } } else { Response.Write("参数错误!"); } }
public void TimerNow(object source, System.Timers.ElapsedEventArgs e) { //new JH_Auth_LogB().InsertLog("Application_Start", "Application启动", "Global.asax", "System", "www.lstobacco.com", 0, ""); WXFWHelp.UpdateTokenByTimer(); }