Esempio n. 1
0
        public async Task <H5ResponseViewModel <object> > UserNewAward([FromBody] H5RequestViewModel Parameters)
        {
            var sysCode = _sys.CheckParameters(Parameters.data, "userverify");
            H5ResponseViewModel <object> response = null;

            if (sysCode == SysCode.Ok)
            {
                string token = Parameters.data.token;
                //token是否有效
                bool isLog = _token.VerifyToken(token);
                if (isLog)
                {
                    UserLoginDto userLogin = JsonHelper.DeserializeJsonToObject <UserLoginDto>(RedisHelper.StringGet($"{CacheKey.Token}{token}", RedisFolderEnum.token, RedisEnum.Five));
                    long         userId    = long.Parse(userLogin.Userid.ToString());
                    sysCode = _userTask.JudgeUser518(userId);
                    bool            isNo         = false;
                    GiveCurrencyDto giveCurrency = new GiveCurrencyDto
                    {
                        amount   = 518.00,
                        forderId = Guid.NewGuid().ToString(),
                        fuserId  = userId.ToString(),
                        key      = _currencyKey.Activity
                    };
                    if (sysCode == SysCode.Ok)
                    {
                        //关闭章鱼赠币
                        // isNo = await _biz.GiveCurrencyAsync(giveCurrency);
                        //从php赠币
                        isNo = await _accout.GiveCurrencyAsync_php(giveCurrency);
                    }
                    _log.InfoFormat("H5用户518领取, 用户id:{0},订单号:{1},code:{2},赠送结果{3}", userLogin.Userid, giveCurrency.forderId, sysCode, isNo);
                }
                else
                {
                    sysCode = SysCode.TokenLose;
                }
            }

            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }
Esempio n. 2
0
        public async Task <H5ResponseViewModel <object> > UserEight([FromBody] H5RequestViewModel Parameters)
        {
            Thread.Sleep(3000);
            H5ResponseViewModel <object> response = null;
            bool isLog   = _token.VerifyToken((string)Parameters.data.userOpenId, (string)Parameters.data.sessionToken);
            var  sysCode = SysCode.Ok;

            if (isLog)
            {
                string strJson = RedisHelper.StringGet($"{CacheKey.Token}{(string)Parameters.data.userOpenId}", RedisFolderEnum.token, RedisEnum.Three);
                var    userLog = JsonHelper.DeserializeJsonToObject <UserLoginDto>(strJson);
                sysCode = _userTask.JudgeUser518(userLog.Userid);
                GiveCurrencyDto giveCurrency = new GiveCurrencyDto
                {
                    amount   = 518.00,
                    forderId = Guid.NewGuid().ToString(),
                    fuserId  = userLog.Userid.ToString(),
                    key      = _currencyKey.Activity
                };
                bool isNo = false;
                if (sysCode == SysCode.Ok)
                {
                    //关闭章鱼赠币
                    //isNo = await _biz.GiveCurrencyAsync(giveCurrency);
                    //从php赠币
                    isNo = await _accout.GiveCurrencyAsync_php(giveCurrency);
                }
                _log.InfoFormat("518,用户id:{0},订单号:{1},code:{2},赠送结果{3}", userLog.Userid, giveCurrency.forderId, sysCode, isNo);
            }
            else
            {
                sysCode = SysCode.SessionTokenLose;
            }
            response = new H5ResponseViewModel <object>(sysCode, null);
            return(response);
        }