添加七天签到
This commit is contained in:
parent
40d29b248f
commit
72b2a6bc24
|
|
@ -1,10 +1,8 @@
|
||||||
using CloudGaming.Api.Base;
|
using CloudGaming.Api.Base;
|
||||||
using CloudGaming.Code.Config;
|
using CloudGaming.Code.Config;
|
||||||
using CloudGaming.DtoModel;
|
using CloudGaming.DtoModel;
|
||||||
using CloudGaming.GameModel.Db.Db_Ext;
|
|
||||||
|
|
||||||
using HuanMeng.DotNetCore.AttributeExtend;
|
using HuanMeng.DotNetCore.AttributeExtend;
|
||||||
using HuanMeng.DotNetCore.Base;
|
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
|
@ -25,7 +23,6 @@ namespace CloudGaming.Api.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Message("发送成功")]
|
|
||||||
public async Task<AppConfigDto> GetAppConfigAsync()
|
public async Task<AppConfigDto> GetAppConfigAsync()
|
||||||
{
|
{
|
||||||
AppConfigBLL appConfigBLL = new AppConfigBLL(ServiceProvider);
|
AppConfigBLL appConfigBLL = new AppConfigBLL(ServiceProvider);
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 商城
|
||||||
|
/// </summary>
|
||||||
|
public class MallController : CloudGamingControllerBase
|
||||||
|
{
|
||||||
|
public MallController(IServiceProvider _serviceProvider) : base(_serviceProvider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取商城数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<List<DiamondMallDto>> GetDiamondMall()
|
||||||
|
{
|
||||||
|
ProductBLL productBLL = new ProductBLL(ServiceProvider);
|
||||||
|
return await productBLL.GetDiamondMall();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取包夜卡数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<List<DiamondMallDto>> GetNightCard()
|
||||||
|
{
|
||||||
|
ProductBLL productBLL = new ProductBLL(ServiceProvider);
|
||||||
|
|
||||||
|
return await productBLL.GetNightCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
public class SevenDayController : CloudGamingControllerBase
|
||||||
|
{
|
||||||
|
public SevenDayController(IServiceProvider _serviceProvider) : base(_serviceProvider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<SevenDayDto> GetSevenSignList()
|
||||||
|
{
|
||||||
|
SevenSignBLL sevenSignBLL = new SevenSignBLL(ServiceProvider);
|
||||||
|
return await sevenSignBLL.GetSevenSignList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到接口
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<BaseResponse<bool>> SevenSignToday()
|
||||||
|
{
|
||||||
|
SevenSignBLL sevenSignBLL = new SevenSignBLL(ServiceProvider);
|
||||||
|
return await sevenSignBLL.SevenSignToday();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ using CloudGaming.Code.Account.UserCurrency;
|
||||||
using CloudGaming.Code.DataAccess;
|
using CloudGaming.Code.DataAccess;
|
||||||
using CloudGaming.DtoModel.Account.Login;
|
using CloudGaming.DtoModel.Account.Login;
|
||||||
using CloudGaming.DtoModel.Account.User;
|
using CloudGaming.DtoModel.Account.User;
|
||||||
|
using CloudGaming.DtoModel.Account.User.Cache;
|
||||||
|
|
||||||
using HuanMeng.DotNetCore.Redis;
|
using HuanMeng.DotNetCore.Redis;
|
||||||
|
|
||||||
|
|
@ -223,6 +224,18 @@ namespace CloudGaming.Code.Account
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存用户缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cloudGamingBase"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<UserInfoCache> SaveUserInfoCacheChangesAsync(UserInfoCache userInfo, IDatabase database)
|
||||||
|
{
|
||||||
|
var key = GetUserInfoRedisKey(userInfo.UserId);
|
||||||
|
await database.StringSetAsync(key, userInfo, TimeSpan.FromHours(1));
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 扣除当前用户钻石
|
/// 扣除当前用户钻石
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -244,7 +257,7 @@ namespace CloudGaming.Code.Account
|
||||||
/// <param name="cloudGamingBase"></param>
|
/// <param name="cloudGamingBase"></param>
|
||||||
/// <param name="userCurrencyType"></param>
|
/// <param name="userCurrencyType"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
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)
|
if (UserCurrencyType.钻石 == userCurrencyType)
|
||||||
{
|
{
|
||||||
|
|
@ -365,7 +378,88 @@ namespace CloudGaming.Code.Account
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户购买过的产品
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfoCache"></param>
|
||||||
|
/// <param name="dao"></param>
|
||||||
|
/// <param name="database"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Dictionary<string, int>> 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<string, int>();
|
||||||
|
}
|
||||||
|
userInfoCache.BuyProductCount = orderDictionary;
|
||||||
|
await SaveUserInfoCacheChangesAsync(userInfoCache, database);
|
||||||
|
//new CloudGamingBase().SaveUserInfoCacheChangesAsync();
|
||||||
|
}
|
||||||
|
return userInfoCache.BuyProductCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取用户七天签到
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userInfoCache"></param>
|
||||||
|
/// <param name="dao"></param>
|
||||||
|
/// <param name="database"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<UserSevenDayCache> 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ using AutoMapper;
|
||||||
|
|
||||||
using CloudGaming.Code.Cache.Special;
|
using CloudGaming.Code.Cache.Special;
|
||||||
using CloudGaming.DtoModel.Game;
|
using CloudGaming.DtoModel.Game;
|
||||||
|
using CloudGaming.DtoModel.Mall;
|
||||||
|
using CloudGaming.DtoModel.SevenSign;
|
||||||
|
|
||||||
using HuanMeng.DotNetCore.CacheHelper;
|
using HuanMeng.DotNetCore.CacheHelper;
|
||||||
|
|
||||||
|
|
@ -107,7 +109,7 @@ namespace CloudGaming.Code.Cache
|
||||||
private ImageEntityCache imageEntityCache;
|
private ImageEntityCache imageEntityCache;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 图片缓存
|
/// 图片缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ImageEntityCache ImageEntityCache
|
public ImageEntityCache ImageEntityCache
|
||||||
{
|
{
|
||||||
|
|
@ -121,6 +123,69 @@ namespace CloudGaming.Code.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
private ProductCacheEntityCache productCacheEntityCache;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品缓存
|
||||||
|
/// </summary>
|
||||||
|
public ProductCacheEntityCache ProductCacheEntityCache
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (productCacheEntityCache == null)
|
||||||
|
{
|
||||||
|
productCacheEntityCache = new ProductCacheEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper);
|
||||||
|
}
|
||||||
|
return productCacheEntityCache;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品列表
|
||||||
|
/// </summary>
|
||||||
|
public List<ProductCache> ProductCacheList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ProductCacheEntityCache.DataList ?? new List<ProductCache>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 七天签到
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
private SevenDayEntityCache sevenDayEntityCache;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到缓存
|
||||||
|
/// </summary>
|
||||||
|
public SevenDayEntityCache SevenDayEntityCache
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (sevenDayEntityCache == null)
|
||||||
|
{
|
||||||
|
sevenDayEntityCache = new SevenDayEntityCache(_gamingBase.Dao, _gamingBase.RedisCache, _gamingBase.Mapper);
|
||||||
|
}
|
||||||
|
return sevenDayEntityCache;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到列表
|
||||||
|
/// </summary>
|
||||||
|
public List<SevenDayCache> SevenDayList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return SevenDayEntityCache.DataList ?? new List<SevenDayCache>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 首页缓存表
|
#region 首页缓存表
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 商城产品缓存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dao"></param>
|
||||||
|
/// <param name="database"></param>
|
||||||
|
/// <param name="mapper"></param>
|
||||||
|
/// <param name="appConfig"></param>
|
||||||
|
public class ProductCacheEntityCache(DAO dao, IDatabase database, IMapper mapper) : RedisDataEntityCache<ProductCache>(database, GameEntityCache.GameEntityCacheLock, 60 * 60 * 12)
|
||||||
|
{
|
||||||
|
public override string key => "App:Product";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override List<ProductCache> GetDataList()
|
||||||
|
{
|
||||||
|
var list = dao.DaoPhone.Context.T_Products.AsNoTracking().Where(it => it.IsEnable).ToList();
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
list = new List<T_Products>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var products = mapper.Map<List<ProductCache>>(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<T_Products_Reward>();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return products;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到配置数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dao"></param>
|
||||||
|
/// <param name="database"></param>
|
||||||
|
/// <param name="mapper"></param>
|
||||||
|
public class SevenDayEntityCache(DAO dao, IDatabase database, IMapper mapper) : RedisDataEntityCache<SevenDayCache>(database, GameEntityCache.GameEntityCacheLock, 60 * 60 * 24 * 7)
|
||||||
|
{
|
||||||
|
public override List<SevenDayCache> GetDataList()
|
||||||
|
{
|
||||||
|
var list = dao.DaoPhone.Context.T_SevenDaySignIn.AsNoTracking().OrderBy(it => it.OrderId).ToList();
|
||||||
|
if (list == null)
|
||||||
|
{
|
||||||
|
list = new List<T_SevenDaySignIn>();
|
||||||
|
}
|
||||||
|
|
||||||
|
var sevenDayCache = mapper.Map<List<SevenDayCache>>(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<T_SevenDaySignIn_Reward>();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sevenDayCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string key => "App:SevenDay";
|
||||||
|
}
|
||||||
|
|
@ -30,6 +30,7 @@ namespace CloudGaming.Code.Config
|
||||||
};
|
};
|
||||||
appConfigDto.IsChecking = IsChecking;
|
appConfigDto.IsChecking = IsChecking;
|
||||||
appConfigDto.SignKey = AppConfig.TenantId.ToString("N");
|
appConfigDto.SignKey = AppConfig.TenantId.ToString("N");
|
||||||
|
appConfigDto.NightCardTips = $"22点30分至次日7点畅玩无消耗";
|
||||||
return appConfigDto;
|
return appConfigDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
84
src/CloudGaming/Code/CloudGaming.Code/Mall/ProductBLL.cs
Normal file
84
src/CloudGaming/Code/CloudGaming.Code/Mall/ProductBLL.cs
Normal file
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品逻辑
|
||||||
|
/// </summary>
|
||||||
|
public class ProductBLL : CloudGamingBase
|
||||||
|
{
|
||||||
|
public ProductBLL(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取商城数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<DiamondMallDto>> GetDiamondMall()
|
||||||
|
{
|
||||||
|
int productType = (int)ProductType.钻石商城;
|
||||||
|
|
||||||
|
var diamondMallDtos = await GetProductList(productType);
|
||||||
|
return diamondMallDtos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取包夜卡数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<DiamondMallDto>> GetNightCard()
|
||||||
|
{
|
||||||
|
var diamondMallDtos = await GetProductList((int)ProductType.包夜卡);
|
||||||
|
return diamondMallDtos;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取商品数据
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="productType"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
|
private async Task<List<DiamondMallDto>> GetProductList(int productType)
|
||||||
|
{
|
||||||
|
List<DiamondMallDto> diamondMallDtos = new List<DiamondMallDto>();
|
||||||
|
//获取首充
|
||||||
|
Dictionary<string, int> orderDictionary = new Dictionary<string, int>();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
137
src/CloudGaming/Code/CloudGaming.Code/Other/SevenSignBLL.cs
Normal file
137
src/CloudGaming/Code/CloudGaming.Code/Other/SevenSignBLL.cs
Normal file
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
public class SevenSignBLL : CloudGamingBase
|
||||||
|
{
|
||||||
|
public SevenSignBLL(IServiceProvider serviceProvider) : base(serviceProvider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<SevenDayDto> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<BaseResponse<bool>> 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<bool>(ResonseCode.Success, msg) { };
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 用户七天签到次数
|
||||||
|
/// </summary>
|
||||||
|
public class UserSevenDayCache
|
||||||
|
{
|
||||||
|
public UserSevenDayCache() { }
|
||||||
|
/// <summary>
|
||||||
|
/// 今天是否签到
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSignSevenDay { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 最后一次签到时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? LastSevenDayTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 累计签到天数
|
||||||
|
/// </summary>
|
||||||
|
public int ConsecutiveSignDays { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,65 +4,87 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CloudGaming.DtoModel.Account.User
|
namespace CloudGaming.DtoModel.Account.User;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户信息
|
||||||
|
/// </summary>
|
||||||
|
public class UserInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户信息
|
/// 用户昵称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserInfo
|
public string NickName { get; set; }
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 用户昵称
|
|
||||||
/// </summary>
|
|
||||||
public string NickName { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户id
|
/// 用户id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户手机号
|
/// 用户手机号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string PhoneNum { get; set; }
|
public string PhoneNum { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户邮箱
|
/// 用户邮箱
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户头像
|
/// 用户头像
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UserIcon { get; set; }
|
public string UserIcon { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户钻石
|
/// 用户钻石
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Diamond { get; set; }
|
public int Diamond { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 总游玩时间(分钟)
|
/// 总游玩时间(分钟)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int TotalGamingTime { get; set; }
|
public int TotalGamingTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户是否实名认证
|
/// 用户是否实名认证
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsRealName { get; set; }
|
public bool IsRealName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否未成年
|
/// 是否未成年
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsJuveniles { get; set; }
|
public bool IsJuveniles { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实名认证名称
|
/// 实名认证名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 身份证号
|
/// 身份证号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string IdCard { get; set; }
|
public string IdCard { get; set; }
|
||||||
}
|
/// <summary>
|
||||||
|
/// 包夜卡数据
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public UserInfoNightCard NightCard { get; set; } = new UserInfoNightCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 包夜卡
|
||||||
|
/// </summary>
|
||||||
|
public class UserInfoNightCard
|
||||||
|
{
|
||||||
|
public UserInfoNightCard() { }
|
||||||
|
/// <summary>
|
||||||
|
/// 是否是包夜卡用户
|
||||||
|
/// </summary>
|
||||||
|
public bool IsNightCard { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 包夜卡过期时间
|
||||||
|
/// </summary>
|
||||||
|
public string NightCardExpireDateTime { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
using CloudGaming.DtoModel.Account.User.Cache;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -25,5 +27,14 @@ namespace CloudGaming.DtoModel.Account.User
|
||||||
/// 设备号
|
/// 设备号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string DeviceNumber { get; set; }
|
public string DeviceNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 购买产品数量
|
||||||
|
/// </summary>
|
||||||
|
public Dictionary<string, int> BuyProductCount { get; set; }
|
||||||
|
|
||||||
|
public UserSevenDayCache? UserSevenDay { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@ namespace CloudGaming.DtoModel.Account.User
|
||||||
[AutoMap(typeof(UserInfoCache))]
|
[AutoMap(typeof(UserInfoCache))]
|
||||||
public class UserInfoDto : UserInfo
|
public class UserInfoDto : UserInfo
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,5 +36,10 @@ public class AppConfigDto
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string SignKey { get; set; }
|
public string SignKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 包夜卡页面提示
|
||||||
|
/// </summary>
|
||||||
|
public string NightCardTips { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 钻石商城
|
||||||
|
/// </summary>
|
||||||
|
public class DiamondMallDto
|
||||||
|
{
|
||||||
|
public DiamondMallDto() { }
|
||||||
|
/// <summary>
|
||||||
|
/// 产品Id
|
||||||
|
/// </summary>
|
||||||
|
public string ProductId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具名称
|
||||||
|
/// </summary>
|
||||||
|
public string ProductName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具类型
|
||||||
|
/// </summary>
|
||||||
|
public int ProductType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 金额
|
||||||
|
/// </summary>
|
||||||
|
public string Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 图片地址
|
||||||
|
/// </summary>
|
||||||
|
[Images]
|
||||||
|
public int ProductImage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选中的图片地址
|
||||||
|
/// </summary>
|
||||||
|
[Images]
|
||||||
|
public int ProductSelectImage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品描述
|
||||||
|
/// </summary>
|
||||||
|
public string ProductDesc { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 产品列表
|
||||||
|
/// </summary>
|
||||||
|
[AutoMap(typeof(T_Products))]
|
||||||
|
public class ProductCache : T_Products
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励列表
|
||||||
|
/// </summary>
|
||||||
|
public List<T_Products_Reward> Rewards { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CloudGaming.DtoModel.Mall;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 商品类型
|
||||||
|
/// </summary>
|
||||||
|
public enum ProductType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
钻石商城 = 0,
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
包夜卡 = 1,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 每天签到信息
|
||||||
|
/// </summary>
|
||||||
|
public class SevenDay
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 签到Id
|
||||||
|
/// </summary>
|
||||||
|
public int SignId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到名称
|
||||||
|
/// </summary>
|
||||||
|
public string SignName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 签到图片
|
||||||
|
/// </summary>
|
||||||
|
public int Image { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 类型 0未签到,1已签到,2不能签到
|
||||||
|
/// </summary>
|
||||||
|
public int Status { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到缓存表
|
||||||
|
/// </summary>
|
||||||
|
[AutoMap(typeof(T_SevenDaySignIn))]
|
||||||
|
public class SevenDayCache : T_SevenDaySignIn
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励列表
|
||||||
|
/// </summary>
|
||||||
|
public List<T_SevenDaySignIn_Reward> Rewards { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CloudGaming.DtoModel.SevenSign;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到
|
||||||
|
/// </summary>
|
||||||
|
public class SevenDayDto
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 每日签到信息列表
|
||||||
|
/// </summary>
|
||||||
|
public List<SevenDay> List = new List<SevenDay>();
|
||||||
|
/// <summary>
|
||||||
|
/// 今天是否签到
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSign { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
@ -71,7 +71,6 @@ public partial class CloudGamingGameContext : DbContext
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
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.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)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
@ -115,14 +114,24 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
|
||||||
public virtual DbSet<T_PopupBtn> T_PopupBtn { get; set; }
|
public virtual DbSet<T_PopupBtn> T_PopupBtn { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 七日签到奖励配置表
|
/// 商城表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual DbSet<T_SevenDaySignIn_AwardCBT> T_SevenDaySignIn_AwardCBT { get; set; }
|
public virtual DbSet<T_Products> T_Products { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 签到类型
|
/// 产品表奖励
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual DbSet<T_SignTypes> T_SignTypes { get; set; }
|
public virtual DbSet<T_Products_Reward> T_Products_Reward { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七日签到配置表
|
||||||
|
/// </summary>
|
||||||
|
public virtual DbSet<T_SevenDaySignIn> T_SevenDaySignIn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七日签到奖励配置表
|
||||||
|
/// </summary>
|
||||||
|
public virtual DbSet<T_SevenDaySignIn_Reward> T_SevenDaySignIn_Reward { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 系统公告
|
/// 系统公告
|
||||||
|
|
@ -139,16 +148,19 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual DbSet<T_UIs> T_UIs { get; set; }
|
public virtual DbSet<T_UIs> T_UIs { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户签到表
|
||||||
|
/// </summary>
|
||||||
|
public virtual DbSet<T_User_SignDays> T_User_SignDays { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 视频列表
|
/// 视频列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual DbSet<T_Videos> T_Videos { get; set; }
|
public virtual DbSet<T_Videos> T_Videos { get; set; }
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
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)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
|
|
@ -757,18 +769,46 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<T_SevenDaySignIn_AwardCBT>(entity =>
|
modelBuilder.Entity<T_Products>(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.Id).HasComment("道具Id");
|
||||||
entity.Property(e => e.CreateTime).HasColumnType("datetime");
|
entity.Property(e => e.CreateTime)
|
||||||
entity.Property(e => e.Remark)
|
.HasComment("创建时间")
|
||||||
.HasMaxLength(200)
|
.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");
|
.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)
|
if (this.TenantInfo != null)
|
||||||
{
|
{
|
||||||
|
|
@ -776,21 +816,68 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity<T_SignTypes>(entity =>
|
modelBuilder.Entity<T_Products_Reward>(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.CurrencyType).HasComment("奖励类型");
|
||||||
entity.Property(e => e.Desc)
|
entity.Property(e => e.FirstChargeMoney).HasComment("首充送多少奖励");
|
||||||
|
entity.Property(e => e.Money).HasComment("奖励");
|
||||||
|
entity.Property(e => e.ProductId)
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(50)
|
||||||
|
.HasComment("所属商品")
|
||||||
.UseCollation("Chinese_PRC_CI_AS");
|
.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<T_SevenDaySignIn>(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)
|
entity.Property(e => e.Name)
|
||||||
.HasMaxLength(50)
|
.HasMaxLength(100)
|
||||||
|
.HasComment("名称")
|
||||||
.UseCollation("Chinese_PRC_CI_AS");
|
.UseCollation("Chinese_PRC_CI_AS");
|
||||||
entity.Property(e => e.Type).HasComment("签到类型");
|
entity.Property(e => e.OrderId)
|
||||||
entity.Property(e => e.UpdateTime).HasColumnType("datetime");
|
.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<T_SevenDaySignIn_Reward>(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)
|
if (this.TenantInfo != null)
|
||||||
{
|
{
|
||||||
|
|
@ -877,6 +964,37 @@ public partial class CloudGamingPhoneContext : MultiTenantDbContext//DbContext
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<T_User_SignDays>(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<T_Videos>(entity =>
|
modelBuilder.Entity<T_Videos>(entity =>
|
||||||
{
|
{
|
||||||
entity.HasKey(e => e.Id).HasName("PK_T_VIDEOS");
|
entity.HasKey(e => e.Id).HasName("PK_T_VIDEOS");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,96 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 商城表
|
||||||
|
/// </summary>
|
||||||
|
public partial class T_Products: MultiTenantEntity
|
||||||
|
{
|
||||||
|
public T_Products() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具Id
|
||||||
|
/// </summary>
|
||||||
|
public virtual int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属租户
|
||||||
|
/// </summary>
|
||||||
|
public override Guid TenantId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具Id
|
||||||
|
/// </summary>
|
||||||
|
public virtual string ProductId { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具名称
|
||||||
|
/// </summary>
|
||||||
|
public virtual string ProductName { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具类型,0我的商城
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ProductType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具描述
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? ProductDesc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 价格
|
||||||
|
/// </summary>
|
||||||
|
public virtual decimal Price { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 道具图片配置 图片id
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否启用
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool IsEnable { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否有首充
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool IsFirstCharge { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首充图片
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? FirstChargeImageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首充价格
|
||||||
|
/// </summary>
|
||||||
|
public virtual decimal? FirstChargePrice { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime? UpdateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? OrderById { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选中图片
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? SelectImageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 选中首充图片
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? SelectFirstChargeImageId { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产品表奖励
|
||||||
|
/// </summary>
|
||||||
|
public partial class T_Products_Reward: MultiTenantEntity
|
||||||
|
{
|
||||||
|
public T_Products_Reward() { }
|
||||||
|
|
||||||
|
public virtual int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励类型
|
||||||
|
/// </summary>
|
||||||
|
public virtual int CurrencyType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励
|
||||||
|
/// </summary>
|
||||||
|
public virtual int Money { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属商品
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? T_ProductId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首充送多少奖励
|
||||||
|
/// </summary>
|
||||||
|
public virtual int? FirstChargeMoney { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属商品
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? ProductId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属租户
|
||||||
|
/// </summary>
|
||||||
|
public override Guid TenantId { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七日签到配置表
|
||||||
|
/// </summary>
|
||||||
|
public partial class T_SevenDaySignIn: MultiTenantEntity
|
||||||
|
{
|
||||||
|
public T_SevenDaySignIn() { }
|
||||||
|
|
||||||
|
public virtual int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到图片
|
||||||
|
/// </summary>
|
||||||
|
public virtual int ImageId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public virtual int OrderId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属租户
|
||||||
|
/// </summary>
|
||||||
|
public override Guid TenantId { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 七日签到奖励配置表
|
|
||||||
/// </summary>
|
|
||||||
public partial class T_SevenDaySignIn_AwardCBT: MultiTenantEntity
|
|
||||||
{
|
|
||||||
public T_SevenDaySignIn_AwardCBT() { }
|
|
||||||
|
|
||||||
public virtual int Id { get; set; }
|
|
||||||
|
|
||||||
public virtual int SignInId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 1钻石 2蘑菇币 3贡献值 4一日会员
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属租户
|
|
||||||
/// </summary>
|
|
||||||
public override Guid TenantId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七日签到奖励配置表
|
||||||
|
/// </summary>
|
||||||
|
public partial class T_SevenDaySignIn_Reward: MultiTenantEntity
|
||||||
|
{
|
||||||
|
public T_SevenDaySignIn_Reward() { }
|
||||||
|
|
||||||
|
public virtual int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 七天签到id
|
||||||
|
/// </summary>
|
||||||
|
public virtual int SigninId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励类型
|
||||||
|
/// </summary>
|
||||||
|
public virtual int CurrencyType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 奖励数量
|
||||||
|
/// </summary>
|
||||||
|
public virtual int AwardNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属租户
|
||||||
|
/// </summary>
|
||||||
|
public override Guid TenantId { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 签到类型
|
|
||||||
/// </summary>
|
|
||||||
public partial class T_SignTypes: MultiTenantEntity
|
|
||||||
{
|
|
||||||
public T_SignTypes() { }
|
|
||||||
|
|
||||||
public virtual int Id { get; set; }
|
|
||||||
|
|
||||||
public virtual string? Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 签到类型
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 所属租户
|
|
||||||
/// </summary>
|
|
||||||
public override Guid TenantId { get; set; }
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CloudGaming.Model.DbSqlServer.Db_Phone;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户签到表
|
||||||
|
/// </summary>
|
||||||
|
public partial class T_User_SignDays: MultiTenantEntity
|
||||||
|
{
|
||||||
|
public T_User_SignDays() { }
|
||||||
|
|
||||||
|
public virtual int Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户Id
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public virtual int UserId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 签到时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime SignDayTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime UpdateTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public virtual DateTime CreatTime { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public virtual string? Desc { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 累计签到天数,连续7天,从新开始
|
||||||
|
/// </summary>
|
||||||
|
public virtual int SignDayNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属租户
|
||||||
|
/// </summary>
|
||||||
|
public override Guid TenantId { get; set; }
|
||||||
|
}
|
||||||
|
|
@ -1,98 +1,200 @@
|
||||||
using HuanMeng.DotNetCore.CacheHelper.Contract;
|
using HuanMeng.DotNetCore.CacheHelper.Contract;
|
||||||
|
using HuanMeng.DotNetCore.Redis;
|
||||||
|
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
using StackExchange.Redis;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace HuanMeng.DotNetCore.CacheHelper
|
namespace HuanMeng.DotNetCore.CacheHelper;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存扩展-
|
||||||
|
/// </summary>
|
||||||
|
public abstract class CommonDataEntityCache<T> : ICacheClearData, ICacheReloadData where T : class
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 缓存扩展-
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class CommonDataEntityCache<T> : ICacheClearData, ICacheReloadData where T : class
|
protected object lockObj;
|
||||||
|
/// <summary>
|
||||||
|
/// 过期时间
|
||||||
|
/// </summary>
|
||||||
|
protected int cacheTime;
|
||||||
|
|
||||||
|
protected CommonDataEntityCache(object lockObj, int cacheTime = 36000)
|
||||||
{
|
{
|
||||||
/// <summary>
|
this.lockObj = lockObj;
|
||||||
///
|
this.cacheTime = cacheTime;
|
||||||
/// </summary>
|
}
|
||||||
protected object lockObj;
|
|
||||||
/// <summary>
|
|
||||||
/// 过期时间
|
|
||||||
/// </summary>
|
|
||||||
protected int cacheTime;
|
|
||||||
|
|
||||||
protected CommonDataEntityCache(object lockObj, int cacheTime = 36000)
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public abstract string key { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存数据
|
||||||
|
/// </summary>
|
||||||
|
protected List<T>? _dataList;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public virtual List<T> DataList
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
this.lockObj = lockObj;
|
if (_dataList == null)
|
||||||
this.cacheTime = cacheTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public abstract string key { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 缓存数据
|
|
||||||
/// </summary>
|
|
||||||
protected List<T>? _dataList;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数据
|
|
||||||
/// </summary>
|
|
||||||
public virtual List<T> DataList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
{
|
||||||
if (_dataList == null)
|
var tempDataList = MemoryCacheHelper.GetCache<List<T>>(key);
|
||||||
|
if (tempDataList == null)
|
||||||
{
|
{
|
||||||
var tempDataList = MemoryCacheHelper.GetCache<List<T>>(key);
|
lock (lockObj)
|
||||||
if (tempDataList == null)
|
|
||||||
{
|
{
|
||||||
lock (lockObj)
|
tempDataList = MemoryCacheHelper.GetCache<List<T>>(key);
|
||||||
|
if (tempDataList == null)
|
||||||
{
|
{
|
||||||
tempDataList = MemoryCacheHelper.GetCache<List<T>>(key);
|
tempDataList = GetDataList();
|
||||||
if (tempDataList == null)
|
MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
|
||||||
{
|
|
||||||
tempDataList = GetDataList();
|
|
||||||
MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_dataList = JsonConvert.DeserializeObject<List<T>>(JsonConvert.SerializeObject(tempDataList));
|
|
||||||
}
|
}
|
||||||
return _dataList ?? new List<T>();
|
_dataList = JsonConvert.DeserializeObject<List<T>>(JsonConvert.SerializeObject(tempDataList));
|
||||||
}
|
}
|
||||||
|
return _dataList ?? new List<T>();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取缓存数据
|
/// 获取缓存数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract List<T> GetDataList();
|
public abstract List<T> GetDataList();
|
||||||
|
|
||||||
public virtual bool ClearData()
|
public virtual bool ClearData()
|
||||||
|
{
|
||||||
|
lock (lockObj)
|
||||||
{
|
{
|
||||||
lock (lockObj)
|
MemoryCacheHelper.DelCache(key);
|
||||||
{
|
_dataList = null;
|
||||||
MemoryCacheHelper.DelCache(key);
|
|
||||||
_dataList = null;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void ReloadData()
|
public virtual void ReloadData()
|
||||||
|
{
|
||||||
|
lock (lockObj)
|
||||||
{
|
{
|
||||||
lock (lockObj)
|
var tempDataList = GetDataList();
|
||||||
{
|
MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
|
||||||
var tempDataList = GetDataList();
|
_dataList = tempDataList;
|
||||||
MemoryCacheHelper.SetCache(key, tempDataList, cacheTime);
|
}
|
||||||
_dataList = tempDataList;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存扩展-
|
||||||
|
/// </summary>
|
||||||
|
public abstract class RedisDataEntityCache<T> : CommonDataEntityCache<T> where T : class
|
||||||
|
{
|
||||||
|
public IDatabase database;
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
protected object lockObj;
|
||||||
|
/// <summary>
|
||||||
|
/// 过期时间
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
/// <summary>
|
||||||
|
/// 缓存数据
|
||||||
|
/// </summary>
|
||||||
|
protected List<T>? _dataList;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据
|
||||||
|
/// </summary>
|
||||||
|
public virtual List<T> DataList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
|
||||||
|
if (_dataList == null)
|
||||||
|
{
|
||||||
|
start:
|
||||||
|
var tempDataList = database.StringGet<List<T>>(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<List<T>>(JsonConvert.SerializeObject(tempDataList));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
Thread.Sleep(500);
|
||||||
|
tempDataList = database.StringGet<List<T>>(key);
|
||||||
|
if (tempDataList == null)
|
||||||
|
{
|
||||||
|
if (index < 10)
|
||||||
|
{
|
||||||
|
goto start;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return _dataList ?? new List<T>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,20 @@ namespace HuanMeng.DotNetCore.Redis
|
||||||
{
|
{
|
||||||
return await database.StringSetAsync(key, (value == null ? "" : JsonConvert.SerializeObject(value)), expiry, When.Always);
|
return await database.StringSetAsync(key, (value == null ? "" : JsonConvert.SerializeObject(value)), expiry, When.Always);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数据存放在redis
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="database"></param>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <param name="expiry"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取一个key的对象
|
/// 获取一个key的对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -198,6 +212,8 @@ namespace HuanMeng.DotNetCore.Redis
|
||||||
// 将 RedisValue 转换为 T 类型
|
// 将 RedisValue 转换为 T 类型
|
||||||
return JsonConvert.DeserializeObject<T>(value);
|
return JsonConvert.DeserializeObject<T>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模糊查询key
|
/// 模糊查询key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user