示例#1
0
        public object getUserRegister(Dictionary <string, object> dicParas)
        {
            string        errMsg       = string.Empty;
            string        xcGameDBName = string.Empty;
            string        Mobile       = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
            string        StoreId      = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string        UserName     = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string        PassWord     = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;
            string        smsCode      = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
            string        Pass         = Utils.MD5(PassWord);
            StoreBusiness store        = new StoreBusiness();

            if (!store.IsEffectiveStore(StoreId, out xcGameDBName, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }
            string key = Mobile + "_" + smsCode;

            //判断缓存验证码是否正确
            if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile))
            {
                if (!SMSCodeCache.IsExist(key))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                }
            }
            IUserRegisterService userregisterService = BLLContainer.Resolve <IUserRegisterService>();
            //判断用户名是否存在
            var userlist = userregisterService.GetModels(p => p.UserName == UserName).ToList();

            if (userlist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户名已经存在"));
            }
            //判断用户是否注册
            var menulist = userregisterService.GetModels(p => p.Mobile == Mobile && p.StoreId == StoreId).ToList();

            if (menulist.Count > 0)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该用户已注册"));
            }
            xcGameDBName = "XCGameManagerDB";
            string sql = "exec InsertUserRegister @UserName,@PassWord,@Mobile,@StoreId,@Return output ";

            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0]           = new SqlParameter("@UserName", UserName);
            parameters[1]           = new SqlParameter("@PassWord", Pass);
            parameters[2]           = new SqlParameter("@Mobile", Mobile);
            parameters[3]           = new SqlParameter("@StoreId", StoreId);
            parameters[4]           = new SqlParameter("@Return", 0);
            parameters[4].Direction = System.Data.ParameterDirection.Output;
            t_UserRegister userregister = userregisterService.SqlQuery(sql, xcGameDBName, parameters).FirstOrDefault <t_UserRegister>();

            if (userregister == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户添加异常"));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }
示例#2
0
 public object getUserToken(Dictionary <string, object> dicParas)
 {
     try
     {
         string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
         string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
         string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
         if (string.IsNullOrEmpty(smsCode))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码"));
         }
         bool   isSMSTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["isSMSTest"].ToString());
         string key       = mobile + "_" + smsCode;
         if (!isSMSTest && !FilterMobileBusiness.ExistMobile(mobile))
         {
             if (!SMSCodeCache.IsExist(key))
             {
                 return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
             }
         }
         if (string.IsNullOrEmpty(storeId))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号不能为空"));
         }
         if (string.IsNullOrEmpty(mobile))
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码不能为空"));
         }
         int           storeids     = int.Parse(storeId);
         IStoreService storeService = BLLContainer.Resolve <IStoreService>();
         var           menlist      = storeService.GetModels(x => x.id == storeids).FirstOrDefault <t_store>();
         if (menlist == null)
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
         }
         string         dbname        = menlist.store_dbname;
         IMemberService memberService = BLLContainer.Resolve <IMemberService>(dbname);
         var            memberlist    = memberService.GetModels(x => x.Mobile == mobile).FirstOrDefault <t_member>();
         if (memberlist == null)
         {
             return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码无效"));
         }
         var UserToken = UserInfoBusiness.SetUserToken(storeId, mobile);
         return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, UserToken, Result_Code.T, ""));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#3
0
        public object getForgetPassWord(Dictionary <string, object> dicParas)
        {
            string UserName = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string PassWord = dicParas.ContainsKey("PassWord") ? dicParas["PassWord"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(PassWord))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入新密码"));
            }
            string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(smsCode))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码"));
            }
            IUserRegisterService userervice = BLLContainer.Resolve <IUserRegisterService>();
            var menulist = userervice.GetModels(p => p.UserName.Equals(UserName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_UserRegister>();

            if (menulist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
            }
            string errMsg = string.Empty;
            string Mobile = menulist.Mobile;
            //判断缓存验证码是否正确
            string key = Mobile + "_" + smsCode;

            if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile))
            {
                if (!SMSCodeCache.IsExist(key))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                }
            }
            string pass = Utils.MD5(PassWord);

            menulist.PassWord = pass;
            userervice.Update(menulist);
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
        }
示例#4
0
        public object getUser(Dictionary <string, object> dicParas)
        {
            string UserName = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty;
            string imgCode  = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(UserName))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入用户名"));
            }
            if (string.IsNullOrEmpty(imgCode))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码"));
            }

            if (!FilterMobileBusiness.IsTestSMS)
            {
                if (!ValidateImgCache.Exist(imgCode.ToUpper()))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
                }
            }

            IUserRegisterService userervice = BLLContainer.Resolve <IUserRegisterService>();
            var menulist = userervice.GetModels(p => p.UserName.Equals(UserName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_UserRegister>();

            if (menulist == null)
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
            }
            string Mobile = menulist.Mobile;

            //短信模板
            string templateId = "2";
            string key        = string.Empty;

            if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile))
            {
                string smsCode = string.Empty;
                if (SMSBusiness.GetSMSCode(out smsCode))
                {
                    key = Mobile + "_" + smsCode;
                    SMSCodeCache.Add(key, Mobile, CacheExpires.SMSCodeExpires);
                    string errMsg = string.Empty;
                    if (SMSBusiness.SendSMSCode(templateId, Mobile, smsCode, out errMsg))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "发送验证码出错"));
                }
            }
            else
            {
                key = Mobile + "_" + "123456";
                SMSCodeCache.Add(key, Mobile, CacheExpires.SMSCodeExpires);
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
            }
        }
示例#5
0
        public object sendSMSCode(Dictionary <string, object> dicParas)
        {
            try
            {
                //是否模拟短信测试(1-模拟短信测试,不发送固定短信,不做短信验证)

                string mobile     = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString().Trim() : "";
                string templateId = "2";//短信模板
                string token      = dicParas.ContainsKey("token") ? dicParas["token"].ToString().Trim() : "";

                //验证请求次数
                if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    if (!RequestTotalCache.CanRequest(mobile, ApiRequestType.SendSMSCode))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "已超过单日最大请求次数"));
                    }
                    else
                    {
                        RequestTotalCache.Add(mobile, ApiRequestType.SendSMSCode);
                    }
                }

                if (!Utils.CheckMobile(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码无效"));
                }

                //验证短信验证码
                string key = mobile + "_" + token;
                object smsTempTokenCacheObj = SMSTempTokenCache.GetValue(key);
                if (smsTempTokenCacheObj == null)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
                }

                if (!smsTempTokenCacheObj.ToString().Equals(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
                }

                //发送短信,并添加缓存成功
                if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    string smsCode = string.Empty;
                    if (SMSBusiness.GetSMSCode(out smsCode))
                    {
                        key = mobile + "_" + smsCode;
                        SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);
                        string errMsg = string.Empty;
                        if (SMSBusiness.SendSMSCode(templateId, mobile, smsCode, out errMsg))
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                        }
                        else
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "发送验证码出错"));
                    }
                }
                else
                {
                    key = mobile + "_" + "123456";
                    SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#6
0
        public object getMobileToken(Dictionary <string, object> dicParas)
        {
            try
            {
                string token   = dicParas.ContainsKey("token") ? dicParas["token"].ToString().Trim() : "";
                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString().Trim() : "";
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString().Trim() : "";
                string openId  = dicParas.ContainsKey("openId") ? dicParas["openId"].ToString().Trim() : "";

                //获取手机号码
                string mobile = string.Empty;
                if (!MobileTokenBusiness.ExistToken(token, out mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌无效"));
                }

                string key = mobile + "_" + smsCode;
                if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    if (!SMSCodeCache.IsExist(key))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                    }
                }

                if (SMSCodeCache.IsExist(key))
                {
                    SMSCodeCache.Remove(key);
                }

                //绑定openId
                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "storeId参数不能为空"));
                }

                if (!Utils.isNumber(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "店号的格式不正确"));
                }

                if (string.IsNullOrEmpty(openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "openId参数不能为空"));
                }

                int           iStoreId     = Convert.ToInt32(storeId);
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                if (!storeService.Any(a => a.id == iStoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该门店不存在"));
                }

                var storeModel = storeService.GetModels(p => p.id == iStoreId).FirstOrDefault();
                if (!string.IsNullOrEmpty(storeModel.openId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店已绑定微信,不能重复绑定"));
                }

                storeModel.openId = openId;
                if (!storeService.Update(storeModel))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "绑定openId失败"));
                }

                token = MobileTokenBusiness.SetMobileToken(mobile);
                var tokenModel = new
                {
                    mobileToken = token
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, tokenModel));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#7
0
        public object getRegisterSMSCode(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
                string imgCode = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty;
                string errMsg  = string.Empty;

                //验证码
                if (!ValidateImgCache.Exist(imgCode.ToUpper()))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效"));
                }
                ValidateImgCache.Remove(imgCode.ToUpper());

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号码不正确"));
                }
                if (string.IsNullOrEmpty(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码不正确"));
                }

                bool isSMSTest = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["isSMSTest"].ToString());

                StoreBusiness   sb         = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!sb.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }


                if (storeModel.StoreDBDeployType == 0)
                {
                    //验证用户在分库是否存在
                    XCCloudService.BLL.IBLL.XCGame.IUserService userService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IUserService>(storeModel.StoreDBName);
                    var gameUserModel = userService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.u_users>();
                    if (gameUserModel == null)
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                    }
                }
                else if (storeModel.StoreDBDeployType == 1)
                {
                    string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                    UDPSocketCommonQueryAnswerModel answerModel = null;
                    string radarToken = string.Empty;
                    if (DataFactory.SendDataUserPhoneQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, mobile, out radarToken, out errMsg))
                    {
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }

                    answerModel = null;
                    int whileCount = 0;
                    while (answerModel == null && whileCount <= 25)
                    {
                        //获取应答缓存数据
                        whileCount++;
                        System.Threading.Thread.Sleep(1000);
                        answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                    }

                    if (answerModel != null)
                    {
                        UserPhoneQueryResultNotifyRequestModel model = (UserPhoneQueryResultNotifyRequestModel)(answerModel.Result);
                        //移除应答缓存数据
                        UDPSocketCommonQueryAnswerBusiness.Remove(sn);
                        if (model.Result_Code == "0")
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店设置不正确"));
                }

                string templateId = "2";

                string key = string.Empty;
                if (!isSMSTest && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    string smsCode = string.Empty;
                    if (SMSBusiness.GetSMSCode(out smsCode))
                    {
                        key = mobile + "_" + smsCode;
                        SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);

                        if (SMSBusiness.SendSMSCode(templateId, mobile, smsCode, out errMsg))
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                        }
                        else
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "发送验证码出错"));
                    }
                }
                else
                {
                    key = mobile + "_" + "123456";
                    SMSCodeCache.Add(key, mobile, CacheExpires.SMSCodeExpires);
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#8
0
        public object registerUser(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
                string smsCode = dicParas.ContainsKey("smsCode") ? dicParas["smsCode"].ToString() : string.Empty;
                string errMsg  = string.Empty;
                int    userId  = 0;

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号码不正确"));
                }
                if (string.IsNullOrEmpty(mobile))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机号码不正确"));
                }
                if (string.IsNullOrEmpty(smsCode))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码"));
                }

                //验证短信验证码
                string key = mobile + "_" + smsCode;
                if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(mobile))
                {
                    if (!SMSCodeCache.IsExist(key))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "短信验证码无效"));
                    }
                }

                if (SMSCodeCache.IsExist(key))
                {
                    SMSCodeCache.Remove(key);
                }

                //验证门店是否有效
                StoreBusiness   sb         = new StoreBusiness();
                StoreCacheModel storeModel = null;
                if (!sb.IsEffectiveStore(storeId, ref storeModel, out errMsg))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                if (storeModel.StoreDBDeployType == 0)
                {
                    //验证用户在分库是否存在
                    XCCloudService.BLL.IBLL.XCGame.IUserService userService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IUserService>(storeModel.StoreDBName);
                    var gameUserModel = userService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.u_users>();
                    if (gameUserModel == null)
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                    }
                    userId = gameUserModel.UserID;
                }
                else if (storeModel.StoreDBDeployType == 1)
                {
                    string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                    UDPSocketCommonQueryAnswerModel answerModel = null;
                    string radarToken = string.Empty;
                    if (DataFactory.SendDataUserPhoneQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, mobile, out radarToken, out errMsg))
                    {
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                    }

                    answerModel = null;
                    int whileCount = 0;
                    while (answerModel == null && whileCount <= 25)
                    {
                        //获取应答缓存数据
                        whileCount++;
                        System.Threading.Thread.Sleep(1000);
                        answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                    }

                    if (answerModel != null)
                    {
                        UserPhoneQueryResultNotifyRequestModel model = (UserPhoneQueryResultNotifyRequestModel)(answerModel.Result);
                        //移除应答缓存数据
                        UDPSocketCommonQueryAnswerBusiness.Remove(sn);
                        if (model.Result_Code == "0")
                        {
                            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户"));
                        }
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                    }
                    userId = 0;//本地库用0
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店配置无效"));
                }

                //验证用户在总库是否已注册
                XCCloudService.BLL.IBLL.XCGameManager.IUserService userServiceManager = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IUserService>();
                var userRegisterModel = userServiceManager.GetModels(p => p.Mobile.Equals(mobile) && p.StoreId.Equals(storeId)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_user>();

                if (userRegisterModel == null)
                {
                    //添加注册用户
                    XCCloudService.Model.XCGameManager.t_user t_user = new XCCloudService.Model.XCGameManager.t_user();
                    t_user.Mobile     = mobile;
                    t_user.StoreId    = storeId;
                    t_user.CreateTime = System.DateTime.Now;
                    t_user.OpenId     = "";

                    if (!userServiceManager.Add(t_user))
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "添加注册用户失败"));
                    }
                }

                //获取用户token
                //云库不用userId
                string token = XCCloudManaUserTokenBusiness.SetToken(mobile, storeId, storeModel.StoreName, userId);
                List <XCCloudManaUserTokenResultModel> list = null;
                XCCloudManaUserTokenBusiness.GetUserTokenModel(mobile, ref list);
                var obj = new
                {
                    userToken = token,
                    storeList = list
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            catch (Exception e)
            {
                throw e;
            }
        }