Beispiel #1
0
        public IActionResult func_getAcctByMobile(string mobile)
        {
            //int number = (Math.Abs(mobile.GetHashCode()) > 20000000 ? Math.Abs(mobile.GetHashCode()) : 200000000 + Math.Abs(mobile.GetHashCode()));
            if (mobile.IsNullOrEmpty() || !this.IsMobile(mobile))
            {
                return(this.FuncResult(new APIReturn(10205, "手机号格式错误")));
            }

            object[]   objs = { "action", "1406", "mobile", mobile };
            DCResult   dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "shell_websys_r", objs.ToArray());
            DicDCValue rmdc = dcr.GetDicDCValue();

            List <string> li_rc = new List <string>();
            Hashtable     htb   = new Hashtable();

            if (rmdc.Code == 0)
            {
                int count = int.Parse(rmdc["count"]);
                if (count > 0)
                {
                    string[] accounts = rmdc["accounts"].Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                    foreach (string account in accounts)
                    {
                        string acct = func_formatacct(account);
                        li_rc.Add(acct);
                    }
                }
                htb.Add("count", count);
                htb.Add("accounts", string.Join(",", li_rc.ToArray()));

                return(this.FuncResult(new APIReturn(0, string.Empty, htb)));
            }
            return(this.FuncResult(new APIReturn(19804, $"找回帐号失败({rmdc.Code})")));
        }
Beispiel #2
0
        private string get2980ano(int number)
        {
            string[]   objs = { "action", "1401", "gate", "urs", "number", number.ToString() };
            DCResult   dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "shell_websys_r", objs);
            DicDCValue rmdc = dcr.GetDicDCValue();

            if (rmdc.Code == 0)
            {
                return(rmdc["ano"]);
            }
            return(null);
        }
Beispiel #3
0
        private int getnumberbyemail(string email)
        {
            object[]   objs = { "email", email, "check2980", "1" };
            DCResult   dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "acct_getnumberbyemail", objs);
            DicDCValue rmdc = dcr.GetDicDCValue();

            if (rmdc.Code == 0)
            {
                return(rmdc["number"].ToInt());
            }
            return(0);
        }
Beispiel #4
0
        public IActionResult func_bindassociationmobile([FromQuery] string email, [FromQuery] string mobile)
        {
            DCResult   dcr  = null;
            DicDCValue rmdc = null;

            object[] obj = new object[] { "account", email, "mobile", mobile };
            dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.W, "acct_bindmobile", obj);
            rmdc = dcr.GetDicDCValue();;
            if (rmdc.Code == 0)
            {
                string itype = "";
                rmdc.TryGetValue("itype", out itype);
                if (itype == "1")
                {
                    return(this.FuncResult(new APIReturn(0, "绑定手机成功")));
                }
                else
                {
                    //int n = dcc.Func_URS_GetNumberByEmail(account);
                    //string createtime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    //inc.FuncClassD2.Func_SendBindMobileMsg(Operator, account, n, mobile, createtime);
                    return(this.FuncResult(new APIReturn(0, "设置关联手机成功")));
                }
            }
            else if (rmdc.Code == 105)
            {
                return(this.FuncResult(new APIReturn(10702, "该手机已关联此通行证帐号")));
            }
            else if (rmdc.Code == 115)
            {
                return(this.FuncResult(new APIReturn(10704, "该手机已经绑定多个通行证帐号")));
            }
            else if (rmdc.Code == 151)
            {
                return(func_2980_bindassociationmobile(email, mobile));
            }
            else if (rmdc.Code == 20)
            {
                return(this.FuncResult(new APIReturn(10300, "帐号不存在")));
            }
            else
            {
                return(this.FuncResult(new APIReturn(10703, string.Format("手机号与通行证关联失败({0})", rmdc.Code))));
            }
        }
Beispiel #5
0
        private bool Func_SetAV2(D2unactiveInfo gua, out string retMsg)
        {
            retMsg = string.Empty;
            if (gua.UavState == (int)EUAS.已激活2)
            {
                string gatesrc = gua.UavGateSrc;
                if (gatesrc.Length > 1)
                {
                    retMsg = gatesrc;
                }
                return(true);
            }
            D2unactive.Func_SetState(gua.UavGUID, (int)EUAS.已激活1);
            //object[] objs = { "active_setav.php", "number", gua.UavNumber };
            //ReturnMessageDC2 rmdc = new DCClass(Operator, this.UAV_Gate, "W").Func_GetRet2(objs);
            //ReturnMessageDC rmdc = DCClass.DC_GetRet(Operator, this.UAV_Gate, "W", objs);

            object[] objs = { "number", gua.UavNumber };
            //DCRequest dcr = new DCRequest(gua.UavGate, DCMethodTypes.W);
            //ReturnMsgDC rmdc = dcr.ExecRequest("active_setav.php", objs);

            DCResult   dcr  = DCInvoker.HttpInvoke(gua.UavGate, DCMethodTypes.W, "active_setav", objs.ToArray());
            DicDCValue rmdc = dcr.GetDicDCValue();

            if (rmdc.Code == 0)
            {
                string gatesrc = rmdc["gatesrc"];
                bool   rc      = gatesrc.Length > 0 ? D2unactive.Func_SetState(gua.UavGUID, (int)EUAS.已激活2, gatesrc) : D2unactive.Func_SetState(gua.UavGUID, (int)EUAS.已激活2);
                if (rc)
                {
                    string gatesrc2 = rmdc["gatesrc"];
                    if (gatesrc2.Length > 1)
                    {
                        retMsg = gatesrc2;
                    }
                }
                return(rc);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
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)));
        }
Beispiel #7
0
        public IActionResult func_getAcctByMac(string gate, string mac)
        {
            if (string.IsNullOrEmpty(gate) || string.IsNullOrEmpty(mac))
            {
                return(this.FuncResult(new APIReturn(10000, "参数错误( gate or mac)")));
            }
            int counts = -1;

            if (counts < 0)
            {
                counts = 10;
            }

            int action = gate == "mx" ? 1 : 28;

            DCResult   dcr  = null;
            DicDCValue rmdc = null;

            object[] objs = { "action", action, "mac", mac, "gate", gate, "counts", counts, "retd2", "1" };
            if (gate == "sw")
            {
                //dcr = new DCRequest(DCProdTypes.SW, DCMethodTypes.W);
                //rmdc = dcr.ExecRequest("shell_cs.php", objs);
                dcr  = DCInvoker.HttpInvoke(DCProdTypes.SW, DCMethodTypes.W, "shell_cs", objs.ToArray());
                rmdc = dcr.GetDicDCValue();
            }
            else if (gate == "mx")
            {
                //dcr = new DCRequest(DCProdTypes.MX, DCMethodTypes.R);
                //rmdc = dcr.ExecRequest("acct_getbymac.php", objs);
                dcr  = DCInvoker.HttpInvoke(DCProdTypes.MX, DCMethodTypes.R, "acct_getbymac", objs.ToArray());
                rmdc = dcr.GetDicDCValue();
            }
            else
            {
                //dcr = new DCRequest(DCProdTypes.URS, DCMethodTypes.R);
                //rmdc = dcr.ExecRequest("shell_websys_user_r.php", objs);
                dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "shell_websys_user_r", objs.ToArray());
                rmdc = dcr.GetDicDCValue();
            }
            if (rmdc.Code == 0 && rmdc.Content.Length > 2)
            {
                Hashtable ht   = new Hashtable();
                string[]  data = rmdc.Content.Substring(2).Split('&');
                if (data.Length != 3 && data[0] == "0")
                {
                    return(this.FuncResult(new APIReturn(10300, " 帐号不存在")));
                }
                for (int i = 0; i < data.Length; i++)
                {
                    if (i == 0)
                    {
                        string[] count = data[i].Split('=');
                        ht[count[0]] = count[1];
                    }
                    if (i == 1)
                    {
                        string[] acct = data[i].Split('=');
                        ht[acct[0]] = acct[1].Split(',');
                    }
                    if (i == 2)
                    {
                        string[] logtimes = data[i].Split('=');
                        ht[logtimes[0]] = logtimes[1].Split(',');
                    }
                }
                return(this.FuncResult(new APIReturn(0, "", ht)));
            }
            return(this.FuncResult(new APIReturn(19804, $"找回帐号失败({rmdc.Code})")));
        }
Beispiel #8
0
        public IActionResult func_get2980PwdByMobile(string account, string password, string newpwd, string ip, string tel, string forceset)
        {
            if (string.IsNullOrEmpty(account) || string.IsNullOrEmpty(newpwd) || (((newpwd.Length != 32) || string.IsNullOrEmpty(tel)) || (account.IndexOf("@") == -1)))
            {
                return(this.FuncResult(new APIReturn(19901, "参数错误")));
            }
            if (string.IsNullOrEmpty(ip))
            {
                return(this.FuncResult(new APIReturn(19901, "参数错误(ip)")));
            }

            object[]   objs = { "gatesrc", "urs", "email", account };
            DCResult   dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "acct_getnumberbyemail", objs.ToArray());
            DicDCValue rmdc = dcr.GetDicDCValue();

            int number = 0;

            if (rmdc.Code == 0)
            {
                number = rmdc["number"].ToInt();
            }
            else if (rmdc.Code == 23)
            {
                return(this.FuncResult(new APIReturn(10300, $"帐号不存在")));
            }
            else
            {
                return(this.FuncResult(new APIReturn(10324, $"获取帐号信息失败({rmdc.Code})")));
            }

            objs = new object[] { "action", 1401, "gate", "urs", "number", number };
            dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.R, "shell_websys_r", objs.ToArray());
            rmdc = dcr.GetDicDCValue();

            string ano     = string.Empty;
            string vmobile = string.Empty;

            if (rmdc.Code == 0)
            {
                ano     = rmdc["ano"];
                vmobile = rmdc["vmobile"];
            }
            else
            {
                return(this.FuncResult(new APIReturn(10324, $"获取帐号信息失败({rmdc.Code},{rmdc["Message"]})")));
            }

            objs = new object[] { "ip", ip2long(ip), "newpassmd5", newpwd, "passmd5", password, "ano", ano, "forceset", forceset };
            dcr  = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.W, "2980_acct_setpass", objs.ToArray());
            rmdc = dcr.GetDicDCValue();

            if (rmdc.Code == 0)
            {
                //成功
                return(this.FuncResult(new APIReturn(0)));
            }
            else if (rmdc.Code == 54)
            {
                //新旧密码相同
                return(this.FuncResult(new APIReturn(10327, "不能修改为原有密码")));
            }
            else if (rmdc.Code == 20)
            {
                //参数错误
                return(this.FuncResult(new APIReturn(10000, "参数错误(20)")));
            }
            else
            {
                return(this.FuncResult(new APIReturn(19804, $"找回密码失败({rmdc.Code})")));
            }
        }
Beispiel #9
0
        public IActionResult func_getPwdByMobile(string account, string mobile, string newpass, string country)
        {
            if (string.IsNullOrWhiteSpace(mobile) || mobile.Length < 5)
            {
                return(this.FuncResult(new APIReturn(10205, "不合法的手机号长度")));
            }

            int    number = (Math.Abs(mobile.GetHashCode()) > 20000000 ? Math.Abs(mobile.GetHashCode()) : 200000000 + Math.Abs(mobile.GetHashCode()));
            string ipstr  = this.IP;
            int    ip     = 0;

            if (!string.IsNullOrEmpty(ipstr))
            {
                ip = this.ip2long(ipstr);
            }

            if (string.IsNullOrWhiteSpace(account) || !isemail(account))
            {
                return(this.FuncResult(new APIReturn(10302, "不合法的邮箱帐号格式")));
            }
            if (string.IsNullOrWhiteSpace(newpass) || newpass.Length != 32)
            {
                return(this.FuncResult(new APIReturn(10305, "不合法的密码长度")));
            }

            string[] accountext = account.Split("@".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            string   maildomain = accountext[1];

            if (maildomain.ToLower() == "2980.com")
            {
                return(this.FuncResult(new APIReturn(10350, "2980帐号请到2980邮箱重设密码")));
            }

            newpass = UrsHelper.mymd5(newpass);

            List <object> listobj = new List <object>();

            listobj.AddRange(new object[] { "ip", ip, "number", account, "mobile", mobile, "newpass", newpass, "country", country ?? string.Empty });
            DCResult   dcr    = DCInvoker.HttpInvoke(DCProdTypes.URS, DCMethodTypes.W, "acct_setpass_mobile", listobj.ToArray());
            DicDCValue retMsg = dcr.GetDicDCValue();

            if (retMsg.Code == 0 || retMsg.Code == 54)
            {
                Hashtable ht = new Hashtable();
                ht.Add("email", account);
                //重置成功
                return(this.FuncResult(new APIReturn(0, "", ht)));
            }
            else if (retMsg.Code == 68)
            {
                return(this.FuncResult(new APIReturn(10351, "手机号与通行证已关联但未生效")));
            }
            else if (retMsg.Code == 69)
            {
                return(this.FuncResult(new APIReturn(10351, "手机号与帐号不匹配")));
            }
            else if (retMsg.Code == 151)
            {
                return(this.FuncResult(new APIReturn(10350, "2980帐号请到2980邮箱重设密码")));
            }
            else
            {
                return(this.FuncResult(new APIReturn(19804, $"重设密码失败({retMsg.Code}")));
            }
        }
Beispiel #10
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})")));
            }
        }
 public DCResultViewModel(DCResult DCResult)
 {
     _DCResult = DCResult;
 }