コード例 #1
0
ファイル: UrsController.cs プロジェクト: P79N6A/projects
        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, "密码不能为空")));
            }
            if (model.account == null)
            {
            }
            else if (model.account.EndsWith("@2980.com") || model.account.Length < 6 || model.account.Length > 16)
            {
                return(this.FuncResult(new APIReturn(10302, "帐号格式错误")));
            }
            //if (string.IsNullOrEmpty(model.account))
            //{
            //    return this.FuncResult(new APIReturn(10001, "帐号不能为空"));
            //}

            if (!IFConfigReader.IsProg)
            {
                if (string.IsNullOrEmpty(model.smskey))
                {
                    return(this.FuncResult(new APIReturn(10005, "短信验证KEY不能为空")));
                }
                if (string.IsNullOrEmpty(model.smscode))
                {
                    return(this.FuncResult(new APIReturn(10004, "短信验证码不能为空")));
                }
                var smsCheckRet = SmsController.CheckSMS(model.smskey, model.smscode);
                if (smsCheckRet.Code != 0)
                {
                    return(this.FuncResult(smsCheckRet));
                }
            }

            var dicParams = this.DicParams;

            dicParams.Add("mobile", model.mobile);
            dicParams.Add("password", model.password);
            dicParams.Add("account", model.account ?? string.Empty);
            dicParams.Add("name", model.name ?? string.Empty);
            dicParams.Add("idnumber", model.idnumber ?? string.Empty);

            return(this.FuncResult(DC2Invoker.InvokeHttp("reg2980", HttpMethod.Post, dicParams)));
        }
コード例 #2
0
ファイル: UrsController.cs プロジェクト: P79N6A/projects
        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)));
        }