Esempio n. 1
0
 protected void Application_Start(object sender, EventArgs e)
 {
     SessionManager.StartManager();
     MessageCodeManager.SMSCodeManager();    //管理验证码
     WebProc.Init();
     RDSConfig.Init();
     PageLicense.Init();
 }
Esempio n. 2
0
        public appvduserinfo appvdreturn = new appvduserinfo(); //用户登录返回的信息实体类

        #region APP用户注册
        /// <summary>
        /// APP用户注册
        /// </summary>
        /// <param name="inparams">JSON格式的数据参数</param>
        /// <returns></returns>
        public ResponseAppResult AppvdUserRegister(Dictionary <string, string> inparams)
        {
            ResponseAppResult Result    = null;
            userinfos         appvdInfo = new userinfos();

            if (!inparams.Keys.Contains("username") || inparams["username"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少username或username为空!", null);
                return(Result);
            }
            if (!inparams.Keys.Contains("pwd") || inparams["pwd"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少pwd或pwd为空!", null);
                return(Result);
            }
            if (!inparams.Keys.Contains("mobilenum") || inparams["mobilenum"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少mobilenum或mobilenum为空!", null);
                return(Result);
            }
            if (!inparams.Keys.Contains("smscode") || inparams["smscode"] == "")
            {
                Result = new ResponseAppResult(ResState.ParamsImperfect, "缺少smscode或smscode为空!", null);
                return(Result);
            }

            try
            {
                //必填项
                appvdInfo.username  = inparams["username"].Trim();
                appvdInfo.pwd       = inparams["pwd"].Trim();
                appvdInfo.mobilenum = inparams["mobilenum"].Trim();
                appvdInfo.source    = "1";  //默认为手机APP用户注册类型
                string sysflag = inparams["sysflag"];
                //非必填项
                appvdInfo.memo        = inparams.ContainsKey("memo") ? inparams["memo"] : "";
                appvdInfo.email       = inparams.ContainsKey("email") ? inparams["email"] : "";
                appvdInfo.fullname    = inparams.ContainsKey("fullname") ? inparams["fullname"] : "";
                appvdInfo.sex         = inparams.ContainsKey("sex") ? inparams["sex"] : "";
                appvdInfo.phoneno     = inparams.ContainsKey("phoneno") ? inparams["phoneno"] : "";
                appvdInfo.id_card_no  = inparams.ContainsKey("id_card_no") ? inparams["id_card_no"] : "";
                appvdInfo.nativeplace = inparams.ContainsKey("nativeplace") ? inparams["nativeplace"] : "";
                appvdInfo.adress      = inparams.ContainsKey("adress") ? inparams["adress"] : "";

                string smscode = inparams["smscode"];

                if (MessageCodeManager.CheckSms(smscode, appvdInfo.mobilenum))                        //判断验证码是否存在于公共静态变量中
                {
                    int s = CheckUserNameMobileNum(sysflag, appvdInfo.username, appvdInfo.mobilenum); //验证用户名和手机号码是否重复
                    if (s == 0)                                                                       //不存在相同的用户名和手机号码
                    {
                        UserRegister(appvdInfo, sysflag);
                        string dbusername = "";
                        int    uid        = GetUIDUserCheck(sysflag, appvdInfo.username, appvdInfo.pwd, out dbusername);

                        if (uid > 0)
                        {
                            appvduserreg ul = new appvduserreg();
                            ul.uid      = uid.ToString();
                            ul.username = appvdInfo.username;
                            ul.pwd      = appvdInfo.pwd;
                            Result      = new ResponseAppResult(ResState.Success, "操作成功", ul);
                        }
                        else
                        {
                            Result = new ResponseAppResult(ResState.OperationFailed, "注册失败", null);
                            //return Result;
                        }
                        MessageCodeManager.DelSmsByCode(smscode); //当前验证码存在于静态变量中,将其删除(避免生成重复的验证码)
                    }
                    else if (s == 1)                              //用户名存在
                    {
                        Result = new ResponseAppResult(ResState.OperationFailed, "手机号码已经注册!", null);
                        return(Result);
                    }
                    else if (s == 2)//手机号码存在
                    {
                        Result = new ResponseAppResult(ResState.OperationFailed, "用户名已存在!", null);
                        return(Result);
                    }
                    else if (s == 3)//用户已经注册
                    {
                        Result = new ResponseAppResult(ResState.OperationFailed, "用户已经注册!", null);
                        return(Result);
                    }
                }
                else
                {
                    Result = new ResponseAppResult(ResState.OperationFailed, "验证码错误!", null);
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError("AppvdUserRegister调用异常", ex);
                Result = new ResponseAppResult(ResState.OperationFailed, ex.Message, null);
            }
            return(Result);
        }