示例#1
0
        public IActionResult func_valid_mobile(string account, string mobile)
        {
            if (account.IsNullOrEmpty() || !this.IsMobile(account) && !Utilities.IsValidEmail(account))
            {
                return(this.FuncResult(new APIReturn(10000, "参数错误(account)")));
            }
            if (string.IsNullOrEmpty(mobile) || mobile.Length < 7)
            {
                return(this.FuncResult(new APIReturn(10000, "参数错误(mobile)")));
            }
            string tel    = string.Empty;
            int    number = DCClass.Func_URS_GetNumberByEmail(account);

            if (number == -1000)
            {
                return(this.FuncResult(new APIReturn(10300, "帐号不存在")));
            }
            if (number != -1 || number != 0)
            {
                tel = DCClass.dc_getmobilebynumber(number);
            }
            if (string.IsNullOrEmpty(tel))
            {
                return(this.FuncResult(new APIReturn(10356, "该帐号未绑定手机号")));
            }
            if (tel != mobile)
            {
                return(this.FuncResult(new APIReturn(10357, "帐号与手机号不匹配")));
            }
            return(this.FuncResult(new APIReturn(0, "ok")));
        }
示例#2
0
        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, "找回密码邮件发送失败")));
            }
        }
示例#3
0
        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})")));
            }
        }