public void SendCode() { string mobilePhone = Context.Request.Form["mobilePhone"]; if (!mobilePhone.IsPhone()) { Response.Write("{\"result\":\"-2\",\"msg\":\"手机号格式不对\"}"); Response.End(); } var model = new UserBLL().GetUserBasicInfoModelByTelNo(mobilePhone); if (model == null) { Response.Write("{\"result\":\"-1\",\"msg\":\"手机号未在团贷网注册\"}"); Response.End(); } string err = ""; var ulist = RedisServerStack.StringGet <List <account_manager.WeiXinUser> >(TdConfig.ApplicationName, "/redis/web", GlobalUtils.OpenId, ref err); if (ulist != null && ulist.Exists(o => o.UserId == model.Id)) { Response.Write("{\"result\":\"-3\",\"msg\":\"账号已在微信绑定列表中\"}"); Response.End(); } var result = new CodeRecordBLL().IsCanSendNewCodeRecord(mobilePhone, MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, model.Id); if (!result.Success) { Response.Write("{\"result\":\"" + result.Code.ToString() + "\",\"msg\":\"" + result.Message + "\"}"); Response.End(); } var code = new CodeRecordBLL().CreateCodeRecordInfo(model.Id, "", MsCodeType.PhoneCode, MsCodeType2.BindWeiXinOpenId, mobilePhone); if (code != null) { var parameters = new Dictionary <string, object>(); parameters.Add("ValidateCode", code.Code); var msgSender = new BusinessDll.MessageSend(); msgSender.SendMessage2(option: SendOption.Sms, eventCode: MessageTemplates.ValidateCode, parameters: parameters, mobile: mobilePhone); Response.Write("{\"result\":\"1\",\"msg\":\"已发送,3分钟后可重新获取。\"}"); Response.End(); } else { Response.Write("{\"result\":\"0\",\"msg\":\"验证码发送失败,请重试。\"}"); Response.End(); } }
//获取亲新团贷网公告 private void GetNoticelist() { string newsApi = GlobalUtils.NewsApiUrl + "/wap/tuandai-newest-notice.html"; try { string apiResponse = HttpUtils.HttpGet(newsApi); if (!string.IsNullOrEmpty(apiResponse)) { nrr = JsonConvert.DeserializeObject <NewsRequestResult>(apiResponse); } } catch (Exception ex) { TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "获取公告", "获取公告", "获取首页公告错误" + ex.Message); } try { string err = ""; var people = RedisServerStack.StringGet <TotalUser>(TdConfig.ApplicationName, "/redis/web", "WEB_SITE_DATA", ref err); if (people != null) { totalPeople = people.totalUser; } else { string totalUserApiUrl = ConfigurationManager.AppSettings["TotalUserApiUrl"]; //http://allstation-data-service.paiconf.com/ http://10.100.12.51:42003/ string apiResponse = HttpUtils.HttpGet(totalUserApiUrl + "allstation-bigdata-service/website_data/adddate", 5); if (!string.IsNullOrEmpty(apiResponse)) { var res = JsonConvert.DeserializeObject <ResponseTotalUser>(apiResponse); if (res != null && res.data != null) { totalPeople = res.data.totalUser; } } } } catch (Exception ex) { TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "获取投资人数", "获取投资人数", "获取投资人数错误" + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { CurrTel = new UserBLL().GetUserBasicInfoModelById(WebUserAuth.UserId.Value).TelNo; if (string.IsNullOrEmpty(CurrTel)) { CurrTel = "1********"; } CookieHelper.WriteCookie("shellben4tel", Tool.Common.Utils.StringHandler.MaskTelNo(CurrTel)); string cmd = Request.QueryString["cmd"]; if (cmd == "notbind") { NotBind(); return; } if (GlobalUtils.IsWeiXinBrowser) { try { string code = WEBRequest.GetQueryString("code"); string openId = WEBRequest.GetQueryString("openid"); if (openId.IsNotEmpty()) { GlobalUtils.WriteOpenIdToCookie(openId); } ThirdLoginSDK sdk = new ThirdLoginSDK(); sdk.InitSDK(ThirdLoginSDK.ThirdLoginType.WeiXin); //获取微信上用户信息 wxUserInfo = sdk.GetWXUserSubscribeInfor(code, openId.ToText()); if (wxUserInfo != null && !string.IsNullOrEmpty(wxUserInfo.nickname)) { CookieHelper.WriteCookie("shellben4wxname", wxUserInfo.nickname); openId = wxUserInfo.openid; } TuanDai.LogSystem.LogClient.LogClients.TraceLog(TdConfig.ApplicationName, "GetWeiXinUserInfo", "", JsonConvert.SerializeObject(wxUserInfo)); var posturl = GlobalUtils.MsgApiUrl; string err = ""; var descStr = TuanDai.WXSystem.Core.Common.MsgDesc.GetDescStr("{\"Data\":{\"WeiXinOpenId\":\"" + openId + "\"}}"); TuanDai.LogSystem.LogClient.LogClients.TraceLog(TdConfig.ApplicationName, "GetWeiXinUserInfo123", "", descStr); string resp = HttpClient.HttpUtil.HttpPostJson(TdConfig.ApplicationName, posturl + "/4/GetUserIdsByWeixinOpenId", descStr, out err, null, 3); if (!string.IsNullOrEmpty(resp)) { var returnmsg = JsonConvert .DeserializeObject <TuanDai.WXSystem.Core.Common.MsgApiResponseMessage <List <string> > >( resp); if (returnmsg != null) { if (returnmsg.Data.Count > 0) { foreach (var item in returnmsg.Data) { if (!uList.Exists(o => o.UserId == Guid.Parse(item))) { WeiXinUser user = new WeiXinUser(); user.UserId = Guid.Parse(item); user.DescUserId = Tool.DESC.EncryptTripleDES(user.UserId.ToString()); var tduser = new UserBLL().GetUserBasicInfoModelById(user.UserId); if (tduser != null && !string.IsNullOrEmpty(tduser.TelNo)) { user.Tel = tduser.TelNo; } uList.Add(user); } } uList = uList.Where(o => o.Tel.IsNotEmpty()).ToList(); if (uList != null && uList.Count > 0) { if (uList.Exists(o => o.UserId == WebUserAuth.UserId.Value)) { firstUser = uList.Where(o => o.UserId == WebUserAuth.UserId.Value).FirstOrDefault(); } else { firstUser = uList[0]; } } string redisErr = ""; RedisServerStack.StringSet(TdConfig.ApplicationName, "/redis/web", openId, uList, ref redisErr); } } } } catch (Exception ex) { TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "GetWeiXinUserInfo", WebUserAuth.UserId.Value.ToString(), "获取用户微信信息失败"); Response.Redirect("my_account.aspx", true); //Response.End(); } } else { Response.Redirect("my_account.aspx", true); //Response.End(); } if (wxUserInfo == null) { wxUserInfo = new ThirdLoginSDK.WXOAuthUser(); } }
//获取头部广告图 private void GetBannerList() { BannerList = new List <ProjectAdImageInfo>(); List <TempImage> bl = null; List <TempImage> bannerRedisList = null; try { string err = ""; //var bl = RedisServerStack.HashGet<List<TempImage>>(TdConfig.ApplicationName, "/redis/web", "DefaultInfoAd","touch_index", ref err); string returnJson = Tool.HttpUtils.HttpGet(GlobalUtils.BannerApiUrl + "/interActive/position/advertises?advertise_position=touch_index", 2); if (!string.IsNullOrEmpty(returnJson)) { var ir = JsonConvert.DeserializeObject <ImageRequestResult>(returnJson); bl = ir.data; TuandaiCommnetTool.BaseCommon.TaskAsyncHelper.RunAsync(() => { try { RedisServerStack.HashSet <List <TempImage> >(TdConfig.ApplicationName, "/redis/web", "mBanner", "touch_index", bl, ref err); } catch (Exception ex) { TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "写入广告图redis", "写入广告图redis", "写入广告图redis错误:" + ex.Message); } }); } else { TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "接口获取广告图", "接口获取广告图", "接口获取广告图错误"); } if ((bl == null || bl.Count == 0)) { bannerRedisList = RedisServerStack.HashGet <List <TempImage> >(TdConfig.ApplicationName, "/redis/web", "mBanner", "touch_index", ref err); if (bannerRedisList != null && bannerRedisList.Count > 0) { bl = bannerRedisList; } } if (bl != null && bl.Count > 0) { foreach (var item in bl) { if (item.startTime <= DateTime.Now && DateTime.Now <= item.endTime) { ProjectAdImageInfo ai = new ProjectAdImageInfo(); ai.Link = item.url; ai.ImageUrl = item.picUrl; ai.AddDate = item.startTime; ai.Title = item.title; ai.Desc = item.title; BannerList.Add(ai); } } } } catch (Exception ex) { #region 广告图接口异常处理 string err = ""; bannerRedisList = RedisServerStack.HashGet <List <TempImage> >(TdConfig.ApplicationName, "/redis/web", "mBanner", "touch_index", ref err); if ((bl == null || bl.Count == 0) && bannerRedisList != null) { bl = bannerRedisList; } if (bl != null && bl.Count > 0) { foreach (var item in bl) { if (item.startTime <= DateTime.Now && DateTime.Now <= item.endTime) { ProjectAdImageInfo ai = new ProjectAdImageInfo(); ai.Link = item.url; ai.ImageUrl = item.picUrl; ai.AddDate = item.startTime; ai.Title = item.title; ai.Desc = item.title; BannerList.Add(ai); } } } #endregion TuanDai.LogSystem.LogClient.LogClients.ErrorLog(TdConfig.ApplicationName, "接口获取广告图", "接口获取广告图", "接口获取广告图错误" + ex.Message); } }