public static D2getpassInfo GetItem(string GtpsGUID) { if (GtpsGUID == null) { return(null); } if (itemCacheTimeout <= 0) { return(dal.GetItem(GtpsGUID)); } string key = string.Concat("DC2016_BLL_D2getpass_", GtpsGUID); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(new D2getpassInfo(value)); } catch { } } D2getpassInfo item = dal.GetItem(GtpsGUID); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
private static void RemoveCache(D2getpassInfo item) { if (item == null) { return; } RedisHelper.Remove(string.Concat("DC2016_BLL_D2getpass_", item.GtpsGUID)); }
public static DC2016.DAL.D2getpass.SqlUpdateBuild UpdateDiy(D2getpassInfo item, string GtpsGUID) { if (itemCacheTimeout > 0) { RemoveCache(item != null ? item : GetItem(GtpsGUID)); } return(new DC2016.DAL.D2getpass.SqlUpdateBuild(item, GtpsGUID)); }
public static int Update(D2getpassInfo item) { if (itemCacheTimeout > 0) { RemoveCache(item); } return(dal.Update(item)); }
public static D2getpassInfo Insert(D2getpassInfo item) { item = dal.Insert(item); if (itemCacheTimeout > 0) { RemoveCache(item); } return(item); }
public int Update(D2getpassInfo item) { return(new SqlUpdateBuild(null, item.GtpsGUID) .SetGtpsEMail(item.GtpsEMail) .SetGtpsGate(item.GtpsGate) .SetGtpsIP(item.GtpsIP) .SetGtpsNumber(item.GtpsNumber) .SetGtpsState(item.GtpsState) .SetGtpsTime1(item.GtpsTime1) .SetGtpsTime2(item.GtpsTime2) .SetGtpsType(item.GtpsType).ExecuteNonQuery()); }
protected static MySqlParameter[] GetParameters(D2getpassInfo item) { return(new MySqlParameter[] { GetParameter("?GtpsGUID", MySqlDbType.VarChar, 32, item.GtpsGUID), GetParameter("?GtpsEMail", MySqlDbType.VarChar, 64, item.GtpsEMail), GetParameter("?GtpsGate", MySqlDbType.VarChar, 4, item.GtpsGate), GetParameter("?GtpsIP", MySqlDbType.Int32, 11, item.GtpsIP), GetParameter("?GtpsNumber", MySqlDbType.Int32, 11, item.GtpsNumber), GetParameter("?GtpsState", MySqlDbType.Int32, 11, item.GtpsState), GetParameter("?GtpsTime1", MySqlDbType.DateTime, -1, item.GtpsTime1), GetParameter("?GtpsTime2", MySqlDbType.DateTime, -1, item.GtpsTime2), GetParameter("?GtpsType", MySqlDbType.Int32, 11, item.GtpsType) }); }
public static bool Func_SendMail(D2getpassInfo passInfo, string lang, ViewRenderService viewRender) { string pName = DC2Conf.GetPName(passInfo.GtpsGate); string title = string.Format("{0}-密码找回", pName); string url = string.Format(DC2Conf.AgpUrlFormat, passInfo.GtpsGUID, passInfo.GtpsGate); string viewName = "letter_getpass"; Hashtable cht_data = new Hashtable(); cht_data["产品名"] = pName; cht_data["链接地址"] = url; string fromName = "多益网络"; if (string.IsNullOrWhiteSpace(lang) || lang.ToLower() == "zh-tw") { title = string.Format("{0}-密碼找回", "英雄通行證"); viewName = "letter_getpass_tw"; cht_data["产品名"] = "英雄通行證"; fromName = "英雄網絡"; string urltw = url.Replace("hi.duoyi.com", "hi.herojoys.com"); cht_data["链接地址"] = urltw; } else if (DC2Conf.IsHerojoys) { title = string.Format("{0}-密码找回", "英雄通行证"); cht_data["产品名"] = "英雄通行证"; fromName = "英雄网络"; string urltw = url.Replace("hi.duoyi.com", "dy.herojoys.com"); cht_data["链接地址"] = urltw; } string viewPath = UrsHelper.GetTPLViewPath(viewName); string content = viewRender.Render <Hashtable>(viewPath, cht_data); string emailaddress = passInfo.GtpsEMail.ToLower(); /* * TODO: 这里需要确认一下逻辑 * if (emailaddress.EndsWith("@old.2980.com")) * { * //old.2980.com的帐号进行特殊处理 * //发到该手机号@old.2980.com帐号原先登录游戏时的那个邮箱 * string mobile = emailaddress.Split('@')[0]; * URSOld2980 uold = new URSOld2980(Operator, mobile); * if (URSOld2980.IsFill(uold)) * emailaddress = string.Format("{0}@2980.com", uold.UO_Account); * } */ bool rc = false; try { rc = D2lib.SendMail_Henhaoji(null, fromName, emailaddress, emailaddress, title, content, true); if (rc) { D2getpass.SetState(passInfo.GtpsGUID, (int)EGST.已发送); } } catch (Exception es) { if (es is FormatException) { D2getpass.SetState(passInfo.GtpsGUID, (int)EGST.异常); } Log.Logger.LogCritical(es.ToString()); } return(rc); }
public D2getpassInfo Insert(D2getpassInfo item) { SqlHelper.ExecuteNonQuery(TSQL.Insert, GetParameters(item)); return(item); }
public SqlUpdateBuild(D2getpassInfo item, string GtpsGUID) { _item = item; _where = SqlHelper.Addslashes("`GtpsGUID` = {0}", GtpsGUID); }
public IActionResult func_getPwdByMail(string gate, int number, string email, string pstype, string lang, int ip) { if (!DC2Conf.IsProg && !this.IsVIP()) { return(this.FuncResult(new APIReturn(-97, "IP没有访问权限"))); } if (gate.IsNullOrEmpty()) { return(this.FuncResult(new APIReturn(10000, "参数错误(gate)"))); } if (email.IsNullOrEmpty() || !Utilities.IsValidEmail(email)) { return(this.FuncResult(new APIReturn(10302, "帐号格式错误"))); } string sendEmail = email; if (sendEmail.EndsWith("@2980.com")) { return(this.FuncResult(new APIReturn(10350, "2980帐号请到2980邮箱操作"))); } if (number < 10000) { number = getnumberbyemail(email); } string[] mailfixs = new string[] { "yahoo.com.cn", "yahoo.cn" }; if (Array.IndexOf <string>(mailfixs, sendEmail.Split('@')[1]) != -1) { DCClass dcc_urs = new DCClass(); if (number < 20000000)//将升级到多益通帐号的number转成多益通number { number = dcc_urs.URS_GetURSNumberByNumber(number); } dcc_urs = new DCClass(); string bindMail = dcc_urs.URS_GetBindMail(number); if (!string.IsNullOrEmpty(bindMail) && bindMail.Length > 5) { sendEmail = bindMail; } } bool tooMuch = D2getpass.CheckLast(email, 0, 1); if (tooMuch) { return(this.FuncResult(new APIReturn(10323, "找回密码太过频繁"))); } EGTP egtpType = EGTP.邮箱找回密码; if (pstype == "web")//默认游戏 { egtpType = EGTP.邮箱找回密码_网站; } D2getpassInfo passInfo = new D2getpassInfo() { GtpsGUID = Guid.NewGuid().ToString("N"), GtpsIP = ip, GtpsState = (int)EGST.未发送, GtpsType = (int)egtpType, GtpsGate = gate, GtpsNumber = number, GtpsEMail = sendEmail, GtpsTime1 = DateTime.Now }; D2getpass.Insert(passInfo); bool rc = D2Game.Func_SendMail(passInfo, lang, _viewRender); if (rc) { Hashtable ht = new Hashtable(); ht.Add("email", email); //重置成功 return(this.FuncResult(new APIReturn(0, "", ht))); } else { return(this.FuncResult(new APIReturn(10502, "找回密码邮件发送失败"))); } }