public IActionResult func_IsExistAcct(string account, int checkactive) { if (account.IsNullOrEmpty() || !this.IsMobile(account) && !Utilities.IsValidEmail(account)) { return(this.FuncResult(new APIReturn(10000, "参数错误(account)"))); } #region 2980帐号 Hashtable htb = new Hashtable(); if (this.IsMobile(account) || account.EndsWith("@2980.com")) { string checkType; string phoneUserName; if (this.IsMobile(account)) { checkType = "phone"; phoneUserName = account; } else { checkType = "name"; phoneUserName = account.Substring(0, account.LastIndexOf('@')); } Dictionary <string, object> argus = new Dictionary <string, object>(); argus.Add("act", "dy_gs_checknamephone"); argus.Add("portkey", DC2Conf.Passport2980); argus.Add("checktype", checkType); argus.Add("phoneUserName", phoneUserName); ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus); #region 返回码处理 int code; string msg; if (ret.Code == 250) { code = 0; msg = "帐号不存在"; } else if (ret.Code == 625) { if (checkactive == 1) { htb.Add("isActive", true); } return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb))); } else if (ret.Code == 609) { //参数不能为空、重要参数长度不足 code = 10000; msg = "部分参数缺失"; } else if (ret.Code == 611) { //检测超出规定次数 code = 19902; msg = "操作太频繁"; } else if (ret.Code == 500) { //服务器错误 code = -98; msg = "未知系统错误"; } else if (ret.Code == 614) { //你不具备访问权限 code = -97; msg = "IP没有权限"; } else if (ret.Code == 583) { //无任何执行动作 code = 10000; msg = "部分参数缺失"; } else { code = 19801; msg = $"参数或其它错误({ret.Code},{ret.Message})"; } #endregion return(this.FuncResult(new APIReturn(code, msg))); } #endregion bool isActive = false; UrsacctInfo acctInfo = Ursacct.GetItem(account); if (acctInfo != null) { UrsuserInfo userInfo = Ursuser.GetItem(acctInfo.AcctNumber); if (userInfo.UrsTime.HasValue && userInfo.UrsTime.HasValue && userInfo.UrsTime.Value.Year > 2000 && (DateTime.Now - userInfo.UrsTime.Value).TotalDays > 3)//兼容之前没写日期的 { isActive = true; } if (checkactive == 1) { D2unactiveInfo activeInfo = D2unactive.GetItemByNumber(acctInfo.AcctNumber.Value); isActive = activeInfo != null && activeInfo.UavState == (int)EUAS.已激活2; htb.Add("isActive", isActive); } return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb))); } //请求DC验证 //DCRequest dcr = new DCRequest(DCProdTypes.URS, DCMethodTypes.R); List <object> listobj = new List <object>(); listobj.AddRange(new object[] { "email", account }); //ReturnMsgDC rc = dcr.ExecRequest("acct_getinfoforupgrade.php", listobj.ToArray()); DCResult dcr = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "acct_getinfoforupgrade", listobj.ToArray()); DicDCValue rc = dcr.GetDicDCValue(); if (rc.Code == 23) { //帐号不存在 return(this.FuncResult(new APIReturn(0, "帐号不存在"))); } else if (rc.Code == 99) { //帐号未激活 isActive = false; } else { //帐号已存在 isActive = true; int number = rc["number"].ToInt(); } if (checkactive == 1) { htb.Add("isActive", isActive); } return(this.FuncResult(new APIReturn(10303, "帐号已存在", htb))); }
private IActionResult func_exec_reg(RegModel regModel, bool isfriend, int ip, string acct, string pass, bool passismyencrypt, string tname, string idcard, string mobile, int qq, string gatesrc, string pstype, string extinfo, string regip) { //配置控制,是否需要检查注册时的验证码,一段时间之后应去掉此项判断,否则非公司正常产品的gate就绕过此内容 if (DC2Conf.RegvcodeProducts.Contains(gatesrc) && DC2Conf.RegvcodeEnable) { //2016-1-20 对于163邮箱,没有传验证码的必须传验证码 if (acct.ToLower().EndsWith("163.com")) { if (string.IsNullOrEmpty(regModel.vcode) && string.IsNullOrEmpty(regModel.vregval)) { return(createVCode(regip)); } else { var retValue = decRegVal(regModel.vregval, regModel.vcode, regip); if (retValue != null) { return(retValue); } } } else { var retValue = checkRegRates(regModel.vcode, regModel.vregval, regip); if (retValue != null) { return(retValue); } } } UrsacctInfo userInfo = Ursacct.GetItem(acct); if (userInfo != null) { Hashtable htbData = new Hashtable(); htbData.Add("number", userInfo.AcctNumber.Value); return(this.FuncResult(new APIReturn(10303, "帐号已存在", htbData))); } DCClass dcc = new DCClass(); DicDCValue dcValue = dcc.Acct_Register(regModel, isfriend, ip, acct, pass, passismyencrypt, tname, idcard, mobile, qq, gatesrc, pstype); if (dcValue.Code == 0) { int number = dcValue["number"].ToInt(); Ursuser.CreateUser(number, acct, qq, mobile, idcard, extinfo); Hashtable cht_rcdata = new Hashtable(); cht_rcdata["number"] = number; //添加缓存 if (ip != 0 && ip != -1) { string ipkey = string.Format("check-reg-ip-{0}", ip); object obj = UrsHelper.Cache_GetObj(ipkey); List <DateTime> li_ipreglist = new List <DateTime>(); if (obj != null && obj is List <DateTime> ) { li_ipreglist = (List <DateTime>)obj; } li_ipreglist.Add(DateTime.Now); UrsHelper.Cache_SetObj(ipkey, li_ipreglist); } addRegSuc(regip); cht_rcdata["email"] = regModel.email; cht_rcdata["mailhost"] = "http://mail" + regModel.email.Substring(regModel.email.IndexOf('@'), regModel.email.Length - regModel.email.IndexOf('@')); return(this.FuncResult(new APIReturn(0, "注册成功", cht_rcdata))); } else if (dcValue.Code == 65) { return(this.FuncResult(new APIReturn(10303, "帐号已存在"))); } else { return(this.FuncResult(new APIReturn(10306, $"注册失败({dcValue.Code})"))); } }