예제 #1
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, "找回密码邮件发送失败")));
            }
        }