From 8f835754e331b53ce64c5b594e6947eb397d20b5 Mon Sep 17 00:00:00 2001 From: zpc Date: Fri, 29 Nov 2024 19:50:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CloudGaming/Code/CloudGaming.Code/Account/AccountBLL.cs | 3 ++- .../Code/CloudGaming.Code/Account/AccountExtend.cs | 3 ++- .../Code/CloudGaming.Code/Account/UserCurrencyExtend.cs | 2 +- src/CloudGaming/Code/CloudGaming.Code/Game/PlayGameBLL.cs | 5 +++++ .../Model/CloudGaming.DtoModel/Account/User/UserInfo.cs | 5 +++++ .../Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs | 2 +- .../Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs | 2 +- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountBLL.cs index 73091d4..9291b84 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountBLL.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountBLL.cs @@ -391,7 +391,8 @@ namespace CloudGaming.Code.Account { userInfoDto.IdCard = userInfoDto.IdCard.Substring(0, 4) + "*********" + userInfoDto.IdCard.Substring(userInfoDto.IdCard.Length - 4); } - var userPlayGameTime = Dao.DaoPhone.Context.T_User_PlayGameTime.Where(it => it.UserId == _UserId).SumAsync(it => (int?)it.PlayTime); + //var userPlayGameTime = await Dao.DaoPhone.Context.T_User_PlayGameTime.Where(it => it.UserId == _UserId).SumAsync(it => (int?)it.PlayTime); + //userInfoDto.UserPlayGameTime = userPlayGameTime ?? 0; return userInfoDto; } diff --git a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs index 94c678d..c709098 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs @@ -157,8 +157,9 @@ namespace CloudGaming.Code.Account { throw MessageBox.Show(ResponseCode.NotFoundRecord, "未找到用户扩展信息"); } - userInfo.LoadUserInfo(user, userData, userCurrency); + var userPlayGameTime = await Dao.DaoPhone.Context.T_User_PlayGameTime.Where(it => it.UserId == userId).SumAsync(it => (int?)it.PlayTime); + userInfo.UserPlayGameTime = userPlayGameTime ?? 0; await cloudGamingBase.RedisCache.StringSetAsync(key, userInfo, TimeSpan.FromHours(1)); } diff --git a/src/CloudGaming/Code/CloudGaming.Code/Account/UserCurrencyExtend.cs b/src/CloudGaming/Code/CloudGaming.Code/Account/UserCurrencyExtend.cs index 33c1962..95388ef 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Account/UserCurrencyExtend.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Account/UserCurrencyExtend.cs @@ -272,7 +272,7 @@ namespace CloudGaming.Code.Account if (issuccess) { cloudGamingBase.UserInfo.Diamond = (int)currency.CurrencyMoney; - await cloudGamingBase.SaveUserInfoCacheChangesAsync(); + //await cloudGamingBase.SaveUserInfoCacheChangesAsync(); UserCurrencyConsumeType consumeType = money >= 0 ? UserCurrencyConsumeType.收入 : UserCurrencyConsumeType.消耗; T_User_DiamondList userDiamondList = null; if (diamondListId > 0) diff --git a/src/CloudGaming/Code/CloudGaming.Code/Game/PlayGameBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Game/PlayGameBLL.cs index 5eadadc..92c4c04 100644 --- a/src/CloudGaming/Code/CloudGaming.Code/Game/PlayGameBLL.cs +++ b/src/CloudGaming/Code/CloudGaming.Code/Game/PlayGameBLL.cs @@ -1,4 +1,5 @@ using CloudGaming.Code.Account; +using CloudGaming.Code.AppExtend; using CloudGaming.Code.Contract; using CloudGaming.DtoModel.Account.User; using CloudGaming.DtoModel.Game; @@ -254,6 +255,10 @@ public class PlayGameBLL : CloudGamingBase { throw MessageBox.ErrorShow("扣款出现错误"); } + //userInfo + //var userPlayGameTime = await Dao.DaoPhone.Context.T_User_PlayGameTime.Where(it => it.UserId == userId).SumAsync(it => (int?)it.PlayTime); + userInfo.UserPlayGameTime += minutes; + await this.SaveUserInfoCacheChangesAsync(); gameInfoCache.CurrencyLogId = currlogId; gameInfoCache.DiamondListId = diamId; //修改最后扣费时间 diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs index 876039b..62d7266 100644 --- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs @@ -69,6 +69,11 @@ public class UserInfo /// public UserInfoNightCard NightCard { get; set; } = new UserInfoNightCard(); + + /// + /// 用户游玩时间,分钟 + /// + public int UserPlayGameTime { get; set; } } diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs index 3a95d72..24aa972 100644 --- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs @@ -54,6 +54,6 @@ namespace CloudGaming.DtoModel.Account.User /// public bool IsPay { get; set; } - + } } diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs index a0b436c..05a480e 100644 --- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs +++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs @@ -14,6 +14,6 @@ namespace CloudGaming.DtoModel.Account.User [AutoMap(typeof(UserInfoCache))] public class UserInfoDto : UserInfo { - + } }