/// <summary> /// 发放登录积分 /// </summary> /// <param name="partUserInfo">用户信息</param> /// <param name="loginTime">登录时间</param> public static void SendLoginCredits(ref PartUserInfo partUserInfo, DateTime loginTime) { DateTime oldTime = TypeHelper.StringToDateTime(WebHelper.UrlDecode(MallUtils.GetBMACookie("slctime")), loginTime.Date.AddDays(-2)); DateTime newTime; SendLoginCredits(ref partUserInfo, loginTime, oldTime, out newTime); if (newTime == loginTime) { MallUtils.SetBMACookie("slctime", WebHelper.UrlEncode(loginTime.ToString())); } }
/// <summary> /// 发放登陆积分 /// </summary> /// <param name="partUserInfo">用户信息</param> /// <param name="loginTime">登陆时间</param> public static void SendLoginCredits(ref PartUserInfo partUserInfo, DateTime loginTime) { DateTime newTime; SendLoginCredits(ref partUserInfo, loginTime, TypeHelper.StringToDateTime(WebHelper.UrlDecode(MallUtils.GetBMACookie("slctime")), loginTime.Date.AddDays(-2)), out newTime); }
/// <summary> /// 发放登陆积分 /// </summary> /// <param name="partUserInfo">用户信息</param> /// <param name="loginTime">登陆时间</param> public static void SendLoginCredits(ref PartUserInfo partUserInfo, DateTime loginTime) { if (_creditconfiginfo.LoginPayCredits > 0 || _creditconfiginfo.LoginRankCredits > 0) { DateTime slcTime = TypeHelper.StringToDateTime(WebHelper.UrlDecode(MallUtils.GetBMACookie("slctime")), loginTime.Date.AddDays(-2)); if (loginTime.Date <= slcTime.Date) { return; } if (!IsSendTodayLoginCredit(partUserInfo.Uid, DateTime.Now)) { MallUtils.SetBMACookie("slctime", WebHelper.UrlEncode(loginTime.ToString())); int surplusPayCredits = GetDaySurplusPayCredits(partUserInfo.Uid, loginTime.Date); int surplusRankCredits = GetDaySurplusRankCredits(partUserInfo.Uid, loginTime.Date); if (surplusPayCredits == 0 && surplusRankCredits == 0) { return; } int payCredits = 0; int rankCredits = 0; if (surplusPayCredits > 0) { payCredits = surplusPayCredits < _creditconfiginfo.LoginPayCredits ? surplusPayCredits : _creditconfiginfo.LoginPayCredits; } else if (surplusPayCredits == -1) { payCredits = _creditconfiginfo.LoginPayCredits; } if (surplusRankCredits > 0) { rankCredits = surplusRankCredits < _creditconfiginfo.LoginRankCredits ? surplusRankCredits : _creditconfiginfo.LoginRankCredits; } else if (surplusRankCredits == -1) { rankCredits = _creditconfiginfo.LoginRankCredits; } partUserInfo.PayCredits += payCredits; partUserInfo.RankCredits += rankCredits; int userRid = UserRanks.GetUserRankByCredits(partUserInfo.RankCredits).UserRid; if (userRid != partUserInfo.UserRid) { partUserInfo.UserRid = userRid; } else { userRid = 0; } CreditLogInfo creditLogInfo = new CreditLogInfo(); creditLogInfo.Uid = partUserInfo.Uid; creditLogInfo.PayCredits = payCredits; creditLogInfo.RankCredits = rankCredits; creditLogInfo.Action = (int)CreditAction.Login; creditLogInfo.ActionCode = 0; creditLogInfo.ActionTime = loginTime; creditLogInfo.ActionDes = "登陆赠送积分"; creditLogInfo.Operator = 0; SendCredits(userRid, creditLogInfo); } } }