Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public async Task <ResponseViewModel <GameUrlResponse> > GameUrl([FromBody] RequestViewModel obj)
        {
            obj = JsonHelper.DeserializeJsonToObject <RequestViewModel>(Content(User.Identity.Name).Content);
            ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result = new GameUrlResponse();
            var             code   = SysCode.Ok;
            bool            isLog  = _token.VerifyToken(obj.HendInfo.UserOpenId, obj.HendInfo.SessionToken);

            if (isLog)
            {
                string strJson  = RedisHelper.StringGet($"{CacheKey.Token}{obj.HendInfo.UserOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                var    userLog  = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                var    userInfo = await _user.SearchUserInfoAsync(userLog.Userid);

                string temp = obj.Data.gameId;
                string key  = string.Empty;
                switch (temp)
                {
                case "1":
                    key        = _gameKey.Dog;
                    result.Url = "http://hainan.funhainan.com:8084/ZsqImage/loading/index.html?gameType=3";
                    // result.Url = "https://hainan.funhainan.com/ZsqImage/newapploading/index.html?gameType=3";
                    break;

                case "2":
                    key        = _gameKey.Fish;
                    result.Url = "http://hainan.funhainan.com:8084/ZsqImage/loading/index.html?gameType=2";
                    // result.Url = "https://hainan.funhainan.com/ZsqImage/newapploading/index.html?gameType=2";
                    break;

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

                default:
                    break;
                }
                if (key == _gameKey.Star)
                {
                    int osType = obj.Client.OsType == "IOS" ? 1 : obj.Client.OsType == "Android" ? 2 : 0;
                    result = _biz.GameUrl(key, userLog.Userid, obj.Client.Version, osType, obj.Client.DeviceCode, userInfo.Nick_name);
                }
                if (result == null)
                {
                    code = SysCode.Err;
                }
            }
            else
            {
                code = SysCode.SessionTokenLose;
            }
            response = new ResponseViewModel <GameUrlResponse>(code, result ?? null, obj.Encrypt, _sys, obj.Secret);
            return(response);
        }
Exemplo n.º 3
0
        public H5ResponseViewModel <GameUrlResponse> GetUrl([FromBody] H5RequestViewModel Parameters)
        {
            H5ResponseViewModel <GameUrlResponse> response = null;
            GameUrlResponse result  = null;
            var             sysCode = SysCode.Ok;
            string          userId  = _biz.IsNoLogin((string)Parameters.data.token, (string)Parameters.data.userOpenId);

            if (userId != "0")
            {
                long user_id = long.Parse(userId);
                result = _biz.GameUrl("sixc", user_id, "", 1, "", "");
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <GameUrlResponse>(sysCode, result);
            return(response);
        }