public ActionResult SaveBindMobile(string phone, string code) { try { if (string.IsNullOrWhiteSpace(phone) || !new Regex("^1[0-9]{10}$").Match(phone).Success) { throw new MyException("手机号码格式错误"); } CheckBindTradePasswordCode(code, phone); bool result = WeiXinAccountService.WXBindingMobilePhone(WeiXinUser.AccountID, phone); if (!result) { throw new MyException("绑定失败"); } RemoveTradePasswordCooike(); WeiXinUser.MobilePhone = phone; Session["SmartSystem_WX_Info"] = WeiXinUser; return(Json(MyResult.Success())); } catch (MyException ex) { return(Json(MyResult.Error(ex.Message))); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "绑定手机号失败", ex, LogFrom.WeiXin); return(Json(MyResult.Error("绑定失败"))); } }
public ActionResult Index() { //ParkCarDerateServices.QueryBySellerIdAndIORecordId("46f54c5e-ada9-4efe-9552-a8560130a960", "6fe28c13-716a-48d1-b1ba-a8ee00061572"); //string geng = Server.MapPath("~/TempFile/20180526"); //string savepath = Server.MapPath("~/TempFile/201805263.zip"); //ZipHelper.ZipFiles(geng, savepath); Stopwatch watch = Stopwatch.StartNew();//创建一个监听器 for (var i = 0; i <= 100; i++) { TxtLogServices.WriteTxtLogEx("Test", "开始"); var user = WeiXinAccountService.QueryWXByOpenId("oussCwE6unIvKaG-1wec-B7n3J0Q"); //DateTime ts2 = DateTime.Now; //TimeSpan ts3 = ts1.Subtract(ts2).Duration(); TxtLogServices.WriteTxtLogEx("Test", "结束"); Thread.Sleep(10000); //DateTime ts1 = DateTime.Now; //var user = WeiXinAccountService.QueryWXByOpenId("oussCwE6unIvKaG-1wec-B7n3J0Q"); ////DateTime ts2 = DateTime.Now; ////TimeSpan ts3 = ts1.Subtract(ts2).Duration(); //TxtLogServices.WriteTxtLogEx("Test", watch.ElapsedMilliseconds.ToString()); //Thread.Sleep(10000); } watch.Stop(); var redirectUrl = "http://park.xinfu.info/r/ParkingPayment_Index_moduleid=2^cid=f50a5dee-d098-4100-a370-a7ca017ab4cf"; string strRedirectUrl = HttpUtility.UrlEncode(redirectUrl); //WXApiConfigServices.QueryWXApiConfig //WX_ApiConfig confing = WXApiConfigServices.QueryWXApiConfig("83495fa0-611f-497a-9e10-a78c009f66cd"); string s = string.Empty; //cd1e590c-e91e-45f7-b7d6-a75300e652a9^pn=ÔÁB88765 //byte[] result = WXQRCodeServices.GenerateByteQRCode("http://ykt.bsgoal.net.cn", "cd1e590c-e91e-45f7-b7d6-a75300e652a9", "粤B88765", 430, ""); //System.IO.MemoryStream ms = new System.IO.MemoryStream(result); //System.Drawing.Image img = System.Drawing.Image.FromStream(ms); //string filePath = string.Format("/Uploads/QRCode/{0}.{1}", "test111111111", "jpg"); //string absolutePath = System.Web.HttpContext.Current.Server.MapPath(filePath); //img.Save(absolutePath, ImageFormat.Jpeg); //DateTime t1 = DateTime.Now.AddMinutes(-10).AddSeconds(-2); //DateTime t2 = DateTime.Now; //string s = t1.GetParkingDuration(t2); //string s = "1 2 34 5566".PlateNumberToUpper(); //JsonObject obj = new JsonObject(); //PlatformOrderBLL.ManualRefund(123123, ""); //string v = XmlConfig.GetValue("PromptAttentionPage"); //string openid = "odvkywSnlKr8anm3ddoIcredwvN0"; //string url = "http://wx.qlogo.cn/mmopen/gKlic31XKbJ7BOJyEvicpgpW0ym5rfqGS0ibBSWLVOlDaSm4QZ1vCqEAxKohVtuj3fEn1vHfia6Y4fXEN9zXhxrhuRmMgoELyBll/0"; //WeiXinBaseInfo.DownloadHeadImg(openid, url); //RoutematrixService.GetRoutematrix("113.977295", "22.731472", "113.687295", "22.761472"); //List<BaseParkinfo> parks = QueryParkingService.QueryParkinfo("22.735069".ToDouble(), "113.988769".ToDouble(), 4000); //WX_ApiConfig config = GetApiConfig("moduleid=2^cid=0642cbb1-d55d-4629-855d-a73c0100397b"); return(View()); }
protected override IWRespBase DoForRequest_Event_Unsubscribe(WReqEventUnSubscribe request) { if (user != null) { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "DoForRequest_Event_Unsubscribe"); bool result = WeiXinAccountService.WXUnsubscribe(user.OpenID); TxtLogServices.WriteTxtLogEx("WeiXinConversation", "DoForRequest_Event_Unsubscribe Result:{0}", result?"1":"0"); } var response = request.CreateResponse <WRespText>(); response.Content = "取消关注成功!"; return(response); }
protected override IWRespBase DoForRequest_Event_Subscribe(WReqEventSubscribe request) { if (user != null) { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "DoForRequest_Event_Subscribe"); user.FollowState = (int)WxUserState.Attention; user.LastSubscribeDate = DateTime.Now; user.SubscribeTimes = user.SubscribeTimes + 1; bool result = WeiXinAccountService.EditWXInfo(user); TxtLogServices.WriteTxtLogEx("WeiXinConversation", "DoForRequest_Event_Subscribe REsult:{0}", result?"1":"0"); } var gResponse = RequestToKey.GoGKey(config, ReplyType.Subscribe, string.Empty, request); return(gResponse); }
public ActionResult CheckBindMobile() { try { WX_Account account = WeiXinAccountService.GetAccountByID(WeiXinUser.AccountID); if (account != null && !string.IsNullOrWhiteSpace(account.MobilePhone)) { return(Json(MyResult.Success(account.MobilePhone))); } return(Json(MyResult.Error("未绑定"))); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "检查是否绑了手机好失败", ex, LogFrom.WeiXin); return(Json(MyResult.Error(""))); } }
public JsonResult WeixinBingPhone(string phone, string code) { JsonResult res = new JsonResult(); VerifyCode verify = wxApi.getBingding(phone, code, WeiXinUser.OpenID, WeiXinUser.OpenID); string sUrl = ""; if (verify.Status == 1) { sUrl = "/l/ParkingPayment_ComputeNewParkingFee_moduleid=3%5Ecid=" + CurrLoginWeiXinApiConfig.CompanyID; //绑定成功了 再平台上也添加一个用户 bool result = WeiXinAccountService.WXBindingMobilePhone(WeiXinUser.AccountID, phone); WeiXinUser.MobilePhone = phone; if (!result) { TxtLogServices.WriteTxtLogEx("WXBindError", "用户绑定手机失败:{0}", result); } } var bangding = new { Status = verify.Status, Result = verify.Result, Url = sUrl }; res.Data = bangding; return(res); }
public override void OnExecuting() { try { user = WeiXinAccountService.QueryWXByOpenId(OpenId); if (user == null || (WxUserState)user.FollowState == WxUserState.UnAttention) { bool IsNewAdd = user == null; user = WxUserInfo.GetWxUserBaseInfo(config, OpenId); if (user == null) { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "拉取微信用户信息失败,OPENID:{0}", OpenId); return; } user.OpenID = OpenId; user.UserType = 0; user.FollowState = (int)WxUserState.Attention; user.CompanyID = config.CompanyID; bool result = false; if (IsNewAdd) { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "RegisterAccount"); result = WeiXinAccountService.RegisterAccount(user); TxtLogServices.WriteTxtLogEx("WeiXinConversation", string.Format("RegisterAccount Result:{0}", result ? "1" : "0")); } else { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "EditWXInfo"); result = WeiXinAccountService.EditWXInfo(user); TxtLogServices.WriteTxtLogEx("WeiXinConversation", string.Format("EditWXInfo Result:{0}", result ? "1" : "0")); } if (result) { user = WeiXinAccountService.QueryWXByOpenId(OpenId); } string resultDes = result ? "成功" : "失败"; TxtLogServices.WriteTxtLogEx("WeiXinConversation", "保存微信用户信息{0},OPENID:{1}", resultDes, OpenId); } else { //每7天或头像为空时更新一次微信用户信息 if (user.LastSubscribeDate < DateTime.Now.AddDays(-7) || string.IsNullOrWhiteSpace(user.Headimgurl)) { WX_Info newUser = WxUserInfo.GetWxUserBaseInfo(config, OpenId); if (newUser == null) { TxtLogServices.WriteTxtLogEx("WeiXinConversation", "更新时拉取微信用户信息失败,OPENID:{0}", OpenId); return; } TxtLogServices.WriteTxtLogEx("WeiXinConversation", "Update"); newUser.AccountID = user.AccountID; newUser.OpenID = OpenId; newUser.UserType = 0; newUser.CompanyID = config.CompanyID; bool result = WeiXinAccountService.EditWXInfo(newUser); TxtLogServices.WriteTxtLogEx("WeiXinConversation", string.Format("Update Result:{0}", result ? "1" : "0")); } } } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, string.Format("创建微信账号或者更新微信账号信息失败,OPENID:{0}", OpenId), LogFrom.WeiXin); TxtLogServices.WriteTxtLogEx("WeiXinConversation", ex); } }
//public string AppUserToken //{ // get // { // var cookie = HttpContext.Current.Request.Cookies["SmartSystem_APP_UserToken"]; // if (cookie != null && !string.IsNullOrWhiteSpace(cookie.Value)) // { // return cookie.Value; // } // return string.Empty; // } // set // { // var cookie = HttpContext.Current.Request.Cookies["SmartSystem_APP_UserToken"]; // if (cookie == null) // { // cookie = new HttpCookie("SmartSystem_APP_UserToken"); // cookie.Expires = DateTime.Now.AddYears(1); // cookie.Value = value; // HttpContext.Current.Request.Cookies.Add(cookie); // } // else // { // cookie.Value = value; // HttpContext.Current.Request.Cookies.Set(cookie); // } // } //} public override void OnAuthorization(AuthorizationContext filterContext) { try { var openId = string.Empty; WX_Info user = null; var cookie = filterContext.RequestContext.HttpContext.Request.Cookies["SmartSystem_WeiXinOpenId"]; if (cookie != null && !string.IsNullOrWhiteSpace(cookie.Value)) { openId = cookie.Value; } var permission = Roles.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (permission.Contains("Login")) { if (string.IsNullOrWhiteSpace(openId)) { #if DEBUG //odvkywUwtjaKnj7yGN-df7XV6ru4,odvkywSnlKr8anm3ddoIcredwvN0,oaC2Qt5oZsvPH_hlz0MoEw0sK2yg openId = "ohqkK00bNhbFKWniuJyMsSXivoXc";//"o-Xw8wzQE2QmB-x5zehYlVdxcs5M"; #endif } if (string.IsNullOrWhiteSpace(openId)) { //如果获取不到cookie中的微信uid则跳转至appRedir TxtLogServices.WriteTxtLogEx("CheckWeiXinPurview", "Request.Url.PathAndQuery:{0}", filterContext.RequestContext.HttpContext.Request.Url.PathAndQuery); var queryString = filterContext.RequestContext.HttpContext.Request.Url.PathAndQuery.TrimStart('/').Replace('/', '_').Replace('?', '_').Replace('&', '^'); TxtLogServices.WriteTxtLogEx("CheckWeiXinPurview", "请求获取微信信息 queryString:{0}", queryString); filterContext.HttpContext.Response.Redirect(string.Format("~/L/Index?id={0}", queryString)); filterContext.HttpContext.Response.End(); filterContext.Result = new EmptyResult(); return; } } if (filterContext.HttpContext.Session["SmartSystem_WX_Info"] != null) { user = (WX_Info)filterContext.HttpContext.Session["SmartSystem_WX_Info"]; } if (user == null) { user = WXotherServices.GetWXInfo(openId); //user = WeiXinAccountService.QueryWXByOpenId(openId); } if (user == null || (WxUserState)user.FollowState == WxUserState.UnAttention) { string companyId = user == null ? string.Empty : user.CompanyID; string value = WXOtherConfigServices.GetConfigValue(companyId, ConfigType.PromptAttentionPage); if (string.IsNullOrWhiteSpace(value)) { value = "~/ErrorPrompt/Index?message=请关注SPS停车服务微信公众号"; } //返回错误页面 (请求关注页面) filterContext.HttpContext.Response.Redirect(value); filterContext.HttpContext.Response.End(); filterContext.Result = new EmptyResult(); return; } HttpContext.Current.Session["SmartSystem_LogFrom"] = LogFrom.WeiXin; HttpContext.Current.Session["SmartSystem_OperatorUserAccount"] = user.OpenID; filterContext.HttpContext.Session["SmartSystem_WX_Info"] = user; if (user == null) { TxtLogServices.WriteTxtLogEx("CheckWeiXinPurview", "微信用户不存在,OPENID:{0}", openId); } //RegisterAccount if (permission.Contains("REGISTERACCOUNT")) { WX_Account account = WeiXinAccountService.GetAccountByID(user.AccountID); if (account == null || string.IsNullOrWhiteSpace(account.MobilePhone)) { var queryString = filterContext.RequestContext.HttpContext.Request.Url.PathAndQuery; if (filterContext.RequestContext.HttpContext.Request["returnUrl"] != null) { queryString = filterContext.RequestContext.HttpContext.Request["returnUrl"]; } filterContext.HttpContext.Response.Redirect(string.Format("~/BindMobile/Index?returnUrl={0}", queryString)); filterContext.HttpContext.Response.End(); filterContext.Result = new EmptyResult(); return; } } //if (permission.Contains("APP")) //{ // //TradePassword // string sToken = AppUserToken; // if (string.IsNullOrEmpty(sToken)) // { // TxtLogServices.WriteTxtLogEx("ParkingPayment", "TOKEN = {0} ", "null or ''"); // } // else // { // TxtLogServices.WriteTxtLogEx("ParkingPayment", "TOKEN,id:{0},Status:{1} ", openId, sToken); // } // do // { // //APP // if (sToken.IsEmpty()) // { // VerifyCode verify = wxApi.getThirdLogin(openId, openId); //第三方登录 // TxtLogServices.WriteTxtLogEx("ParkingPayment", "用户自动登录,id:{0},Status:{1} ", openId, verify.Status); // if (verify.Status == 1) // { // sToken = verify.Result; // AppUserToken = sToken; // return; // } // else if (verify.Status == 2) // { // //未绑定 // AppUserToken = ""; // sToken = ""; // filterContext.HttpContext.Response.Redirect("~/ParkingPayment/LicensePlatePayment"); // filterContext.HttpContext.Response.End(); // filterContext.Result = new EmptyResult(); // return; // } // else // { // //其他都是失败 // AppUserToken = ""; // sToken = ""; // filterContext.HttpContext.Response.Redirect("~/ErrorPrompt/Index?message=用户自动登录失败"); // filterContext.HttpContext.Response.End(); // filterContext.Result = new EmptyResult(); // return; // } // } // CarManage carMessage = wxApi.getCarManage(sToken); // if (carMessage == null || carMessage.Status == 40001) // { // // // AppUserToken = ""; // sToken = ""; // continue; // } // } while (sToken.IsEmpty()); //} } catch (Exception ex) { ExceptionsServices.AddExceptions(ex, "验证微信登陆信息失败", LogFrom.WeiXin); TxtLogServices.WriteTxtLogEx("CheckWeiXinPurview", ex); return; } }
public ActionResult Czmx(decimal paymoney) { string auth = AppUserToken; if (auth.IsEmpty()) { //没有登录 // return(RedirectToAction("Index", "ErrorPrompt", new { message = "用户登录失败" })); } else if (auth == "-1") { return(RedirectToAction("Register", "ParkingPayment")); } //生成一个订单 try { TxtLogServices.WriteTxtLog("4"); BaseCompany company = CompanyServices.QueryCompanyByRecordId(CurrLoginWeiXinApiConfig.CompanyID); if (company == null) { throw new MyException("获取单位信息失败"); } WX_ApiConfig config = WXApiConfigServices.QueryWXApiConfig(company.CPID); if (config == null) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "获取微信配置信息失败", "单位编号:" + company.CPID, LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信配置信息失败!" })); } if (!config.Status) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "该车场暂停使用微信支付", "单位编号:" + company.CPID, LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = "该车场暂停使用微信支付!" })); } if (config.CompanyID != WeiXinUser.CompanyID) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "微信用户所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, WeiXinUser.CompanyID), LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信用户所属公众号和当前公众号不匹配,不能支付!" })); } if (CurrLoginWeiXinApiConfig == null || config.CompanyID != CurrLoginWeiXinApiConfig.CompanyID) { string loginCompanyId = CurrLoginWeiXinApiConfig != null ? CurrLoginWeiXinApiConfig.CompanyID : string.Empty; ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "车场所属公众号和当前公众号不匹配,不能支付", string.Format("支付单位:{0},微信用户单位:{1}", config.CompanyID, loginCompanyId), LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = "车场所属公众号和当前公众号不匹配,不能支付!" })); } string sPhone = ""; //获取绑定的手机 WX_Account account = WeiXinAccountService.GetAccountByID(WeiXinUser.AccountID); if (account != null && !account.MobilePhone.IsEmpty()) { sPhone = account.MobilePhone; } if (sPhone.IsEmpty()) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "您没有绑定APP账号,不能支付!" })); } OnlineOrder model = new OnlineOrder(); model.OrderID = IdGenerator.Instance.GetId(); model.CardId = ""; model.PKID = ""; model.PKName = ""; model.EntranceTime = DateTime.MinValue; model.ExitTime = DateTime.MinValue; model.MonthNum = 0; model.Amount = paymoney; model.Status = OnlineOrderStatus.WaitPay; model.PaymentChannel = PaymentChannel.WeiXinPay; model.Payer = WeiXinUser.OpenID; model.PayAccount = WeiXinUser.OpenID; model.OrderTime = DateTime.Now; model.PayeeChannel = PaymentChannel.WeiXinPay; model.AccountID = WeiXinUser.AccountID; model.OrderType = OnlineOrderType.APPRecharge; model.PlateNo = sPhone; model.PayeeUser = config.SystemName; model.PayeeAccount = config.PartnerId; model.CompanyID = config.CompanyID; model.Remark = "APP余额充值"; bool result = OnlineOrderServices.Create(model); if (!result) { throw new MyException("余额失败[保存订单失败]"); } switch (model.PaymentChannel) { case PaymentChannel.WeiXinPay: { return(RedirectToAction("BalancePayment", "WeiXinPayment", new { orderId = model.OrderID })); } default: throw new MyException("支付方式错误"); } } catch (MyException ex) { return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/PurseData/Index" }));; } catch (Exception ex) { return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message, returnUrl = "/PurseData/Index" })); } }
public ActionResult Index(string id, string code, string state) { try { ClearSystemCache(); WX_ApiConfig config = GetApiConfig(id); if (config == null || string.IsNullOrWhiteSpace(config.AppId) || string.IsNullOrWhiteSpace(config.AppSecret) || string.IsNullOrWhiteSpace(config.Domain) || string.IsNullOrWhiteSpace(config.SystemName)) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取微信基础信息失败" })); } if (!config.Status) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "该公众账号暂停使用,请稍后再试!" })); } Session["CurrLoginWeiXinApiConfig"] = config; if (string.IsNullOrEmpty(id)) { id = "ParkingPayment_Index"; } if (Request.UserAgent != null && !Request.UserAgent.ToLower().Contains("micromessenger")) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "请在微信中打开" })); } if (string.IsNullOrEmpty(state)) { var redirectUri = config.Domain; if (string.IsNullOrWhiteSpace(redirectUri)) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "获取域名配置信息失败" })); } if (redirectUri != null) { redirectUri = redirectUri.IndexOf("http://", StringComparison.Ordinal) < 0 ? string.Format("http://{0}", redirectUri) : redirectUri; redirectUri = string.Format("{0}/r/{1}", redirectUri, id); } TxtLogServices.WriteTxtLogEx("RedirectHandle", "获取微信OpenId请求redirectUri:{0}", redirectUri); string url = WxAdvApi.GetAuthorizeUrl(config.AppId, redirectUri, "1", OAuthScope.snsapi_base); TxtLogServices.WriteTxtLogEx("RedirectHandle", "获取微信OpenId请求url:{0}", url); return(Redirect(url)); } TxtLogServices.WriteTxtLogEx("RedirectHandle", "state不为空进入,id:{0}, code:{1}, state:{2}", id, code, state); if (string.IsNullOrEmpty(code)) { return(RedirectToAction("Index", "ErrorPrompt", new { message = "微信获取授权失败,请重新进入或请联系管理员" })); } var accessToken = WxAdvApi.GetAccessToken(config.AppId, config.AppSecret, code); TxtLogServices.WriteTxtLogEx("RedirectHandle", "调用微信的AccessToken接口:openid:{0}, access_token:{1}", accessToken.openid, accessToken.access_token); var user = WeiXinAccountService.QueryWXByOpenId(accessToken.openid); string s = user == null ? "user is null" : "user is not null"; TxtLogServices.WriteTxtLogEx("RedirectHandle", s); if (user != null) { TxtLogServices.WriteTxtLogEx("RedirectHandle", "关注状态:{0}", ((WxUserState)user.FollowState).GetDescription()); } if (user == null || (WxUserState)user.FollowState == WxUserState.UnAttention) { return(RedirectAttentionPage(config.CompanyID, "请先关注公众账号")); } //添加登陆 Response.Cookies.Add(new HttpCookie("SmartSystem_WeiXinOpenId", accessToken.openid)); TxtLogServices.WriteTxtLogEx("RedirectHandle", "获取OpenId成功:openid:{0}", accessToken.openid); //登录APP string openId = accessToken.openid; string sToken = ""; VerifyCode verify = wxApi.getThirdLogin(openId, openId); //第三方登录 TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户自动登录,id:{0},Status:{1} ", openId, verify.Status); if (verify.Status == 1) { TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户自动登录成功,id:{0},Status:{1} ", openId, verify.Result); sToken = verify.Result; AppUserToken = sToken; //渠道TOKEN了 // //获取用户的信息 // ClassLibrary1.PurseData.UserInfo appUser = wxApi.getUserInfo(sToken); // if (appUser != null && appUser.Status == 1) // { // TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户,获取用户信息成功,id:{0},Status:{1} ", openId, appUser.Result.Phone); // AppUserPhone = appUser.Result.Phone; // } // else // { // TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户,获取用户信息失败,id:{0},Status:{1} ", openId, appUser.Status); // } } else if (verify.Status == 2) { TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户自动登录失败,未绑定,id:{0},Status:{1} ", openId, verify.Result); //未绑定 AppUserToken = "-1"; } else { //其他都是失败 AppUserToken = ""; sToken = ""; TxtLogServices.WriteTxtLogEx("RedirectHandle", "APP用户自动登录失败,id:{0},Status:{1} ", openId, verify.Result); } return(Redir(id, accessToken.openid)); } catch (MyException ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "id:" + id, ex, LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = ex.Message })); } catch (Exception ex) { ExceptionsServices.AddExceptionToDbAndTxt("WeiXinPageError", "RedirectHandle方法处理异常", ex, LogFrom.WeiXin); return(RedirectToAction("Index", "ErrorPrompt", new { message = "跳转链接失败" })); } }