Initial project import

This commit is contained in:
2026-07-24 23:11:20 +08:00
commit 6396eabb87
372 changed files with 49682 additions and 0 deletions
@@ -0,0 +1,77 @@
using MiaoJiZhang.Domain.Enums;
namespace MiaoJiZhang.Domain.Entities;
/// <summary>
/// 用户。当前仅用户名+密码注册登录;
/// Email/Phone/微信等字段为预留(决策 2026-07-18),暂不启用。
/// </summary>
public class User
{
public long Id { get; set; }
public string Username { get; set; } = null!;
public string PasswordHash { get; set; } = null!;
public string? Nickname { get; set; }
public string? AvatarUrl { get; set; }
// ---- 预留:快捷登录(暂不启用,仅建表占位) ----
public string? Email { get; set; }
public bool EmailVerified { get; set; }
public string? Phone { get; set; }
public bool PhoneVerified { get; set; }
public string? WeChatOpenId { get; set; }
public string? WeChatUnionId { get; set; }
public string? AppleUserId { get; set; }
// ---- 模式与 AI 伙伴设置 ----
public AppMode AppMode { get; set; } = AppMode.Normal;
public AiCompanionSetting? AiCompanion { get; set; }
public bool IsBanned { get; set; }
public int AuthVersion { get; set; }
public int AiChatLimit { get; set; } = 50;
public AiQuotaPeriod AiChatPeriod { get; set; } = AiQuotaPeriod.Day;
public int AiChatUsed { get; set; }
public DateTime AiChatWindowStartedAt { get; set; }
public DateTime? AccountClosureRequestedAt { get; set; }
public DateTime? AccountClosureScheduledAt { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? LastLoginAt { get; set; }
public List<Ledger> Ledgers { get; set; } = [];
public List<UserFeaturePermission> FeaturePermissions { get; set; } = [];
}
/// <summary>AI 伙伴设置(形象/昵称/性格/滑杆),1:1 User</summary>
public class UserFeaturePermission
{
public long Id { get; set; }
public long UserId { get; set; }
public User User { get; set; } = null!;
public string PermissionKey { get; set; } = null!;
public bool IsEnabled { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
public class AiCompanionSetting
{
public long Id { get; set; }
public long UserId { get; set; }
public User User { get; set; } = null!;
/// <summary>形象 keycat / dog / robot(后台形象库可扩展)</summary>
public string AvatarKey { get; set; } = "cat";
/// <summary>用户给 AI 起的名字;空则用形象默认名</summary>
public string? CustomName { get; set; }
/// <summary>性格 key,对应后台性格库</summary>
public string PersonaKey { get; set; } = "sassy_cat";
/// <summary>吐槽力度 0-100</summary>
public int RoastLevel { get; set; } = 60;
/// <summary>表情包频率 0-100</summary>
public int StickerFrequency { get; set; } = 70;
/// <summary>主动提醒频率 0-100(映射:关/每周/每天/实时)</summary>
public int ProactiveLevel { get; set; } = 40;
}