diff --git a/src/CloudGaming/Api/CloudGaming.Api/Controllers/AppController.cs b/src/CloudGaming/Api/CloudGaming.Api/Controllers/AppController.cs
index eafa2b7..6d87923 100644
--- a/src/CloudGaming/Api/CloudGaming.Api/Controllers/AppController.cs
+++ b/src/CloudGaming/Api/CloudGaming.Api/Controllers/AppController.cs
@@ -1,10 +1,8 @@
using CloudGaming.Api.Base;
using CloudGaming.Code.Config;
using CloudGaming.DtoModel;
-using CloudGaming.GameModel.Db.Db_Ext;
using HuanMeng.DotNetCore.AttributeExtend;
-using HuanMeng.DotNetCore.Base;
using Microsoft.AspNetCore.Mvc;
@@ -25,7 +23,6 @@ namespace CloudGaming.Api.Controllers
///
///
[HttpGet]
- [Message("发送成功")]
public async Task GetAppConfigAsync()
{
AppConfigBLL appConfigBLL = new AppConfigBLL(ServiceProvider);
diff --git a/src/CloudGaming/Api/CloudGaming.Api/Controllers/MallController.cs b/src/CloudGaming/Api/CloudGaming.Api/Controllers/MallController.cs
new file mode 100644
index 0000000..80aaa98
--- /dev/null
+++ b/src/CloudGaming/Api/CloudGaming.Api/Controllers/MallController.cs
@@ -0,0 +1,44 @@
+using CloudGaming.Api.Base;
+using CloudGaming.Code.Mall;
+using CloudGaming.DtoModel.Mall;
+
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace CloudGaming.Api.Controllers
+{
+
+ ///
+ /// 商城
+ ///
+ public class MallController : CloudGamingControllerBase
+ {
+ public MallController(IServiceProvider _serviceProvider) : base(_serviceProvider)
+ {
+ }
+ ///
+ /// 获取商城数据
+ ///
+ ///
+ [HttpGet]
+ public async Task> GetDiamondMall()
+ {
+ ProductBLL productBLL = new ProductBLL(ServiceProvider);
+ return await productBLL.GetDiamondMall();
+ }
+
+
+ ///
+ /// 获取包夜卡数据
+ ///
+ ///
+ [HttpGet]
+ public async Task> GetNightCard()
+ {
+ ProductBLL productBLL = new ProductBLL(ServiceProvider);
+
+ return await productBLL.GetNightCard();
+ }
+
+ }
+}
diff --git a/src/CloudGaming/Api/CloudGaming.Api/Controllers/SevenDayController.cs b/src/CloudGaming/Api/CloudGaming.Api/Controllers/SevenDayController.cs
new file mode 100644
index 0000000..1706f1f
--- /dev/null
+++ b/src/CloudGaming/Api/CloudGaming.Api/Controllers/SevenDayController.cs
@@ -0,0 +1,47 @@
+using CloudGaming.Api.Base;
+using CloudGaming.Code.DataAccess;
+using CloudGaming.Code.Other;
+using CloudGaming.DtoModel.Account.User;
+using CloudGaming.DtoModel.SevenSign;
+using CloudGaming.Model.DbSqlServer.Db_Phone;
+
+using HuanMeng.DotNetCore.Base;
+
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace CloudGaming.Api.Controllers
+{
+ ///
+ /// 七天签到
+ ///
+ public class SevenDayController : CloudGamingControllerBase
+ {
+ public SevenDayController(IServiceProvider _serviceProvider) : base(_serviceProvider)
+ {
+ }
+ ///
+ /// 七天签到
+ ///
+ ///
+ [HttpGet]
+ public async Task GetSevenSignList()
+ {
+ SevenSignBLL sevenSignBLL = new SevenSignBLL(ServiceProvider);
+ return await sevenSignBLL.GetSevenSignList();
+ }
+
+ ///
+ /// 签到接口
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task> SevenSignToday()
+ {
+ SevenSignBLL sevenSignBLL = new SevenSignBLL(ServiceProvider);
+ return await sevenSignBLL.SevenSignToday();
+ }
+
+ }
+}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs
index 09b70ac..8720983 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Account/AccountExtend.cs
@@ -6,6 +6,7 @@ using CloudGaming.Code.Account.UserCurrency;
using CloudGaming.Code.DataAccess;
using CloudGaming.DtoModel.Account.Login;
using CloudGaming.DtoModel.Account.User;
+using CloudGaming.DtoModel.Account.User.Cache;
using HuanMeng.DotNetCore.Redis;
@@ -223,6 +224,18 @@ namespace CloudGaming.Code.Account
return userInfo;
}
+ ///
+ /// 保存用户缓存
+ ///
+ ///
+ ///
+ public static async Task SaveUserInfoCacheChangesAsync(UserInfoCache userInfo, IDatabase database)
+ {
+ var key = GetUserInfoRedisKey(userInfo.UserId);
+ await database.StringSetAsync(key, userInfo, TimeSpan.FromHours(1));
+ return userInfo;
+ }
+
///
/// 扣除当前用户钻石
///
@@ -244,7 +257,7 @@ namespace CloudGaming.Code.Account
///
///
///
- public static IUserConsumeMoney GetCurrentUserConsumeMoney(this UserInfoCache userInfo, CloudGamingBase cloudGamingBase, UserCurrencyType userCurrencyType, T_User_Currency currency = null)
+ public static IUserConsumeMoney CurrentUserConsumeMoney(this UserInfoCache userInfo, CloudGamingBase cloudGamingBase, UserCurrencyType userCurrencyType, T_User_Currency currency = null)
{
if (UserCurrencyType.钻石 == userCurrencyType)
{
@@ -365,7 +378,88 @@ namespace CloudGaming.Code.Account
return false;
}
return true;
+ }
+
+ ///
+ /// 获取用户购买过的产品
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static async Task> GetBuyProductCount(this UserInfoCache userInfoCache, DAO dao, IDatabase database)
+ {
+ int userId = userInfoCache.UserId;
+ if (userInfoCache.BuyProductCount == null)
+ {
+ var orderDictionary = await dao.DaoUser.Context.T_User_Order
+ .Where(it => it.UserId == userId).GroupBy(it => it.ProductId).ToDictionaryAsync(it => it.Key, it => it.Count());
+ if (orderDictionary == null)
+ {
+ orderDictionary = new Dictionary();
+ }
+ userInfoCache.BuyProductCount = orderDictionary;
+ await SaveUserInfoCacheChangesAsync(userInfoCache, database);
+ //new CloudGamingBase().SaveUserInfoCacheChangesAsync();
+ }
+ return userInfoCache.BuyProductCount;
+ }
+
+
+ ///
+ /// 获取用户七天签到
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static async Task GetUserSevenDay(this UserInfoCache userInfoCache, DAO dao, IDatabase database)
+ {
+
+ if (userInfoCache.UserSevenDay == null)
+ {
+ UserSevenDayCache userSevenDayCache = new UserSevenDayCache();
+
+ //取出用户最后一条签到记录
+ var log = await dao.DaoPhone.Context.T_User_SignDays.Where(it => it.UserId == userInfoCache.UserId).OrderByDescending(it => it.Id).FirstOrDefaultAsync();
+ if (log != null)
+ {
+
+ if (log.SignDayTime.Date == DateTime.Now.Date)
+ {
+ userSevenDayCache.IsSignSevenDay = true;
+ //如果今天已经签到了
+ userSevenDayCache.ConsecutiveSignDays = log.SignDayNum;
+ }
+ else if (log.SignDayTime.Date == DateTime.Now.AddDays(-1).Date)
+ {
+ //判断用户昨天有没有签到过
+ userSevenDayCache.ConsecutiveSignDays = log.SignDayNum;
+ //如果用户昨天签到累计7天了,今天还没有签到,则将重置签到天数
+ if (log.SignDayNum == 7)
+ {
+ userSevenDayCache.ConsecutiveSignDays = 0;
+ }
+ }
+ else
+ {
+ //用户签到中断,重置签到天数
+ userSevenDayCache.ConsecutiveSignDays = 0;
+ }
+ userSevenDayCache.LastSevenDayTime = log.SignDayTime;
+ }
+ else
+ {
+ userSevenDayCache.ConsecutiveSignDays = 0;
+ userSevenDayCache.IsSignSevenDay = false;
+
+ }
+ userInfoCache.UserSevenDay = userSevenDayCache;
+ await SaveUserInfoCacheChangesAsync(userInfoCache, database);
+ }
+ return userInfoCache.UserSevenDay;
}
+
}
}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
index c95a720..ea1de40 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/CloudGamingCache.cs
@@ -2,6 +2,8 @@ using AutoMapper;
using CloudGaming.Code.Cache.Special;
using CloudGaming.DtoModel.Game;
+using CloudGaming.DtoModel.Mall;
+using CloudGaming.DtoModel.SevenSign;
using HuanMeng.DotNetCore.CacheHelper;
@@ -107,7 +109,7 @@ namespace CloudGaming.Code.Cache
private ImageEntityCache imageEntityCache;
///
- /// 图片缓存
+ /// 图片缓存
///
public ImageEntityCache ImageEntityCache
{
@@ -121,6 +123,69 @@ namespace CloudGaming.Code.Cache
}
}
#endregion
+ ///
+ ///
+ ///
+ private ProductCacheEntityCache productCacheEntityCache;
+
+ ///
+ /// 产品缓存
+ ///
+ public ProductCacheEntityCache ProductCacheEntityCache
+ {
+ get
+ {
+ if (productCacheEntityCache == null)
+ {
+ productCacheEntityCache = new ProductCacheEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper);
+ }
+ return productCacheEntityCache;
+ }
+ }
+
+ ///
+ /// 产品列表
+ ///
+ public List ProductCacheList
+ {
+ get
+ {
+ return ProductCacheEntityCache.DataList ?? new List();
+ }
+ }
+
+ #region 七天签到
+ ///
+ ///
+ ///
+ private SevenDayEntityCache sevenDayEntityCache;
+
+ ///
+ /// 七天签到缓存
+ ///
+ public SevenDayEntityCache SevenDayEntityCache
+ {
+ get
+ {
+ if (sevenDayEntityCache == null)
+ {
+ sevenDayEntityCache = new SevenDayEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper);
+ }
+ return sevenDayEntityCache;
+ }
+ }
+
+ ///
+ /// 七天签到列表
+ ///
+ public List SevenDayList
+ {
+ get
+ {
+ return SevenDayEntityCache.DataList ?? new List();
+ }
+ }
+ #endregion
#region 首页缓存表
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/ProductCacheEntityCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/ProductCacheEntityCache.cs
new file mode 100644
index 0000000..3f5a9ef
--- /dev/null
+++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/ProductCacheEntityCache.cs
@@ -0,0 +1,56 @@
+using AutoMapper;
+
+using CloudGaming.Code.DataAccess;
+using CloudGaming.DtoModel.Game;
+using CloudGaming.DtoModel.Mall;
+
+using HuanMeng.DotNetCore.CacheHelper;
+
+using StackExchange.Redis;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.Code.Cache.Special;
+
+///
+/// 商城产品缓存
+///
+///
+///
+///
+///
+public class ProductCacheEntityCache(DAO dao, IDatabase database, IMapper mapper) : RedisDataEntityCache(database, GameEntityCache.GameEntityCacheLock, 60 * 60 * 12)
+{
+ public override string key => "App:Product";
+
+ ///
+ ///
+ ///
+ ///
+ public override List GetDataList()
+ {
+ var list = dao.DaoPhone.Context.T_Products.AsNoTracking().Where(it => it.IsEnable).ToList();
+ if (list == null)
+ {
+ list = new List();
+ }
+
+ var products = mapper.Map>(list);
+ var rewards = dao.DaoPhone.Context.T_Products_Reward.AsNoTracking().ToList();
+ products.ForEach(product =>
+ {
+ //获取所有奖励
+ var _rewards = rewards.Where(it => it.T_ProductId == product.Id).ToList();
+ product.Rewards = _rewards;
+ if (product.Rewards == null)
+ {
+ product.Rewards = new List();
+ }
+ });
+ return products;
+ }
+}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/SevenDayEntityCache.cs b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/SevenDayEntityCache.cs
new file mode 100644
index 0000000..2e1e665
--- /dev/null
+++ b/src/CloudGaming/Code/CloudGaming.Code/Cache/Special/SevenDayEntityCache.cs
@@ -0,0 +1,51 @@
+using AutoMapper;
+
+using CloudGaming.Code.DataAccess;
+using CloudGaming.DtoModel.Mall;
+using CloudGaming.DtoModel.SevenSign;
+
+using HuanMeng.DotNetCore.CacheHelper;
+
+using StackExchange.Redis;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.Code.Cache.Special;
+
+///
+/// 七天签到配置数据
+///
+///
+///
+///
+public class SevenDayEntityCache(DAO dao, IDatabase database, IMapper mapper) : RedisDataEntityCache(database, GameEntityCache.GameEntityCacheLock, 60 * 60 * 24 * 7)
+{
+ public override List GetDataList()
+ {
+ var list = dao.DaoPhone.Context.T_SevenDaySignIn.AsNoTracking().OrderBy(it => it.OrderId).ToList();
+ if (list == null)
+ {
+ list = new List();
+ }
+
+ var sevenDayCache = mapper.Map>(list);
+ var rewards = dao.DaoPhone.Context.T_SevenDaySignIn_Reward.AsNoTracking().ToList();
+ sevenDayCache.ForEach(item =>
+ {
+ //获取所有奖励
+ var _rewards = rewards.Where(it => it.SigninId == item.Id).ToList();
+ item.Rewards = _rewards;
+ if (item.Rewards == null)
+ {
+ item.Rewards = new List();
+ }
+ });
+ return sevenDayCache;
+ }
+
+ public override string key => "App:SevenDay";
+}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs
index 504bb07..94169ed 100644
--- a/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs
+++ b/src/CloudGaming/Code/CloudGaming.Code/Config/AppConfigBLL.cs
@@ -30,6 +30,7 @@ namespace CloudGaming.Code.Config
};
appConfigDto.IsChecking = IsChecking;
appConfigDto.SignKey = AppConfig.TenantId.ToString("N");
+ appConfigDto.NightCardTips = $"22点30分至次日7点畅玩无消耗";
return appConfigDto;
}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Mall/ProductBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Mall/ProductBLL.cs
new file mode 100644
index 0000000..f063407
--- /dev/null
+++ b/src/CloudGaming/Code/CloudGaming.Code/Mall/ProductBLL.cs
@@ -0,0 +1,84 @@
+using CloudGaming.Code.Account;
+using CloudGaming.DtoModel.Mall;
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.Code.Mall;
+
+///
+/// 产品逻辑
+///
+public class ProductBLL : CloudGamingBase
+{
+ public ProductBLL(IServiceProvider serviceProvider) : base(serviceProvider)
+ {
+ }
+ ///
+ /// 获取商城数据
+ ///
+ ///
+ public async Task> GetDiamondMall()
+ {
+ int productType = (int)ProductType.钻石商城;
+
+ var diamondMallDtos = await GetProductList(productType);
+ return diamondMallDtos;
+ }
+
+
+ ///
+ /// 获取包夜卡数据
+ ///
+ ///
+ public async Task> GetNightCard()
+ {
+ var diamondMallDtos = await GetProductList((int)ProductType.包夜卡);
+ return diamondMallDtos;
+ }
+ ///
+ /// 获取商品数据
+ ///
+ ///
+ ///
+
+ private async Task> GetProductList(int productType)
+ {
+ List diamondMallDtos = new List();
+ //获取首充
+ Dictionary orderDictionary = new Dictionary();
+ if (_UserId > 0)
+ {
+ orderDictionary = await UserInfo.GetBuyProductCount(Dao, RedisCache);
+ }
+ //获取钻石商城产品列表
+ var list = Cache.ProductCacheList.Where(it => it.ProductType == productType).ToList();
+ list.ForEach(it =>
+ {
+ DiamondMallDto diamondMallDto = new DiamondMallDto()
+ {
+ Price = it.Price.ToString("0.##"),
+ ProductDesc = it.ProductDesc ?? "",
+ ProductId = it.ProductId,
+ ProductImage = it.ImageId,
+ ProductName = it.ProductName,
+ ProductSelectImage = it.SelectImageId ?? 0,
+ ProductType = it.ProductType,
+ };
+ if (it.IsFirstCharge && (!orderDictionary.ContainsKey(it.ProductId)))
+ {
+ diamondMallDto.Price = (it.FirstChargePrice ?? it.Price).ToString("0.##");
+ diamondMallDto.ProductImage = it.FirstChargeImageId ?? it.ImageId;
+ diamondMallDto.ProductSelectImage = it.SelectFirstChargeImageId ?? it.SelectImageId ?? 0;
+ }
+ diamondMallDtos.Add(diamondMallDto);
+ });
+ return diamondMallDtos;
+ }
+
+
+}
diff --git a/src/CloudGaming/Code/CloudGaming.Code/Other/SevenSignBLL.cs b/src/CloudGaming/Code/CloudGaming.Code/Other/SevenSignBLL.cs
new file mode 100644
index 0000000..54037d8
--- /dev/null
+++ b/src/CloudGaming/Code/CloudGaming.Code/Other/SevenSignBLL.cs
@@ -0,0 +1,137 @@
+using CloudGaming.Code.Account;
+using CloudGaming.DtoModel.Account.User;
+using CloudGaming.DtoModel.Account.User.Cache;
+using CloudGaming.DtoModel.SevenSign;
+using CloudGaming.Model.DbSqlServer.Db_Phone;
+
+using Org.BouncyCastle.Bcpg.OpenPgp;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.Code.Other;
+
+///
+/// 七天签到
+///
+public class SevenSignBLL : CloudGamingBase
+{
+ public SevenSignBLL(IServiceProvider serviceProvider) : base(serviceProvider)
+ {
+ }
+
+ ///
+ /// 七天签到
+ ///
+ ///
+ public async Task GetSevenSignList()
+ {
+ int consecutiveSignDays = 0;
+ bool isSignSevenDay = false;
+ if (_UserId > 0)
+ {
+ //获取用户签到状态
+ var userSevenInfo = await UserInfo.GetUserSevenDay(Dao, RedisCache);
+ consecutiveSignDays = userSevenInfo.ConsecutiveSignDays;
+ isSignSevenDay = userSevenInfo.IsSignSevenDay;
+
+ }
+ SevenDayDto sevenDays = new SevenDayDto();
+ var list = Cache.SevenDayList;
+ for (int i = 0; i < list.Count; i++)
+ {
+ var item = list[i];
+ SevenDay sevenDay = new SevenDay()
+ {
+ Image = item.ImageId,
+ SignId = item.Id,
+ SignName = item.Name ?? "",
+ Status = i < consecutiveSignDays ? 1 : (i == consecutiveSignDays ? 0 : 2)
+ };
+ if (i == consecutiveSignDays)
+ {
+ if (isSignSevenDay)
+ {
+
+ sevenDay.Status = 2;
+ }
+ }
+ sevenDays.List.Add(sevenDay);
+ }
+
+ return sevenDays;
+ }
+
+ ///
+ /// 七天签到
+ ///
+ ///
+ public async Task> SevenSignToday()
+ {
+ if (_UserId == 0)
+ {
+ throw MessageBox.Show(ResonseCode.UserNotLogin, "用户未登录");
+ }
+ //获取用户签到状态
+ var userSevenInfo = await UserInfo.GetUserSevenDay(Dao, RedisCache);
+
+ if (userSevenInfo.IsSignSevenDay)
+ {
+ throw MessageBox.Show(ResonseCode.Error, "用户已经签到过了");
+ }
+
+ // 获取用户最后一条签到记录
+ var log = await Dao.DaoPhone.Context.T_User_SignDays
+ .Where(it => it.UserId == _UserId)
+ .OrderByDescending(it => it.Id)
+ .FirstOrDefaultAsync();
+
+ if (userSevenInfo.ConsecutiveSignDays == 7)
+ {
+ userSevenInfo.ConsecutiveSignDays = 0;
+ }
+
+ if (Cache.SevenDayList.Count < userSevenInfo.ConsecutiveSignDays)
+ {
+ throw MessageBox.Show(ResonseCode.Error, "签到配置错误");
+ }
+ var sevenRaw = Cache.SevenDayList[userSevenInfo.ConsecutiveSignDays]?.Rewards;
+ string msg = "签到成功!";
+ if (sevenRaw != null && sevenRaw.Count > 0)
+ {
+ foreach (var raw in sevenRaw)
+ {
+ var isSuccess = await this.UserConsumeDiamondMoneyAsync(raw.AwardNum, $"七天签到-第{userSevenInfo.ConsecutiveSignDays + 1}天礼包");
+ if (!isSuccess)
+ {
+ msg += $"获得{(UserCurrencyType)raw.CurrencyType}*{raw.AwardNum}";
+ throw MessageBox.Show(ResonseCode.Error, "奖励发放失败");
+ }
+ }
+
+ }
+ T_User_SignDays t_User_SignDays = new T_User_SignDays()
+ {
+ CreatTime = DateTime.Now,
+ SignDayNum = userSevenInfo.ConsecutiveSignDays + 1,
+ SignDayTime = DateTime.Now,
+ UpdateTime = DateTime.Now,
+ UserId = _UserId,
+ Desc = $"七天签到-第{userSevenInfo.ConsecutiveSignDays + 1}天",
+ };
+
+
+ // 保存到数据库
+ await Dao.DaoPhone.Context.T_User_SignDays.AddAsync(t_User_SignDays);
+ await Dao.DaoPhone.Context.SaveChangesAsync();
+ userSevenInfo.IsSignSevenDay = true;
+ userSevenInfo.ConsecutiveSignDays++;
+ userSevenInfo.LastSevenDayTime = DateTime.Now;
+ await this.SaveUserInfoCacheChangesAsync();
+ return new BaseResponse(ResonseCode.Success, msg) { };
+ }
+
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/Cache/UserSevenDayCache.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/Cache/UserSevenDayCache.cs
new file mode 100644
index 0000000..b6399e0
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/Cache/UserSevenDayCache.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.Account.User.Cache
+{
+ ///
+ /// 用户七天签到次数
+ ///
+ public class UserSevenDayCache
+ {
+ public UserSevenDayCache() { }
+ ///
+ /// 今天是否签到
+ ///
+ public bool IsSignSevenDay { get; set; }
+ ///
+ /// 最后一次签到时间
+ ///
+ public DateTime? LastSevenDayTime { get; set; }
+
+ ///
+ /// 累计签到天数
+ ///
+ public int ConsecutiveSignDays { get; set; }
+ }
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs
index 106dccb..876039b 100644
--- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfo.cs
@@ -4,65 +4,87 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace CloudGaming.DtoModel.Account.User
+namespace CloudGaming.DtoModel.Account.User;
+
+///
+/// 用户信息
+///
+public class UserInfo
{
///
- /// 用户信息
+ /// 用户昵称
///
- public class UserInfo
- {
- ///
- /// 用户昵称
- ///
- public string NickName { get; set; }
+ public string NickName { get; set; }
- ///
- /// 用户id
- ///
- public int UserId { get; set; }
- ///
- /// 用户手机号
- ///
- public string PhoneNum { get; set; }
+ ///
+ /// 用户id
+ ///
+ public int UserId { get; set; }
+ ///
+ /// 用户手机号
+ ///
+ public string PhoneNum { get; set; }
- ///
- /// 用户邮箱
- ///
- public string Email { get; set; }
+ ///
+ /// 用户邮箱
+ ///
+ public string Email { get; set; }
- ///
- /// 用户头像
- ///
- public string UserIcon { get; set; }
+ ///
+ /// 用户头像
+ ///
+ public string UserIcon { get; set; }
- ///
- /// 用户钻石
- ///
- public int Diamond { get; set; }
+ ///
+ /// 用户钻石
+ ///
+ public int Diamond { get; set; }
- ///
- /// 总游玩时间(分钟)
- ///
- public int TotalGamingTime { get; set; }
+ ///
+ /// 总游玩时间(分钟)
+ ///
+ public int TotalGamingTime { get; set; }
- ///
- /// 用户是否实名认证
- ///
- public bool IsRealName { get; set; }
+ ///
+ /// 用户是否实名认证
+ ///
+ public bool IsRealName { get; set; }
- ///
- /// 是否未成年
- ///
- public bool IsJuveniles { get; set; }
+ ///
+ /// 是否未成年
+ ///
+ public bool IsJuveniles { get; set; }
- ///
- /// 实名认证名称
- ///
- public string UserName { get; set; }
+ ///
+ /// 实名认证名称
+ ///
+ public string UserName { get; set; }
- ///
- /// 身份证号
- ///
- public string IdCard { get; set; }
- }
+ ///
+ /// 身份证号
+ ///
+ public string IdCard { get; set; }
+ ///
+ /// 包夜卡数据
+ ///
+
+ public UserInfoNightCard NightCard { get; set; } = new UserInfoNightCard();
}
+
+
+///
+/// 包夜卡
+///
+public class UserInfoNightCard
+{
+ public UserInfoNightCard() { }
+ ///
+ /// 是否是包夜卡用户
+ ///
+ public bool IsNightCard { get; set; }
+
+ ///
+ /// 包夜卡过期时间
+ ///
+ public string NightCardExpireDateTime { get; set; }
+}
\ No newline at end of file
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs
index e65bb3d..7ff01a6 100644
--- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoCache.cs
@@ -1,3 +1,5 @@
+using CloudGaming.DtoModel.Account.User.Cache;
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -25,5 +27,14 @@ namespace CloudGaming.DtoModel.Account.User
/// 设备号
///
public string DeviceNumber { get; set; }
+
+ ///
+ /// 购买产品数量
+ ///
+ public Dictionary BuyProductCount { get; set; }
+
+ public UserSevenDayCache? UserSevenDay { 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 e48c6e2..a0b436c 100644
--- a/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Account/User/UserInfoDto.cs
@@ -14,5 +14,6 @@ namespace CloudGaming.DtoModel.Account.User
[AutoMap(typeof(UserInfoCache))]
public class UserInfoDto : UserInfo
{
+
}
}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/AppConfigDto.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/AppConfigDto.cs
index 51399b9..8210ca5 100644
--- a/src/CloudGaming/Model/CloudGaming.DtoModel/AppConfigDto.cs
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/AppConfigDto.cs
@@ -36,5 +36,10 @@ public class AppConfigDto
///
public string SignKey { get; set; }
+ ///
+ /// 包夜卡页面提示
+ ///
+ public string NightCardTips { get; set; }
+
}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/DiamondMallDto.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/DiamondMallDto.cs
new file mode 100644
index 0000000..e6bb22f
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/DiamondMallDto.cs
@@ -0,0 +1,55 @@
+using HuanMeng.DotNetCore.AttributeExtend;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.Mall;
+
+///
+/// 钻石商城
+///
+public class DiamondMallDto
+{
+ public DiamondMallDto() { }
+ ///
+ /// 产品Id
+ ///
+ public string ProductId { get; set; }
+
+ ///
+ /// 道具名称
+ ///
+ public string ProductName { get; set; }
+
+ ///
+ /// 道具类型
+ ///
+ public int ProductType { get; set; }
+
+ ///
+ /// 金额
+ ///
+ public string Price { get; set; }
+
+ ///
+ /// 图片地址
+ ///
+ [Images]
+ public int ProductImage { get; set; }
+
+ ///
+ /// 选中的图片地址
+ ///
+ [Images]
+ public int ProductSelectImage { get; set; }
+
+ ///
+ /// 产品描述
+ ///
+ public string ProductDesc { get; set; }
+
+
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductCache.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductCache.cs
new file mode 100644
index 0000000..78d26dd
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductCache.cs
@@ -0,0 +1,22 @@
+using AutoMapper;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.Mall
+{
+ ///
+ /// 产品列表
+ ///
+ [AutoMap(typeof(T_Products))]
+ public class ProductCache : T_Products
+ {
+ ///
+ /// 奖励列表
+ ///
+ public List Rewards { get; set; }
+ }
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductType.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductType.cs
new file mode 100644
index 0000000..1723d9a
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/Mall/ProductType.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.Mall;
+
+///
+/// 商品类型
+///
+public enum ProductType
+{
+ ///
+ ///
+ ///
+ 钻石商城 = 0,
+ ///
+ ///
+ ///
+ 包夜卡 = 1,
+
+}
\ No newline at end of file
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDay.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDay.cs
new file mode 100644
index 0000000..27158f8
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDay.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using static System.Net.Mime.MediaTypeNames;
+
+namespace CloudGaming.DtoModel.SevenSign;
+
+///
+/// 每天签到信息
+///
+public class SevenDay
+{
+ ///
+ /// 签到Id
+ ///
+ public int SignId { get; set; }
+
+ ///
+ /// 签到名称
+ ///
+ public string SignName { get; set; }
+ ///
+ /// 签到图片
+ ///
+ public int Image { get; set; }
+
+ ///
+ /// 类型 0未签到,1已签到,2不能签到
+ ///
+ public int Status { get; set; }
+
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayCache.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayCache.cs
new file mode 100644
index 0000000..81b4b34
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayCache.cs
@@ -0,0 +1,22 @@
+using AutoMapper;
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.SevenSign
+{
+ ///
+ /// 七天签到缓存表
+ ///
+ [AutoMap(typeof(T_SevenDaySignIn))]
+ public class SevenDayCache : T_SevenDaySignIn
+ {
+ ///
+ /// 奖励列表
+ ///
+ public List Rewards { get; set; }
+ }
+}
diff --git a/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayDto.cs b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayDto.cs
new file mode 100644
index 0000000..0c3d97f
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.DtoModel/SevenSign/SevenDayDto.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace CloudGaming.DtoModel.SevenSign;
+
+///
+/// 七天签到
+///
+public class SevenDayDto
+{
+ ///
+ /// 每日签到信息列表
+ ///
+ public List List = new List();
+ ///
+ /// 今天是否签到
+ ///
+ public bool IsSign { get; set; }
+
+}
diff --git a/src/CloudGaming/Model/CloudGaming.GameModel/Db/Db_Game/CloudGamingGameContext.cs b/src/CloudGaming/Model/CloudGaming.GameModel/Db/Db_Game/CloudGamingGameContext.cs
index d7da168..25cbf26 100644
--- a/src/CloudGaming/Model/CloudGaming.GameModel/Db/Db_Game/CloudGamingGameContext.cs
+++ b/src/CloudGaming/Model/CloudGaming.GameModel/Db/Db_Game/CloudGamingGameContext.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
@@ -71,7 +71,6 @@ public partial class CloudGamingGameContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{// => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingGame;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
- //optionsBuilder.uses
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs
index a9049b6..11bdf45 100644
--- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/CloudGamingPhoneContext.cs
@@ -1,6 +1,5 @@
-using System;
+using System;
using System.Collections.Generic;
-
using Microsoft.EntityFrameworkCore;
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
@@ -115,14 +114,24 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
public virtual DbSet T_PopupBtn { get; set; }
///
- /// 七日签到奖励配置表
+ /// 商城表
///
- public virtual DbSet T_SevenDaySignIn_AwardCBT { get; set; }
+ public virtual DbSet T_Products { get; set; }
///
- /// 签到类型
+ /// 产品表奖励
///
- public virtual DbSet T_SignTypes { get; set; }
+ public virtual DbSet T_Products_Reward { get; set; }
+
+ ///
+ /// 七日签到配置表
+ ///
+ public virtual DbSet T_SevenDaySignIn { get; set; }
+
+ ///
+ /// 七日签到奖励配置表
+ ///
+ public virtual DbSet T_SevenDaySignIn_Reward { get; set; }
///
/// 系统公告
@@ -139,16 +148,19 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
///
public virtual DbSet T_UIs { get; set; }
+ ///
+ /// 用户签到表
+ ///
+ public virtual DbSet T_User_SignDays { get; set; }
+
///
/// 视频列表
///
public virtual DbSet T_Videos { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- // => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
- {
- optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
- }
+ { // => optionsBuilder.UseSqlServer("Server=192.168.195.6;Database=CloudGamingPhone;User Id=sa;Password=Dbt@com@123;TrustServerCertificate=true;");
+ }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -757,18 +769,46 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
}
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
- entity.HasKey(e => e.Id).HasName("PK_T_SEVENDAYSIGNIN_AWARDCBT");
+ entity.HasKey(e => e.Id).HasName("PK__T_Products__3214EC07DC10A165");
- entity.ToTable(tb => tb.HasComment("七日签到奖励配置表"));
+ entity.ToTable(tb => tb.HasComment("商城表"));
- entity.Property(e => e.AwardType).HasComment("1钻石 2蘑菇币 3贡献值 4一日会员");
- entity.Property(e => e.CreateTime).HasColumnType("datetime");
- entity.Property(e => e.Remark)
- .HasMaxLength(200)
+ entity.Property(e => e.Id).HasComment("道具Id");
+ entity.Property(e => e.CreateTime)
+ .HasComment("创建时间")
+ .HasColumnType("datetime");
+ entity.Property(e => e.FirstChargeImageId).HasComment("首充图片");
+ entity.Property(e => e.FirstChargePrice)
+ .HasComment("首充价格")
+ .HasColumnType("decimal(10, 2)");
+ entity.Property(e => e.ImageId).HasComment("道具图片配置 图片id");
+ entity.Property(e => e.IsEnable).HasComment("是否启用");
+ entity.Property(e => e.IsFirstCharge).HasComment("是否有首充");
+ entity.Property(e => e.OrderById).HasComment("排序");
+ entity.Property(e => e.Price)
+ .HasComment("价格")
+ .HasColumnType("decimal(10, 2)");
+ entity.Property(e => e.ProductDesc)
+ .HasMaxLength(255)
+ .HasComment("道具描述")
.UseCollation("Chinese_PRC_CI_AS");
- entity.Property(e => e.UpdateTime).HasColumnType("datetime");
+ entity.Property(e => e.ProductId)
+ .HasMaxLength(50)
+ .HasComment("道具Id")
+ .UseCollation("Chinese_PRC_CI_AS");
+ entity.Property(e => e.ProductName)
+ .HasMaxLength(100)
+ .HasComment("道具名称")
+ .UseCollation("Chinese_PRC_CI_AS");
+ entity.Property(e => e.ProductType).HasComment("道具类型,0我的商城");
+ entity.Property(e => e.SelectFirstChargeImageId).HasComment("选中首充图片");
+ entity.Property(e => e.SelectImageId).HasComment("选中图片");
+ entity.Property(e => e.TenantId).HasComment("租户ID");
+ entity.Property(e => e.UpdateTime)
+ .HasComment("更新时间")
+ .HasColumnType("datetime");
//添加全局筛选器
if (this.TenantInfo != null)
{
@@ -776,21 +816,68 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
}
});
- modelBuilder.Entity(entity =>
+ modelBuilder.Entity(entity =>
{
- entity.HasKey(e => e.Id).HasName("PK_T_SIGNTYPES");
+ entity.HasKey(e => e.Id).HasName("PK__T_Produc__3214EC07CE29C08E");
- entity.ToTable(tb => tb.HasComment("签到类型"));
+ entity.ToTable(tb => tb.HasComment("产品表奖励"));
- entity.Property(e => e.CreateTime).HasColumnType("datetime");
- entity.Property(e => e.Desc)
+ entity.Property(e => e.CurrencyType).HasComment("奖励类型");
+ entity.Property(e => e.FirstChargeMoney).HasComment("首充送多少奖励");
+ entity.Property(e => e.Money).HasComment("奖励");
+ entity.Property(e => e.ProductId)
.HasMaxLength(50)
+ .HasComment("所属商品")
.UseCollation("Chinese_PRC_CI_AS");
+ entity.Property(e => e.T_ProductId).HasComment("所属商品");
+ //添加全局筛选器
+ if (this.TenantInfo != null)
+ {
+ entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
+ }
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_T_SEVENDAYSIGNIN_CBT");
+
+ entity.ToTable(tb => tb.HasComment("七日签到配置表"));
+
+ entity.Property(e => e.CreateTime)
+ .HasComment("创建时间")
+ .HasColumnType("datetime");
+ entity.Property(e => e.ImageId).HasComment("签到图片");
entity.Property(e => e.Name)
- .HasMaxLength(50)
+ .HasMaxLength(100)
+ .HasComment("名称")
.UseCollation("Chinese_PRC_CI_AS");
- entity.Property(e => e.Type).HasComment("签到类型");
- entity.Property(e => e.UpdateTime).HasColumnType("datetime");
+ entity.Property(e => e.OrderId)
+ .HasDefaultValue(1)
+ .HasComment("排序");
+ entity.Property(e => e.Remark)
+ .HasMaxLength(200)
+ .HasComment("备注")
+ .UseCollation("Chinese_PRC_CI_AS");
+ entity.Property(e => e.TenantId).HasComment("租户");
+ entity.Property(e => e.UpdateTime)
+ .HasComment("修改时间")
+ .HasColumnType("datetime");
+ //添加全局筛选器
+ if (this.TenantInfo != null)
+ {
+ entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
+ }
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_T_SEVENDAYSIGNIN_AWARDCBT");
+
+ entity.ToTable(tb => tb.HasComment("七日签到奖励配置表"));
+
+ entity.Property(e => e.AwardNum).HasComment("奖励数量");
+ entity.Property(e => e.CurrencyType).HasComment("奖励类型");
+ entity.Property(e => e.SigninId).HasComment("七天签到id");
//添加全局筛选器
if (this.TenantInfo != null)
{
@@ -877,6 +964,37 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
}
});
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.Id).HasName("PK_T_USER_SIGNDAYS");
+
+ entity.ToTable(tb => tb.HasComment("用户签到表"));
+
+ entity.HasIndex(e => e.UserId, "UserId");
+
+ entity.Property(e => e.CreatTime)
+ .HasComment("创建时间")
+ .HasColumnType("datetime");
+ entity.Property(e => e.Desc)
+ .HasMaxLength(50)
+ .HasComment("备注")
+ .UseCollation("Chinese_PRC_CI_AS");
+ entity.Property(e => e.SignDayNum).HasComment("累计签到天数,连续7天,从新开始");
+ entity.Property(e => e.SignDayTime)
+ .HasComment("签到时间")
+ .HasColumnType("datetime");
+ entity.Property(e => e.TenantId).HasComment("租户");
+ entity.Property(e => e.UpdateTime)
+ .HasComment("修改时间")
+ .HasColumnType("datetime");
+ entity.Property(e => e.UserId).HasComment("用户Id\r\n ");
+ //添加全局筛选器
+ if (this.TenantInfo != null)
+ {
+ entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
+ }
+ });
+
modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.Id).HasName("PK_T_VIDEOS");
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products.cs
new file mode 100644
index 0000000..864c5ac
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products.cs
@@ -0,0 +1,96 @@
+using System;
+
+namespace CloudGaming.Model.DbSqlServer.Db_Phone;
+
+///
+/// 商城表
+///
+public partial class T_Products: MultiTenantEntity
+{
+ public T_Products() { }
+
+ ///
+ /// 道具Id
+ ///
+ public virtual int Id { get; set; }
+
+ ///
+ /// 所属租户
+ ///
+ public override Guid TenantId { get; set; }
+
+ ///
+ /// 道具Id
+ ///
+ public virtual string ProductId { get; set; } = null!;
+
+ ///
+ /// 道具名称
+ ///
+ public virtual string ProductName { get; set; } = null!;
+
+ ///
+ /// 道具类型,0我的商城
+ ///
+ public virtual int ProductType { get; set; }
+
+ ///
+ /// 道具描述
+ ///
+ public virtual string? ProductDesc { get; set; }
+
+ ///
+ /// 价格
+ ///
+ public virtual decimal Price { get; set; }
+
+ ///
+ /// 道具图片配置 图片id
+ ///
+ public virtual int ImageId { get; set; }
+
+ ///
+ /// 是否启用
+ ///
+ public virtual bool IsEnable { get; set; }
+
+ ///
+ /// 是否有首充
+ ///
+ public virtual bool IsFirstCharge { get; set; }
+
+ ///
+ /// 首充图片
+ ///
+ public virtual int? FirstChargeImageId { get; set; }
+
+ ///
+ /// 首充价格
+ ///
+ public virtual decimal? FirstChargePrice { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public virtual DateTime CreateTime { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ public virtual DateTime? UpdateTime { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public virtual int? OrderById { get; set; }
+
+ ///
+ /// 选中图片
+ ///
+ public virtual int? SelectImageId { get; set; }
+
+ ///
+ /// 选中首充图片
+ ///
+ public virtual int? SelectFirstChargeImageId { get; set; }
+}
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products_Reward.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products_Reward.cs
new file mode 100644
index 0000000..668351e
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_Products_Reward.cs
@@ -0,0 +1,43 @@
+using System;
+
+namespace CloudGaming.Model.DbSqlServer.Db_Phone;
+
+///
+/// 产品表奖励
+///
+public partial class T_Products_Reward: MultiTenantEntity
+{
+ public T_Products_Reward() { }
+
+ public virtual int Id { get; set; }
+
+ ///
+ /// 奖励类型
+ ///
+ public virtual int CurrencyType { get; set; }
+
+ ///
+ /// 奖励
+ ///
+ public virtual int Money { get; set; }
+
+ ///
+ /// 所属商品
+ ///
+ public virtual int? T_ProductId { get; set; }
+
+ ///
+ /// 首充送多少奖励
+ ///
+ public virtual int? FirstChargeMoney { get; set; }
+
+ ///
+ /// 所属商品
+ ///
+ public virtual string? ProductId { get; set; }
+
+ ///
+ /// 所属租户
+ ///
+ public override Guid TenantId { get; set; }
+ }
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn.cs
new file mode 100644
index 0000000..758227c
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn.cs
@@ -0,0 +1,48 @@
+using System;
+
+namespace CloudGaming.Model.DbSqlServer.Db_Phone;
+
+///
+/// 七日签到配置表
+///
+public partial class T_SevenDaySignIn: MultiTenantEntity
+{
+ public T_SevenDaySignIn() { }
+
+ public virtual int Id { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public virtual string? Name { get; set; }
+
+ ///
+ /// 签到图片
+ ///
+ public virtual int ImageId { get; set; }
+
+ ///
+ /// 排序
+ ///
+ public virtual int OrderId { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public virtual DateTime CreateTime { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public virtual DateTime UpdateTime { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public virtual string? Remark { get; set; }
+
+ ///
+ /// 所属租户
+ ///
+ public override Guid TenantId { get; set; }
+ }
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs
deleted file mode 100644
index fc1a2c7..0000000
--- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_AwardCBT.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-
-namespace CloudGaming.Model.DbSqlServer.Db_Phone;
-
-///
-/// 七日签到奖励配置表
-///
-public partial class T_SevenDaySignIn_AwardCBT: MultiTenantEntity
-{
- public T_SevenDaySignIn_AwardCBT() { }
-
- public virtual int Id { get; set; }
-
- public virtual int SignInId { get; set; }
-
- ///
- /// 1钻石 2蘑菇币 3贡献值 4一日会员
- ///
- public virtual int AwardType { get; set; }
-
- public virtual int AwardNum { get; set; }
-
- public virtual DateTime CreateTime { get; set; }
-
- public virtual DateTime UpdateTime { get; set; }
-
- public virtual string? Remark { get; set; }
-
- ///
- /// 所属租户
- ///
- public override Guid TenantId { get; set; }
- }
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_Reward.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_Reward.cs
new file mode 100644
index 0000000..9b70f24
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SevenDaySignIn_Reward.cs
@@ -0,0 +1,32 @@
+
+namespace CloudGaming.Model.DbSqlServer.Db_Phone;
+
+///
+/// 七日签到奖励配置表
+///
+public partial class T_SevenDaySignIn_Reward: MultiTenantEntity
+{
+ public T_SevenDaySignIn_Reward() { }
+
+ public virtual int Id { get; set; }
+
+ ///
+ /// 七天签到id
+ ///
+ public virtual int SigninId { get; set; }
+
+ ///
+ /// 奖励类型
+ ///
+ public virtual int CurrencyType { get; set; }
+
+ ///
+ /// 奖励数量
+ ///
+ public virtual int AwardNum { get; set; }
+
+ ///
+ /// 所属租户
+ ///
+ public override Guid TenantId { get; set; }
+ }
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs
deleted file mode 100644
index 344a031..0000000
--- a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_SignTypes.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-
-namespace CloudGaming.Model.DbSqlServer.Db_Phone;
-
-///
-/// 签到类型
-///
-public partial class T_SignTypes: MultiTenantEntity
-{
- public T_SignTypes() { }
-
- public virtual int Id { get; set; }
-
- public virtual string? Name { get; set; }
-
- ///
- /// 签到类型
- ///
- public virtual int? Type { get; set; }
-
- public virtual int? OrderId { get; set; }
-
- public virtual bool? IsOnline { get; set; }
-
- public virtual DateTime? UpdateTime { get; set; }
-
- public virtual DateTime? CreateTime { get; set; }
-
- public virtual string? Desc { get; set; }
-
- ///
- /// 所属租户
- ///
- public override Guid TenantId { get; set; }
- }
diff --git a/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_User_SignDays.cs b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_User_SignDays.cs
new file mode 100644
index 0000000..f862c3c
--- /dev/null
+++ b/src/CloudGaming/Model/CloudGaming.Model/DbSqlServer/Db_Phone/T_User_SignDays.cs
@@ -0,0 +1,49 @@
+using System;
+
+namespace CloudGaming.Model.DbSqlServer.Db_Phone;
+
+///
+/// 用户签到表
+///
+public partial class T_User_SignDays: MultiTenantEntity
+{
+ public T_User_SignDays() { }
+
+ public virtual int Id { get; set; }
+
+ ///
+ /// 用户Id
+ ///
+ ///
+ public virtual int UserId { get; set; }
+
+ ///
+ /// 签到时间
+ ///
+ public virtual DateTime SignDayTime { get; set; }
+
+ ///
+ /// 修改时间
+ ///
+ public virtual DateTime UpdateTime { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public virtual DateTime CreatTime { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public virtual string? Desc { get; set; }
+
+ ///
+ /// 累计签到天数,连续7天,从新开始
+ ///
+ public virtual int SignDayNum { get; set; }
+
+ ///
+ /// 所属租户
+ ///
+ public override Guid TenantId { get; set; }
+ }
diff --git a/src/CloudGaming/Utile/HuanMeng.DotNetCore/CacheHelper/CommonDataEntityCache.cs b/src/CloudGaming/Utile/HuanMeng.DotNetCore/CacheHelper/CommonDataEntityCache.cs
index 84e9f9c..5764552 100644
--- a/src/CloudGaming/Utile/HuanMeng.DotNetCore/CacheHelper/CommonDataEntityCache.cs
+++ b/src/CloudGaming/Utile/HuanMeng.DotNetCore/CacheHelper/CommonDataEntityCache.cs
@@ -1,98 +1,200 @@
using HuanMeng.DotNetCore.CacheHelper.Contract;
+using HuanMeng.DotNetCore.Redis;
+
+using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Newtonsoft.Json;
+using StackExchange.Redis;
+
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace HuanMeng.DotNetCore.CacheHelper
+namespace HuanMeng.DotNetCore.CacheHelper;
+
+///
+/// 缓存扩展-
+///
+public abstract class CommonDataEntityCache : ICacheClearData, ICacheReloadData where T : class
{
///
- /// 缓存扩展-
+ ///
///
- public abstract class CommonDataEntityCache : ICacheClearData, ICacheReloadData where T : class
+ protected object lockObj;
+ ///
+ /// 过期时间
+ ///
+ protected int cacheTime;
+
+ protected CommonDataEntityCache(object lockObj, int cacheTime = 36000)
{
- ///
- ///
- ///
- protected object lockObj;
- ///
- /// 过期时间
- ///
- protected int cacheTime;
+ this.lockObj = lockObj;
+ this.cacheTime = cacheTime;
+ }
- protected CommonDataEntityCache(object lockObj, int cacheTime = 36000)
+
+ ///
+ ///
+ ///
+ public abstract string key { get; }
+
+ ///
+ /// 缓存数据
+ ///
+ protected List? _dataList;
+
+ ///
+ /// 数据
+ ///
+ public virtual List DataList
+ {
+ get
{
- this.lockObj = lockObj;
- this.cacheTime = cacheTime;
- }
-
-
- ///
- ///
- ///
- public abstract string key { get; }
-
- ///
- /// 缓存数据
- ///
- protected List? _dataList;
-
- ///
- /// 数据
- ///
- public virtual List DataList
- {
- get
+ if (_dataList == null)
{
- if (_dataList == null)
+ var tempDataList = MemoryCacheHelper.GetCache>(key);
+ if (tempDataList == null)
{
- var tempDataList = MemoryCacheHelper.GetCache>(key);
- if (tempDataList == null)
+ lock (lockObj)
{
- lock (lockObj)
+ tempDataList = MemoryCacheHelper.GetCache>(key);
+ if (tempDataList == null)
{
- tempDataList = MemoryCacheHelper.GetCache>(key);
- if (tempDataList == null)
- {
- tempDataList = GetDataList();
- MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
- }
+ tempDataList = GetDataList();
+ MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
}
}
- _dataList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(tempDataList));
}
- return _dataList ?? new List();
+ _dataList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(tempDataList));
}
+ return _dataList ?? new List();
}
+ }
- ///
- /// 获取缓存数据
- ///
- public abstract List GetDataList();
+ ///
+ /// 获取缓存数据
+ ///
+ public abstract List GetDataList();
- public virtual bool ClearData()
+ public virtual bool ClearData()
+ {
+ lock (lockObj)
{
- lock (lockObj)
- {
- MemoryCacheHelper.DelCache(key);
- _dataList = null;
- }
- return true;
+ MemoryCacheHelper.DelCache(key);
+ _dataList = null;
}
+ return true;
+ }
- public virtual void ReloadData()
+ public virtual void ReloadData()
+ {
+ lock (lockObj)
{
- lock (lockObj)
- {
- var tempDataList = GetDataList();
- MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
- _dataList = tempDataList;
- }
+ var tempDataList = GetDataList();
+ MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
+ _dataList = tempDataList;
+ }
+ }
+}
+
+
+///
+/// 缓存扩展-
+///
+public abstract class RedisDataEntityCache : CommonDataEntityCache where T : class
+{
+ public IDatabase database;
+ ///
+ ///
+ ///
+ protected object lockObj;
+ ///
+ /// 过期时间
+ ///
+ protected int cacheTime;
+
+ protected RedisDataEntityCache(IDatabase database, object lockObj, int cacheTime = 36000) : base(lockObj, cacheTime)
+ {
+ this.lockObj = lockObj;
+ this.cacheTime = cacheTime;
+ this.database = database;
+ }
+
+ public int index = 0;
+ ///
+ /// 缓存数据
+ ///
+ protected List? _dataList;
+
+ ///
+ /// 数据
+ ///
+ public virtual List DataList
+ {
+ get
+ {
+
+ if (_dataList == null)
+ {
+ start:
+ var tempDataList = database.StringGet>(key);
+ if (tempDataList == null)
+ {
+ if (database.StringSetLock($"lock:{key}", "", 5))
+ {
+
+ if (tempDataList == null)
+ {
+
+ tempDataList = GetDataList();
+ database.StringSet(key, tempDataList, TimeSpan.FromSeconds(cacheTime));
+ }
+ _dataList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(tempDataList));
+ }
+ else
+ {
+ index++;
+ Thread.Sleep(500);
+ tempDataList = database.StringGet>(key);
+ if (tempDataList == null)
+ {
+ if (index < 10)
+ {
+ goto start;
+ }
+ }
+ }
+ }
+
+ }
+ return _dataList ?? new List();
+ }
+ }
+
+
+
+
+ public virtual bool ClearData()
+ {
+ lock (lockObj)
+ {
+ database.KeyDelete(key);
+ _dataList = null;
+ }
+ return true;
+ }
+
+ public virtual void ReloadData()
+ {
+ lock (lockObj)
+ {
+ var tempDataList = GetDataList();
+ database.StringSet(key, tempDataList, TimeSpan.FromMinutes(cacheTime));
+ _dataList = tempDataList;
}
}
}
diff --git a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs
index 3521ddb..6c6db1f 100644
--- a/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs
+++ b/src/CloudGaming/Utile/HuanMeng.DotNetCore/Redis/RedisConnection.cs
@@ -170,6 +170,20 @@ namespace HuanMeng.DotNetCore.Redis
{
return await database.StringSetAsync(key, (value == null ? "" : JsonConvert.SerializeObject(value)), expiry, When.Always);
}
+
+ ///
+ /// 数据存放在redis
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool StringSet(this IDatabase database, string key, object value, TimeSpan? expiry)
+ {
+ return database.StringSet(key, (value == null ? "" : JsonConvert.SerializeObject(value)), expiry, When.Always);
+ }
+
///
/// 获取一个key的对象
///
@@ -198,6 +212,8 @@ namespace HuanMeng.DotNetCore.Redis
// 将 RedisValue 转换为 T 类型
return JsonConvert.DeserializeObject(value);
}
+
+
///
/// 模糊查询key
///