Exemplo n.º 1
0
        public H5ResponseViewModel <ValidateCodeView> GetValidate([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <ValidateCodeView> response = null;
            ValidateCode     validatecode = new ValidateCode();
            ValidateSetting  _imgurl      = new ValidateSetting();
            ValidateCodeView validate     = null;
            var sysCode = _sys.CheckParameters(Parameters.data, "GetValidate");

            if (sysCode == SysCode.Ok)
            {
                dynamic dyParameter = Parameters.data;
                string  strCodeId   = dyParameter.codeId;
                if (!string.IsNullOrEmpty(strCodeId))
                {
                    RedisHelper.KeyDelete(strCodeId, RedisFolderEnum.code, RedisEnum.Four); //删除原来的图片
                }
                validatecode.key = Guid.NewGuid().ToString();
                validatecode.CreateValidateImage(4);
                validate = new ValidateCodeView
                {
                    name   = validatecode.key,
                    imgUrl = $"{_validate.Url}{validatecode.key}.gif"
                };
            }
            else
            {
                sysCode = SysCode.Err;
            }
            response = new H5ResponseViewModel <ValidateCodeView>(sysCode, validate);
            return(response);
        }
Exemplo n.º 2
0
        public async Task <H5ResponseViewModel <CommodityListView> > AcquireRechargeCommodity([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <CommodityListView> response = null;
            CommodityListView result = new CommodityListView();
            var sysCode = _sys.CheckParameters(Parameters.data, "login");

            result.CommodityList = await _recharge.GetRechargeCommodityAsync(0);

            response = new H5ResponseViewModel <CommodityListView>(sysCode, result ?? null);
            return(response);
        }
Exemplo n.º 3
0
        public H5ResponseViewModel <HomePageList> HomePage2([FromBody] RequestViewModel Parameters)
        {
            var          sysCode  = _sys.CheckParameters(Parameters.Data, "homepage");
            HomePageList homePage = null;
            H5ResponseViewModel <HomePageList> response = null;

            if (sysCode == SysCode.Ok)
            {
                var strjson = _homeservice.homePage();
                homePage = strjson;
            }
            response = new H5ResponseViewModel <HomePageList>(sysCode, homePage ?? null);
            return(response);
        }
Exemplo n.º 4
0
        public async Task <H5ResponseViewModel <ActivityViewModel> > ActivityList([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "ActivityList");
            H5ResponseViewModel <ActivityViewModel> response = null;
            ActivityViewModel result = new ActivityViewModel
            {
                data = new List <Activity>()
            };

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                bool   isNo  = _token.VerifyToken(token);
                if (isNo)
                {
                    if (((string)Parameters.data.channel).IsNotBlank())
                    {
                        result.data = await _activity.GetActivityListAsync((string)Parameters.data.channel);

                        result.count = result.data.Count();
                    }
                    else
                    {
                        result.data = await _activity.GetActivityListAsync();

                        result.count = result.data.Count();
                    }
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <ActivityViewModel>(sysCode, result.count == 0 ? null : result);
            return(response);
        }
Exemplo n.º 5
0
        public async Task <H5ResponseViewModel <Object> > SendCode([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <Object> response = null;
            var    sysCode = _sys.CheckParameters(Parameters.data, "SendCode");;
            string phone   = Parameters.data.phone;
            bool   isExist = await _user.PhoneExistAsync(phone);

            if (sysCode == SysCode.Ok)
            {
                string key  = string.Empty;
                string code = string.Empty;
                switch ((string)Parameters.data.type)
                {
                case "1":
                    key = CacheKey.Rgister.ToString();
                    if (isExist)
                    {
                        /*手机号码已经注册*/
                        sysCode = SysCode.PhoneExist;
                    }
                    break;

                case "2":
                    key = CacheKey.LogIn.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                case "3":
                    key = CacheKey.SeekPwd.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                case "4":
                    key = CacheKey.UnbindPhone.ToString();
                    break;

                case "5":
                    key = CacheKey.BindPhone.ToString();
                    if (isExist)
                    {
                        /*手机号码已经注册*/
                        sysCode = SysCode.PhoneExist;
                    }
                    break;

                case "6":
                    key = CacheKey.UpdatePwd.ToString();
                    if (!isExist)
                    {
                        /*未注册*/
                        sysCode = SysCode.PhoneNonentity;
                    }
                    break;

                default:
                    break;
                }
                key = $"{key}{(string)Parameters.data.phone}";
                #region
                code = "123456"; //_sys.getrandomseed(4).tostring();
                if (sysCode == SysCode.Ok)
                {
                    if (RedisHelper.KeyExists(key, RedisFolderEnum.code, RedisEnum.Four)) //是否存在
                    {
                        /*重复获取*/
                        sysCode = SysCode.RepeatedGetCode;
                    }
                    if (sysCode == SysCode.Ok)
                    {
                        //!_mag.messagecode((string)obj.data.phone, code, stringextension.toint((string)obj.data.sendtype))
                        if (false)
                        {
                            /*获取验证码失败*/
                            sysCode = SysCode.GetCodeErr;
                        }
                        else
                        {
                            RedisHelper.StringSet(key, code, 10, RedisFolderEnum.code, RedisEnum.Four);
                        }
                    }
                }
                #endregion
                //code = _sys.GetRandomSeed(4).ToString();
                //if (sysCode == SysCode.Ok)
                //{
                //    if (RedisHelper.KeyExists(key, RedisFolderEnum.code, RedisEnum.Four)) //是否存在
                //    {
                //        /*重复获取*/
                //        sysCode = SysCode.RepeatedGetCode;
                //    }
                //    if (sysCode == SysCode.Ok)
                //    {
                //        if (!_msg.MessageCode((string)Parameters.data.phone, code, ((string)Parameters.data.sendType).ToInt()))
                //        {
                //            /*获取验证码失败*/
                //            sysCode = SysCode.GetCodeErr;
                //        }
                //        else
                //        {
                //            _log.Info("获取短信验证码成功");
                //            RedisHelper.StringSet(key, code, 1, RedisFolderEnum.code, RedisEnum.Four);
                //        }
                //    }
                //}
            }
            response = new H5ResponseViewModel <Object>(sysCode, null);
            return(response);
        }
Exemplo n.º 6
0
        public async Task <H5ResponseViewModel <GameUrlResponse> > GetUrl([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "gameUrl");
            H5ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isNo = _token.VerifyToken(token);
                if (isNo)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         user_id   = long.Parse(userLogin.Userid.ToString());
                    string       temp      = Parameters.data.gameId;
                    //获取用户信息,
                    UserInfoDto userInfo = await _user.SearchUserInfoAsync(user_id);

                    string key = string.Empty;
                    switch (temp)
                    {
                    case "1":
                        key = _gameKey.Dog;
                        break;

                    case "2":
                        key = _gameKey.Fish;
                        break;

                    case "3":
                        key = _gameKey.Star;
                        break;

                    default:
                        break;
                    }
                    result = _biz.GameUrl(key, user_id, "H5", 4, "H5", userInfo.Nick_name);
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }
            response = new H5ResponseViewModel <GameUrlResponse>(sysCode, result ?? null);
            return(response);
        }