예제 #1
0
        private IActionResult func_2980_bindassociationmobile(string email, string mobile)
        {
            Dictionary <string, object> argus = new Dictionary <string, object>();

            argus.Add("act", "dy_2980setrelationphone");
            argus.Add("portkey", DC2Conf.Passport2980);
            argus.Add("phone", mobile);
            int    number = getnumberbyemail(email);
            string ano    = get2980ano(number);

            argus.Add("ano", ano);

            ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus);

            if (ret.Code == 250)
            {
                return(this.FuncResult(new APIReturn(0, "设置关联手机成功")));
            }
            else if (ret.Code == 203)
            {
                return(this.FuncResult(new APIReturn(10700, ret.Message + $",code={ret.Code}")));
            }
            else if (ret.Code == 202)
            {
                return(this.FuncResult(new APIReturn(10701, ret.Message + $",code={ret.Code}")));
            }
            else if (ret.Code == 205)
            {
                return(this.FuncResult(new APIReturn(10701, "手机注册帐号不允许关联手机" + $",code={ret.Code}")));
            }
            return(this.FuncResult(new APIReturn(ret.Code, ret.Message + $",code={ret.Code}")));
        }
예제 #2
0
        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)));
        }
예제 #3
0
        public IActionResult func_get2980PwdByMail(string account)
        {
            if (string.IsNullOrEmpty(account))
            {
                return(this.FuncResult(new APIReturn(10000, "参数错误")));
            }

            SignMaker signMaker = new SignMaker();
            Dictionary <string, Object> dicParams = new Dictionary <string, object>();

            dicParams.Add("act", "dy_2980gamesendqqmail");
            dicParams.Add("mail", account);
            dicParams.Add("portkey", DC2Conf.Passport2980);
            string sign = signMaker.MakeSign(dicParams);

            Dictionary <string, object> argus = new Dictionary <string, object>();

            argus.Add("act", "dy_2980gamesendqqmail");
            argus.Add("portkey", DC2Conf.Passport2980);
            argus.Add("mail", account);
            argus.Add("sig", sign);

            ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus);

            #region 返回码处理

            int    code;
            string msg;
            if (ret.Code == 250)
            {
                code = 0;
                msg  = string.Empty;
            }
            else if (ret.Code == 201)
            {
                //用户名格式不正确
                code = 10302;
                msg  = "帐号格式错误";
            }
            else if (ret.Code == 202)
            {
                //用户不存在
                code = 10300;
                msg  = "帐号不存在";
            }
            else if (ret.Code == 203)
            {
                //该邮箱未绑定QQ
                code = 10520;
                msg  = "邮箱未绑定qq";
            }
            else if (ret.Code == 204)
            {
                //QQ找回密码发送失败
                code = 10502;
                msg  = "找回密码邮件发送失败";
            }
            else if (ret.Code == 500)
            {
                //服务器内部错误
                code = -98;
                msg  = "未知系统错误";
            }
            else
            {
                code = 19801;
                msg  = $"找回密码失败({ret.Code},{ret.Message})";
            }

            #endregion

            return(this.FuncResult(new APIReturn(code, msg)));
        }
예제 #4
0
        public IActionResult func_reg2980(Reg2980Model model)
        {
            if (string.IsNullOrEmpty(model.mobile))
            {
                return(this.FuncResult(new APIReturn(10008, "手机号码不能为空")));
            }
            if (string.IsNullOrEmpty(model.password))
            {
                return(this.FuncResult(new APIReturn(10002, "密码不能为空")));
            }

            //object[] objs = new object[] { "act", "dy_2980registeruser", "portkey", DC2Conf.Passport2980, "phone", model.mobile, "password", model.password, "accort", model.account, "name", model.name };
            Dictionary <string, object> argus = new Dictionary <string, object>();

            argus.Add("act", "dy_2980registeruser");
            argus.Add("portkey", DC2Conf.Passport2980);
            argus.Add("phone", model.mobile);
            argus.Add("password", model.password);
            argus.Add("accort", model.account ?? string.Empty);
            argus.Add("name", model.name ?? string.Empty);

            ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus);

            #region 返回码处理

            int    code;
            string msg;

            if (ret.Code == 250)
            {
                //注册成功
                return(this.FuncResult(new APIReturn(0)));
            }
            else if (ret.Code == 609)
            {
                //参数不能为空(格式不对)
                code = 10000;
                msg  = "部分参数缺失";
            }
            else if (ret.Code == 608)
            {
                //手机号或帐号不存在(格式不对)
                code = 10300;
                msg  = "帐号不存在";
            }
            else if (ret.Code == 625)
            {
                //手机号或帐号存在
                code = 10303;
                msg  = "帐号已存在";
            }
            else if (ret.Code == 624)
            {
                //请按要求填写帐号
                code = 10302;
                msg  = "帐号格式错误";
            }
            else if (ret.Code == 626)
            {
                //对象为空,用户注册失败
                code = 10306;
                msg  = "注册失败(对象为空)";
            }
            else if (ret.Code == 627)
            {
                //注册失败
                code = 10306;
                msg  = "注册失败";
            }
            else if (ret.Code == 631)
            {
                //通行证出错
                code = -98;
                msg  = "通行证出错";
            }
            else if (ret.Code == 632)
            {
                //通行证连接超时
                code = -95;
                msg  = "网络异常(超时)";
            }
            else if (ret.Code == 633)
            {
                //帐号已存在多益通行证
                code = 10303;
                msg  = "帐号已存在";
            }
            else if (ret.Code == 634)
            {
                //手机已存在多益通行证
                code = 10303;
                msg  = "帐号已存在(手机)";
            }
            else if (ret.Code == 635)
            {
                //身份证号格式不对
                code = 10711;
                msg  = "身份证号格式错误";
            }
            else if (ret.Code == 636)
            {
                //密码长度不对,6~16个字符(字母、数字)
                code = 10305;
                msg  = "密码格式错误";
            }
            else if (ret.Code == 637)
            {
                //密码格式不对
                code = 10305;
                msg  = "密码格式错误";
            }
            else if (ret.Code == 500)
            {
                //服务器出错
                code = -98;
                msg  = "未知系统错误";
            }
            else if (ret.Code == 614)
            {
                //你不具备访问权限
                code = -97;
                msg  = "IP不具备访问权限";
            }
            else if (ret.Code == 283)
            {
                //无任何执行动作
                code = 19900;
                msg  = "未知错误";
            }
            else
            {
                code = 19801;
                msg  = $"注册失败({ret.Code},{ret.Message})";
            }

            #endregion

            return(this.FuncResult(new APIReturn(code, msg)));
        }
예제 #5
0
        public IActionResult func_getacctinfo(string ip, string gate, string account)
        {
            if (account.Length < 5)
            {
                return(this.FuncResult(new APIReturn(10000, "account error")));
            }

            bool ismobile = IsMobile(account);

            if (account.Contains("@") == false && ismobile)
            {
                account += "@2980.com";
            }

            bool is2980 = account.ToLower().EndsWith("@2980.com");

            if (is2980)
            {
                string act  = "dy_2980gamegetphoneqq";
                string mail = account.ToLower().Replace("@2980.com", "");


                SignMaker signMaker = new SignMaker();
                Dictionary <string, Object> dicParams = new Dictionary <string, object>();
                dicParams.Add("act", "dy_2980gamegetphoneqq");
                dicParams.Add("mail", mail);
                dicParams.Add("portkey", DC2Conf.Passport2980);
                string sign = signMaker.MakeSign(dicParams);

                Dictionary <string, object> argus = new Dictionary <string, object>();
                argus.Add("act", "dy_2980gamegetphoneqq");
                argus.Add("mail", mail);
                argus.Add("portkey", DC2Conf.Passport2980);
                argus.Add("sig", sign);

                ReturnMsg2980 ret = P2980Invoker.InvokeHttp("funswregister", argus);
                if (ret.Code == 250)
                {
                    string m         = ret.Data["phone"].Value <string>();
                    string mobilestr = "";
                    if (IsMobile(m))
                    {
                        mobilestr = string.Format("{0}*****{1}", m.Substring(0, 3), m.Substring(m.Length - 3, 3));
                    }
                    Hashtable ht = new Hashtable();
                    ht["qq"]    = ret.Data["qq"].Value <string>();
                    ht["phone"] = mobilestr;


                    return(this.FuncResult(new APIReturn(0, "", ht)));
                }
                else if (ret.Code == 201)
                {
                    return(this.FuncResult(new APIReturn(10302, "帐号格式错误")));
                }
                else if (ret.Code == 202)
                {
                    return(this.FuncResult(new APIReturn(10300, "帐号不存在")));
                }
                else if (ret.Code == 203)
                {
                    return(this.FuncResult(new APIReturn(10307, "非手机注册帐号")));
                }
                else if (ret.Code == 301)
                {
                    return(this.FuncResult(new APIReturn(10740, "无效的签名")));
                }
                else
                {
                    return(this.FuncResult(new APIReturn(-98, $"未知系统错误2980{ret.Code}")));
                }
            }

            object[]   objs = new object[] { "action", 1411, "ip", ip ?? string.Empty, "account", account, "gatesrc", gate };
            DCResult   dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "shell_websys_r", objs.ToArray());
            DicDCValue rmdc = dcr.GetDicDCValue();

            string eamil  = string.Empty;
            string mobile = string.Empty;
            string qq     = string.Empty;

            if (rmdc.Code == 0)
            {
                string m         = rmdc["mobile"];
                string mobilestr = "";
                if (IsMobile(m))
                {
                    mobilestr = string.Format("{0}*****{1}", m.Substring(0, 3), m.Substring(m.Length - 3, 3));
                }
                Hashtable ht = new Hashtable();
                ht["email"]  = rmdc["email"];
                ht["mobile"] = mobilestr;
                ht["qq"]     = rmdc["qq"];
                return(this.FuncResult(new APIReturn(0, "", ht)));
            }
            else if (rmdc.Code == 23)
            {
                return(this.FuncResult(new APIReturn(10300, "账号不存在")));
            }
            else
            {
                return(this.FuncResult(new APIReturn(10324, $"获取帐号信息失败({rmdc.Code})")));
            }
        }