/// <summary> /// 获取统计数据 /// </summary> private void GetStatistics() { try { WebSiteDataInfo websitedatemodel = null; if (IsRedis == "1") { websitedatemodel = mRedis.GetTotayInvestMoney(); } else { websitedatemodel = new WebSiteDataBLL().GetWebSiteData(); } if (websitedatemodel != null) { this.Amount = websitedatemodel.TotalAmount ?? 0; this.UserCount = websitedatemodel.TotalUser ?? 0; } BabyPlanAmount = GetBabyPlanTotalAmount(); } catch (Exception ex) { NetLog.WriteLoginHandler("首页统计异常", ex.Message + "|" + ex.StackTrace); } }
/// <summary> /// 获取统计数据 /// </summary> private void GetStatistics() { try { WebSiteDataInfo websitedatemodel = null; if (IsRedis == "1") { websitedatemodel = mRedis.GetTotayInvestMoney(); } else { websitedatemodel = new WebSiteDataBLL().GetWebSiteData(); } if (websitedatemodel != null) { this.Amount = websitedatemodel.TotalAmount ?? 0; this.UserCount = websitedatemodel.TotalUser ?? 0; this.EarnedInterest = websitedatemodel.EarnedInterest ?? 0; } this.TodayAmount = new SubscribeBLL().GetSubscribeTotalAmount(); CalcDQWebSite(); } catch (Exception ex) { NetLog.WriteLoginHandler("统计异常", ex.Message + "|" + ex.StackTrace); } }
private string UserInsertByPhone(string phone) { string pwd = new UserBLL().GetRandomPassword(8);//随机密码 if (!phone.IsPhone()) { return("手机号码格式不正确"); } string strIp = Tool.WebFormHandler.GetIP(); string[] ips = strIp.Split(','); string realIp = ips.Length > 1 ? ips[1] : ips[0]; string result = Users.UserIsRegByIP(realIp); if (result != "1") { string dt = result.Split('|')[1]; return("注册失败:为防止恶意注册,请在" + dt + "后重新注册"); } Guid userid = Guid.NewGuid(); //var model = WXRegister.AddUserInfo(userid, _app, pwd, phone, "", "", // "", "", 0, realIp); string from = _app; if (!string.IsNullOrEmpty(_appUserId)) { from += "_" + _appUserId; } #region 写用户信息 UserRegisterInfo registerUser = new UserRegisterInfo(); registerUser.Id = userid; registerUser.ExtenderKey = ""; registerUser.UserName = string.Format("{0}wx{1}", phone, DateTime.Now.ToString("yyMMdd")); //针对重复注册特殊处理 registerUser.Pwd = pwd; registerUser.Email = string.Empty; registerUser.TelNo = phone; registerUser.ThirdPartyId = string.Empty; registerUser.ThirdPartyType = (int)ConstString.ThirdPartyType.TuandaiUser; registerUser.RegisterFrom = from; registerUser.RegisterIP = realIp; registerUser.OpenId = GlobalUtils.OpenId; registerUser.NickName = registerUser.UserName; string msg = string.Empty; var userBasicInfoInfo = new UserBLL().RegiserUser(registerUser, ref msg); if (userBasicInfoInfo != null && !string.IsNullOrEmpty(userBasicInfoInfo.ExtenderKey)) { //记录日志 SysLogHelper.WriteErrorLog("会员推广_AddUserInfo", "UserName:" + userBasicInfoInfo.UserName + ";ExtendKey:" + userBasicInfoInfo.ExtenderKey); } #endregion if (userBasicInfoInfo != null) { RegisterUserHandler.AsyncAfterRegister(_app, userBasicInfoInfo); if ((userBasicInfoInfo.uStatus ?? 0) == 1) { var isNewSmsRequest = ConfigHelper.getConfigString("IsNewSmsRequest", "0"); if (isNewSmsRequest == "0") { //改用新的发短信,邮件,系统消息 var messageSender = new MessageSend(); //var parameters = new Dictionary<string, object>(); //parameters.Add("User", model); //parameters.Add("CurrentDate", DateTime.Now); //parameters.Add("ExtenderKey", model.ExtenderKey); //messageSender.SendMessage2(eventCode: MessageTemplates.RegisterSuccess, parameters: parameters, mobile: model.TelNo, email: model.Email, userId: model.Id); //将生成的密码已短信方式发送给用户 var parameters = new Dictionary <string, object>(); parameters.Add("PassWord", pwd); messageSender.SendMessage2(option: SendOption.Sms, eventCode: MessageTemplates.BindMobile, parameters: parameters, mobile: userBasicInfoInfo.TelNo); } else { SmsRequest rechargeSuccessSmsRequest = new SmsRequest(); rechargeSuccessSmsRequest.EventCode = MsgTemplatesType.BindMobile; rechargeSuccessSmsRequest.PlatformSource = PlatformSource.WeiXin; rechargeSuccessSmsRequest.UserId = userBasicInfoInfo.Id; rechargeSuccessSmsRequest.EmailAddress = userBasicInfoInfo.Email; rechargeSuccessSmsRequest.Mobile = userBasicInfoInfo.TelNo; rechargeSuccessSmsRequest.Parameters = new Dictionary <string, object>(); rechargeSuccessSmsRequest.Parameters.Add("PassWord", pwd); string errorMessage = string.Empty; SmsClient.SendMessage(rechargeSuccessSmsRequest, ref errorMessage); } try { TuanDai.InfoSystem.Model.LoginLog loginLogEntity = new TuanDai.InfoSystem.Model.LoginLog(); loginLogEntity.Id = Guid.NewGuid().ToString(); loginLogEntity.UserId = userBasicInfoInfo.Id.ToString(); loginLogEntity.IpAddress = Tool.WebFormHandler.GetIP(); loginLogEntity.LoginDate = DateTime.Now; loginLogEntity.DeviceType = "WeiXin"; loginLogEntity.DeviceName = _app + "自动注册登录"; //LoginLogService logApi = new LoginLogService(); //logApi.AddLoginLog(loginLogEntity); TuanDai.WXApiWeb.SysLogHelper.AddLoginLog(loginLogEntity); } catch (Exception ex) { NetLog.WriteLoginHandler("写入注册成功登录日志出错", Tool.ExceptionHelper.GetExceptionMessage(ex)); } } #region 注册成功后自动登录 if (GlobalUtils.IsWeiXinBrowser) { string strOpenId = TuanDai.WXApiWeb.Common.WeiXinApi.GetUserWXOpenId(userBasicInfoInfo.Id); if (strOpenId.IsNotEmpty()) { GlobalUtils.WriteOpenIdToCookie(strOpenId.ToText()); } } WebUserAuth.SignIn(userid.ToString()); #endregion } else { return("添加用户失败"); } return(string.Empty); }
/// <summary> /// 安全验证 /// </summary> /// <returns></returns> private bool SecurityValidation() { bool result = false; //验证结果,手机号,标ID #region 八青社 if (_app == "baqingshe") { string data = Request["data"]; try { BqsRequestProject request = JsonConvert.DeserializeObject <BqsRequestProject>(data); _pid = request.product_id; if (SecurityValidation(request.appid, request.access_token, request.signature)) { //获取用户信息 Tuple <string, string> bqsUser = GetBqsUserPhoneNo(request.access_token); if (bqsUser != null) { result = true; _appUserId = bqsUser.Item1; _telNo = bqsUser.Item2; } } } catch (Exception ex) { NetLog.WriteLoginHandler("八青社请求验证失败:" + data, ex.Message); } } #endregion #region 人人利 else if (_app == "renrenli") { string sign = Context.Request["Access_tokens"]; if (string.IsNullOrEmpty(sign)) { return(result); } try { sign = Tool.Cryptography.DESDecrypt(sign); //token加密方式:手机号+"_"+当前时间+"_"+RenRenLiKey string[] signs = sign.Split('_'); if (signs.Length != 3) { return(false); } if (signs[2] != RenRenLiKey) { return(false); } if (!signs[0].IsPhone()) { return(false); } //请求的时间判断 DateTime dt = DateTime.Parse(signs[1]); if ((DateTime.Now - dt).TotalSeconds > 100) //如果请求时间大于10s,则失败,不允许自动登录 { return(false); } _telNo = signs[0]; result = true; } catch (Exception ex) { NetLog.WriteLoginHandler("希财网解密失败:" + sign, ex.Message); } } #endregion return(result); }
public static string SeekMyLover(string base64Img) { try { string HeadImage = ""; //上传头像 bool saveImg = SaveHeadImage(base64Img, ref HeadImage); if (!saveImg) { return(PrintJson("-1", "上传头像失败!")); } Dictionary <string, string> templateDict = GetLoverTemplate(); int rIndex = rand.Next(templateDict.Count); if (rIndex < 1 || rIndex > templateDict.Count) { rIndex = 0; } string seekLover = templateDict.ElementAt(rIndex).Key;//匹配到的情人 string seekLoverImg = templateDict.ElementAt(rIndex).Value; int MatchMark = GetRandomMark(); int BeautyMark = GetRandomMark(); string SelfOpenId = ""; try { ThirdLoginSDK sdkApi = new ThirdLoginSDK(); sdkApi.InitSDK(ThirdLoginSDK.ThirdLoginType.WeiXin); SelfOpenId = sdkApi.GetCookieOpenId(""); } catch { SelfOpenId = ""; } //using (SqlConnection connection = new SqlConnection(TuanDai.Config.BaseConfig.ActivityConnectionString)) // { // string strSQL = @"insert into Activity_SeekLover_Record(Id,UserId,UserName,WXOpenId,HeadImage,MatchMark,BeautyMark,SeekLover,AddDate,UserAgent) // values(@Id,@UserId,@UserName,@WXOpenId,@HeadImage,@MatchMark,@BeautyMark,@SeekLover,@AddDate,@UserAgent)"; // DynamicParameters dyParams = new DynamicParameters(); // dyParams.Add("@Id", Guid.NewGuid()); // #region 用户数据 // if (WebUserAuth.IsAuthenticated) // { // UserBLL userbll = new UserBLL(); // UserBasicInfoInfo userInfo = userbll.GetUserBasicInfoModelById(WebUserAuth.UserId.Value); // if (userInfo != null) // { // dyParams.Add("@UserId", userInfo.Id); // dyParams.Add("@UserName", userInfo.UserName); // } // else // { // dyParams.Add("@UserId", null); // dyParams.Add("@UserName", ""); // } // } // else // { // dyParams.Add("@UserId", null); // dyParams.Add("@UserName", ""); // } // #endregion // dyParams.Add("@WXOpenId", SelfOpenId); // dyParams.Add("@HeadImage", HeadImage); // dyParams.Add("@MatchMark", MatchMark); // dyParams.Add("@BeautyMark", BeautyMark); // dyParams.Add("@SeekLover", seekLover); // dyParams.Add("@AddDate", DateTime.Now); // //获取用户浏览器信息 // string strAgent = ""; // strAgent += string.Format("用户IP: {0}\r\n", Tool.WebFormHandler.GetIP()); // strAgent += string.Format("用户浏览器: {0}\r\n", HttpContext.Current.Request.UserAgent); // dyParams.Add("@UserAgent", strAgent); // int iSuc = connection.Execute(strSQL, dyParams); // if (iSuc > 0) // { // LoverInfo infor = new LoverInfo(); // infor.result = "1"; // infor.LoverName = seekLover; // infor.LoverImage = seekLoverImg; // infor.HeadImage = HeadImage; // infor.MatchMark = MatchMark; // infor.BeautyMark = BeautyMark; // return PrintJson(infor); // } // else // { // return PrintJson("0", "保存头像失败!"); // } // } return(""); } catch (Exception ex) { NetLog.WriteLoginHandler("速配情人活动出错", Tool.ExceptionHelper.GetExceptionMessage(ex), "触屏版"); return(PrintJson("-100", "程序异常")); } }