2026-10-19 00:24:22 +08:00
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
2026-10-12 16:22:04 +08:00
|
|
|
using Common.Utils;
|
|
|
|
|
using CommonDomain;
|
|
|
|
|
using CommonDomain.BaseModel;
|
|
|
|
|
using CommonDomain.Enum;
|
|
|
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
|
|
|
using MongoRepository;
|
|
|
|
|
using MongoRepository.Attributes;
|
|
|
|
|
using MongoRepository.Config;
|
|
|
|
|
using XAct;
|
|
|
|
|
|
|
|
|
|
namespace UserDomain.Entity
|
|
|
|
|
{
|
|
|
|
|
[BsonCollection("user", ServiceDatabases.User)]
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class UserEntity : MongoBaseEntity
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public UserBaseInfo BaseInfo= new UserBaseInfo();
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public RealNameInfo RealName { get; set; }
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public SafeBoxInfo SafeBox { get; set; } = new SafeBoxInfo();
|
|
|
|
|
|
|
|
|
|
public SignInfo Sign { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<BaseUserProp> CannonList { get; set; }=new List<BaseUserProp>();
|
|
|
|
|
|
|
|
|
|
public BaseUserProp CannonUsing { get; set; }
|
|
|
|
|
|
|
|
|
|
public BaseUserProp WingUsing { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<BaseUserProp> WingList { get; set; } = new List<BaseUserProp>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseUserProp GodWarUsing { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<BaseUserProp> GodWarList { get; set; } = new List<BaseUserProp>();
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public List<BaseProductCount> Props { get; set; } = new List<BaseProductCount>();
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public Assets Assets { get; set; } = new Assets();
|
|
|
|
|
public long CreateTime { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public string RegisterIp { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public BanInfo BanInfo { get; set; }
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public StaticInfo Static { get; set; } = new StaticInfo();
|
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
|
|
|
public PlayerFactor PlayerFactor { get; set; } = new PlayerFactor();
|
|
|
|
|
|
|
|
|
|
public int UserType { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
public FishingReturnInfo FishingReturn { get; set; } = new FishingReturnInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Init(GameConfig gameConfig, ActivityConfig activityConfig)
|
|
|
|
|
{
|
|
|
|
|
CreateTime = DateTime.Now.ToTimeStamp();
|
|
|
|
|
CreateInfo = new OptionUserInfo(BaseInfo.Number, BaseInfo.UserName);
|
|
|
|
|
Static.ReliefGoldCount = activityConfig?.ReliefConfig.Count ?? 3;
|
|
|
|
|
Sign = new SignInfo();
|
|
|
|
|
|
|
|
|
|
Assets.Gold = activityConfig?.RegisterConfig.InitGold ?? 0;
|
|
|
|
|
Assets.Diamond = activityConfig?.RegisterConfig.InitDiamond ?? 0;
|
|
|
|
|
BaseInfo.AvatarUrl = "UI_touxiang_01_11 ";
|
|
|
|
|
BaseInfo.AvatarFrame = "五一专属头像框";
|
|
|
|
|
PlayerFactor = new PlayerFactor()
|
|
|
|
|
{
|
|
|
|
|
IsBlack = false,
|
|
|
|
|
CompensateQuota=0,
|
|
|
|
|
PenaltyQuota=0,
|
|
|
|
|
AdditionalFactor=1,
|
|
|
|
|
StartingBonus = activityConfig?.RegisterConfig.InitGold ?? 0,
|
|
|
|
|
ViolateValue = 1,
|
|
|
|
|
CompensateRate = gameConfig.KillConfig.CompensateRate,
|
|
|
|
|
PenaltyRate = gameConfig.KillConfig.PenaltyRate,
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (activityConfig?.RegisterConfig.InitProductList!=null && activityConfig.RegisterConfig.InitProductList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var product in activityConfig.RegisterConfig.InitProductList.Where(c=> ProductType.MoreProductTypeList.Contains(c.Type)))
|
|
|
|
|
{
|
|
|
|
|
Props.Add(product);
|
|
|
|
|
}
|
|
|
|
|
foreach (var item in activityConfig.RegisterConfig.InitProductList.Where(c => !ProductType.MoreProductTypeList.Contains(c.Type)))
|
|
|
|
|
{
|
|
|
|
|
var propConfig = gameConfig.PropConfig.FirstOrDefault(c => c.Number == item.Number);
|
|
|
|
|
BaseUserProp baseUserProp = null;
|
|
|
|
|
if (propConfig != null)
|
|
|
|
|
{
|
|
|
|
|
baseUserProp = new BaseUserProp
|
|
|
|
|
{
|
|
|
|
|
Number = item.Number,
|
|
|
|
|
Type = item.Type,
|
|
|
|
|
Name = item.Name,
|
|
|
|
|
ImageUrl = item.ImageUrl,
|
|
|
|
|
Desc = item.Desc,
|
|
|
|
|
Level = item.Level
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
if (propConfig.Day > 0)
|
|
|
|
|
{
|
|
|
|
|
baseUserProp.IsTrial = true;
|
|
|
|
|
baseUserProp.TrialEndTime = DateTime.Now.AddDays(propConfig.Day).ToTimeStamp();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (item.Type== ProductTypeEnum.战神 && baseUserProp != null)
|
|
|
|
|
{
|
|
|
|
|
GodWarList.Add(baseUserProp);
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == ProductTypeEnum.翅膀 && baseUserProp != null)
|
|
|
|
|
{
|
|
|
|
|
WingList.Add(baseUserProp);
|
|
|
|
|
}
|
|
|
|
|
else if (item.Type == ProductTypeEnum.炮台 && baseUserProp != null)
|
|
|
|
|
{
|
|
|
|
|
CannonList.Add(baseUserProp);
|
|
|
|
|
if (CannonUsing == null)
|
|
|
|
|
CannonUsing = baseUserProp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<int> VipLevelVerify(GameConfig config)
|
|
|
|
|
{
|
|
|
|
|
if (config?.VipLevelConfigs == null)
|
|
|
|
|
return null;
|
|
|
|
|
var vipExp = Math.Max(0D, Static.TotalRecharge * 10) + Math.Max(0L, Assets.VipExpExtra);
|
|
|
|
|
Assets.VipExp = (long)vipExp;
|
|
|
|
|
var level = config.VipLevelConfigs.FirstOrDefault(c => vipExp >= c.ExpMin && vipExp < c.ExpMax);
|
|
|
|
|
if (level == null)
|
|
|
|
|
return null;
|
|
|
|
|
var oldLevel = Assets.VipLevel;
|
|
|
|
|
if (level.Level != oldLevel)
|
|
|
|
|
{
|
|
|
|
|
if (level.Level > oldLevel)
|
|
|
|
|
{
|
|
|
|
|
Assets.VipLevel = level.Level;
|
|
|
|
|
Assets.VipSignInAdd = level.SignInAdd;
|
|
|
|
|
var newLevels = config.VipLevelConfigs
|
|
|
|
|
.Where(c => c.Level > oldLevel && c.Level <= level.Level)
|
|
|
|
|
.Select(c => c.Level)
|
|
|
|
|
.ToList();
|
|
|
|
|
foreach (var lvl in newLevels)
|
|
|
|
|
{
|
|
|
|
|
if (!Assets.VipGift.Contains(lvl))
|
|
|
|
|
Assets.VipGift.Add(lvl);
|
|
|
|
|
}
|
|
|
|
|
return newLevels;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Assets.VipLevel = level.Level;
|
|
|
|
|
Assets.VipSignInAdd = level.SignInAdd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public (bool isLevel, long gold, int diamond, List<BaseProductCount> list) LevelVerify(long addExp, List<UserLevelConfig> levelConfig)
|
|
|
|
|
{
|
|
|
|
|
Assets.Exp += addExp;
|
|
|
|
|
var config = levelConfig.FirstOrDefault(c => Assets.Exp >= c.ExpMin && Assets.Exp < c.ExpMax);
|
|
|
|
|
if (config == null)
|
|
|
|
|
return (false, 0, 0, null);
|
|
|
|
|
|
|
|
|
|
if (config.Level != Assets.Level)
|
|
|
|
|
{
|
|
|
|
|
Assets.Level = config.Level;
|
|
|
|
|
return (true, config.Gold, config.Diamond, config.ProductList);
|
|
|
|
|
}
|
|
|
|
|
return (false, 0, 0, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class SignInfo
|
|
|
|
|
{
|
|
|
|
|
public bool IsSign { get; set; } = false;
|
|
|
|
|
public long SignTime { get; set; } = 0;
|
2026-10-19 00:24:22 +08:00
|
|
|
|
|
|
|
|
/// <summary>当前已签到的周期天数(0=未开始,1~7)</summary>
|
|
|
|
|
public int SignDay { get; set; } = 0;
|
2026-10-12 16:22:04 +08:00
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class PlayerFactor
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public bool IsIgnore { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
public bool IsBlack { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
public double ViolateValue { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CompensateRateParam CompensateRate { get; set; } = new CompensateRateParam();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public CompensateRateParam PenaltyRate { get; set; } = new CompensateRateParam();
|
|
|
|
|
|
|
|
|
|
public int CompensateQuota { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long CompensateStartGold { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long CompensateTargetGold { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public int PenaltyQuota { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long StartingBonus { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public double MissRate { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public double AdditionalFactor { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class StaticInfo
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public long LastLoginTime { get; set; } = 0;
|
|
|
|
|
public string LastLoginIp { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
public long OnlineTime { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long GameTime { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public string RoomNumber { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
public int CurrentGameType { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public double TotalRecharge { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long TotalRechargeGold { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long TotalConsumeGold { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public int TotalConsumeDiamond { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public int ReliefGoldCount {get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class BanInfo
|
|
|
|
|
{
|
|
|
|
|
public bool IsBan { get; set; } = false;
|
|
|
|
|
public long BanTime { get; set; } = 0;
|
|
|
|
|
public string BanReason { get; set; } = "";
|
|
|
|
|
public int BanDays { get; set; } = 0;
|
|
|
|
|
public long BanEndTime { get; set; } = 0;
|
|
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class UserBaseInfo
|
|
|
|
|
{
|
|
|
|
|
public string UserName { get; set; } = string.Empty;
|
|
|
|
|
public string Password { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string Number { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string AvatarUrl { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string AvatarFrame { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string Mobile { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string WXOpenId { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public string Channel { get; set; } = string.Empty;
|
|
|
|
|
|
|
|
|
|
public bool IsRedName { get; set; } = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class Assets
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public bool IsDealer { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public double ViolateRate { get; set; } = 1;
|
|
|
|
|
|
|
|
|
|
public int Diamond { get; set; } = 0;
|
|
|
|
|
public long Gold { get; set; } = 0;
|
|
|
|
|
public int Level { get; set; } = 0;
|
|
|
|
|
public long Exp { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long VipExp { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long VipExpExtra { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public double VipSignInAdd { get; set; } = 0;
|
|
|
|
|
public int VipLevel { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<int> VipGift { get; set; } = new List<int>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsVipDayGift { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class RealNameInfo
|
|
|
|
|
{
|
|
|
|
|
public string RealName { get; set; } = string.Empty;
|
|
|
|
|
public string IDCard { get; set; } = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class SafeBoxInfo
|
|
|
|
|
{
|
|
|
|
|
public long Amount { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public string Password { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
public long SaveTime { get; set; } = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class BaseUserProp : BaseProduct
|
|
|
|
|
{
|
|
|
|
|
public bool IsTrial { get; set; } = false;
|
|
|
|
|
public long TrialEndTime { get; set; } = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BsonIgnoreExtraElements]
|
|
|
|
|
public class FishingReturnInfo
|
|
|
|
|
{
|
|
|
|
|
public long TodayConsume { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public long YesterdayConsume { get; set; } = 0;
|
|
|
|
|
|
|
|
|
|
public bool IsClaimed { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
public string LastFishingDate { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
[BsonIgnore]
|
|
|
|
|
public long CanClaimGold { get; set; } = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|