626 lines
21 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using MilliSim.Common.Models;
namespace MilliSim.Common.Dtos;
// ===== 认证 DTO =====
public class LoginRequest
{
public string Username { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string CaptchaId { get; set; } = string.Empty;
public string CaptchaCode { get; set; } = string.Empty;
}
public class LoginResponse
{
public string Token { get; set; } = string.Empty;
public long UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string Nickname { get; set; } = string.Empty;
public string Avatar { get; set; } = string.Empty;
public UserRole Role { get; set; }
public string RoleName { get; set; } = string.Empty;
}
public class ChangePasswordRequest
{
public string OldPassword { get; set; } = string.Empty;
public string NewPassword { get; set; } = string.Empty;
}
// ===== 用户 DTO =====
public class UserDto
{
public long Id { get; set; }
public string Username { get; set; } = string.Empty;
public string Nickname { get; set; } = string.Empty;
public string Avatar { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public UserRole Role { get; set; }
public string RoleName { get; set; } = string.Empty;
public UserStatus Status { get; set; }
public long? CreatedBy { get; set; }
public string CreatedByName { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
/// <summary>
/// 当前授权 ID一个客户最多一条授权记录可能为 null
/// </summary>
public long? AuthorizationId { get; set; }
/// <summary>
/// 当前授权状态Cancelled=0, Active=1, Expired=2
/// </summary>
public AuthorizationStatus? AuthorizationStatus { get; set; }
/// <summary>
/// 当前授权到期时间
/// </summary>
public DateTime? AuthorizationEndTime { get; set; }
}
public class CreateUserRequest
{
public string Username { get; set; } = string.Empty;
public string Nickname { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public UserRole Role { get; set; } = UserRole.Customer;
/// <summary>
/// 默认密码 hm1234568位含字母+数字,符合密码强度校验)
/// </summary>
public string Password { get; set; } = "hm123456";
/// <summary>
/// 头像本地上传后的URL
/// </summary>
public string Avatar { get; set; } = string.Empty;
}
public class UpdateUserRequest
{
public string Nickname { get; set; } = string.Empty;
public string Avatar { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public UserStatus Status { get; set; } = UserStatus.Active;
}
public class UpdateProfileRequest
{
public string Nickname { get; set; } = string.Empty;
public string Avatar { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
}
public class UserQueryRequest : PageRequest
{
public UserRole? Role { get; set; }
public long? CreatedBy { get; set; }
public UserStatus? Status { get; set; }
/// <summary>
/// 是否只查询员工排除客户角色。Employees 页面传 true避免返回客户数据
/// </summary>
public bool StaffOnly { get; set; }
}
// ===== 项目 DTO =====
public class ProjectDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public long CategoryId { get; set; }
public string CategoryName { get; set; } = string.Empty;
public string CoverImage { get; set; } = string.Empty;
public string VideoUrl { get; set; } = string.Empty;
/// <summary>
/// 视频封面(已废弃,保留字段返回默认值)
/// </summary>
public string VideoCover { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public string Platforms { get; set; } = string.Empty;
public List<string> PlatformList { get; set; } = new();
/// <summary>
/// 平台信息含图标URL供前端展示平台图标
/// </summary>
public List<PlatformItemDto> PlatformItems { get; set; } = new();
public ProjectStatus Status { get; set; }
/// <summary>
/// 是否推荐(已废弃,保留字段返回默认值)
/// </summary>
public bool IsFeatured { get; set; }
/// <summary>
/// 排序值(已废弃,保留字段返回默认值)
/// </summary>
public int SortOrder { get; set; }
public int ViewCount { get; set; }
public int ExperienceCount { get; set; }
public int FavoriteCount { get; set; }
public DateTime? PublishedAt { get; set; }
public DateTime CreatedAt { get; set; }
public List<string> Tags { get; set; } = new();
/// <summary>
/// 标签信息(含颜色),供前端展示标签颜色
/// </summary>
public List<TagItemDto> TagItems { get; set; } = new();
/// <summary>
/// 分类图标URL供前端展示分类图标
/// </summary>
public string CategoryIcon { get; set; } = string.Empty;
/// <summary>
/// 截图列表(已废弃,保留字段返回空列表)
/// </summary>
public List<string> Screenshots { get; set; } = new();
public bool IsFavorited { get; set; }
}
public class CreateProjectRequest
{
public string Name { get; set; } = string.Empty;
public long CategoryId { get; set; }
public string CoverImage { get; set; } = string.Empty;
public string VideoUrl { get; set; } = string.Empty;
/// <summary>
/// 视频封面(已废弃,可选字段,不再使用)
/// </summary>
public string VideoCover { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public string Platforms { get; set; } = string.Empty;
public ProjectStatus Status { get; set; } = ProjectStatus.Offline;
/// <summary>
/// 是否推荐(已废弃,可选字段,不再使用)
/// </summary>
public bool IsFeatured { get; set; }
/// <summary>
/// 排序值(已废弃,可选字段,不再使用)
/// </summary>
public int SortOrder { get; set; }
public List<long> TagIds { get; set; } = new();
/// <summary>
/// 截图列表(已废弃,可选字段,不再使用)
/// </summary>
public List<string> Screenshots { get; set; } = new();
/// <summary>
/// 资源包唤醒协议更新列表(仅更新已上传资源包的唤醒协议参数,不涉及文件上传)
/// </summary>
public List<PackageUpdateDto> Packages { get; set; } = new();
}
public class UpdateProjectRequest : CreateProjectRequest { }
/// <summary>
/// 资源包唤醒协议更新 DTO用于项目保存时同步更新已上传资源包的唤醒协议参数
/// </summary>
public class PackageUpdateDto
{
public long Id { get; set; }
public PackageType Type { get; set; }
public string WakeProtocolPrefix { get; set; } = string.Empty;
public string WakeProtocolParam { get; set; } = string.Empty;
}
/// <summary>
/// 体验记录 DTO用于个人中心展示用户的项目体验历史
/// </summary>
public class ExperienceLogDto
{
public long Id { get; set; }
public long ProjectId { get; set; }
/// <summary>项目名称(已删除的项目返回空字符串,前端兜底显示"已删除项目"</summary>
public string ProjectName { get; set; } = string.Empty;
/// <summary>项目封面签名URL已删除项目返回空字符串</summary>
public string ProjectCover { get; set; } = string.Empty;
/// <summary>体验时长(秒)</summary>
public int DurationSeconds { get; set; }
/// <summary>体验时间</summary>
public DateTime CreatedAt { get; set; }
}
public class ProjectQueryRequest : PageRequest
{
public long? CategoryId { get; set; }
public string? Platforms { get; set; }
public ProjectStatus? Status { get; set; }
public bool? IsFeatured { get; set; }
public string SortBy { get; set; } = "latest";
}
// ===== 项目关联的图标信息(用于前端展示) =====
public class PlatformItemDto
{
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
}
public class TagItemDto
{
public string Name { get; set; } = string.Empty;
/// <summary>
/// 标签的 Icon 字段存储的是颜色 hex 值(如 #1677FF用于前端标签背景色
/// </summary>
public string Color { get; set; } = string.Empty;
}
// ===== 分类/平台/标签 DTO =====
public class CategoryDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
public UserStatus Status { get; set; }
}
public class CreateCategoryRequest
{
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
}
public class PlatformDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
public UserStatus Status { get; set; }
}
public class CreatePlatformRequest
{
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
}
public class TagDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
public UserStatus Status { get; set; }
}
public class CreateTagRequest
{
public string Name { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
public int SortOrder { get; set; }
}
// ===== 资源包 DTO =====
public class PackageDto
{
public long Id { get; set; }
public long ProjectId { get; set; }
public PackageType Type { get; set; }
/// <summary>
/// 原始文件名(上传时的文件名)
/// </summary>
public string FileName { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public long FileSize { get; set; }
public DateTime CreatedAt { get; set; }
/// <summary>
/// 唤醒协议前缀Android/PC 平台使用,固定为 millisim
/// </summary>
public string WakeProtocolPrefix { get; set; } = string.Empty;
/// <summary>
/// 唤醒协议参数Android/PC 平台使用)
/// </summary>
public string WakeProtocolParam { get; set; } = string.Empty;
/// <summary>
/// WebGL 解压后的根路径对象键(仅 WebGL 类型使用,用于在线运行)
/// </summary>
public string ExtractedPath { get; set; } = string.Empty;
}
// ===== 授权 DTO =====
public class AuthorizationDto
{
public long Id { get; set; }
public long UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string UserNickname { get; set; } = string.Empty;
/// <summary>
/// 项目 ID已废弃客户级授权不再关联项目
/// </summary>
public long? ProjectId { get; set; }
public string ProjectName { get; set; } = string.Empty;
public long AuthorizedBy { get; set; }
public string AuthorizedByName { get; set; } = string.Empty;
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public AuthorizationStatus Status { get; set; }
public string StatusName { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
public class CreateAuthorizationRequest
{
public long UserId { get; set; }
public int Days { get; set; } = 365;
}
public class BatchAuthorizationRequest
{
public List<long> UserIds { get; set; } = new();
public int Days { get; set; } = 365;
}
public class RenewAuthorizationRequest
{
public int Days { get; set; } = 30;
}
public class AuthorizationQueryRequest : PageRequest
{
public long? UserId { get; set; }
public AuthorizationStatus? Status { get; set; }
}
// ===== 内容 DTO =====
public class BannerDto
{
public long Id { get; set; }
public string Title { get; set; } = string.Empty;
public string Image { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int SortOrder { get; set; }
public UserStatus Status { get; set; }
}
public class CreateBannerRequest
{
public string Title { get; set; } = string.Empty;
public string Image { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int SortOrder { get; set; }
public UserStatus Status { get; set; } = UserStatus.Active;
}
public class PartnerDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Logo { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int SortOrder { get; set; }
public bool IsVisible { get; set; }
}
public class CreatePartnerRequest
{
public string Name { get; set; } = string.Empty;
public string Logo { get; set; } = string.Empty;
public string Link { get; set; } = string.Empty;
public int SortOrder { get; set; }
public bool IsVisible { get; set; } = true;
}
public class ConsultationDto
{
public long Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Contact { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public bool IsRead { get; set; }
public DateTime CreatedAt { get; set; }
}
public class CreateConsultationRequest
{
public string Name { get; set; } = string.Empty;
public string Contact { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
}
// ===== 通知 DTO =====
public class NotificationDto
{
public long Id { get; set; }
public NotificationType Type { get; set; }
public string TypeName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Content { get; set; } = string.Empty;
public bool IsRead { get; set; }
public DateTime CreatedAt { get; set; }
}
// ===== 系统设置 DTO =====
public class SystemSettingDto
{
public string Key { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string Description { get; set; } = string.Empty;
}
/// <summary>
/// 公开系统设置 DTO无需鉴权用于前台/后台 Layout 显示平台名、Logo、备案号等
/// </summary>
public class PublicSettingsDto
{
public string PlatformName { get; set; } = string.Empty;
public string Slogan { get; set; } = string.Empty;
public string CompanyName { get; set; } = string.Empty;
public string Contact { get; set; } = string.Empty;
/// <summary>客服热线/电话</summary>
public string ContactPhone { get; set; } = string.Empty;
/// <summary>商务邮箱</summary>
public string ContactEmail { get; set; } = string.Empty;
/// <summary>公司地址</summary>
public string ContactAddress { get; set; } = string.Empty;
/// <summary>官方网站</summary>
public string ContactWebsite { get; set; } = string.Empty;
/// <summary>工作时间</summary>
public string ContactWorkTime { get; set; } = string.Empty;
public string ICP { get; set; } = string.Empty;
public string LogoFrontend { get; set; } = string.Empty;
public string LogoBackend { get; set; } = string.Empty;
public string LogoFavicon { get; set; } = string.Empty;
public string LogoLogin { get; set; } = string.Empty;
public string LogoFooter { get; set; } = string.Empty;
/// <summary>
/// 前台首页是否显示合作伙伴模块
/// </summary>
public bool ShowPartners { get; set; } = true;
/// <summary>
/// 前台是否显示"关于我们"页面
/// </summary>
public bool ShowAbout { get; set; } = true;
}
/// <summary>
/// 文件上传结果DTO
/// </summary>
public class UploadResultDto
{
/// <summary>可访问的签名URL用于预览显示</summary>
public string Url { get; set; } = string.Empty;
/// <summary>对象键或本地路径(用于数据库存储)</summary>
public string Key { get; set; } = string.Empty;
}
public class UpdateSettingsRequest
{
public Dictionary<string, string> Settings { get; set; } = new();
}
// ===== 关于我们内容 DTO =====
public class AboutStatDto
{
public string Number { get; set; } = "";
public string Label { get; set; } = "";
}
public class AboutMissionCardDto
{
public string Title { get; set; } = "";
public string Icon { get; set; } = "rocket";
public string Desc { get; set; } = "";
}
public class AboutTimelineItemDto
{
public string Year { get; set; } = "";
public string Title { get; set; } = "";
public string Desc { get; set; } = "";
}
public class AboutContentDto
{
public string HeroTag { get; set; } = "关于我们";
public string HeroTitle { get; set; } = "";
public string HeroDesc { get; set; } = "";
public string IntroTitle { get; set; } = "公司简介";
public List<string> IntroParagraphs { get; set; } = new();
public List<AboutStatDto> Stats { get; set; } = new();
public string MissionTitle { get; set; } = "使命与愿景";
public List<AboutMissionCardDto> MissionCards { get; set; } = new();
public string TimelineTitle { get; set; } = "发展历程";
public List<AboutTimelineItemDto> Timeline { get; set; } = new();
}
public class AboutSettingsDto
{
public bool ShowAbout { get; set; } = true;
public AboutContentDto Content { get; set; } = new();
}
public class FactoryResetRequest
{
public string ConfirmText { get; set; } = "";
}
public class FactoryResetResultDto
{
public int TablesCleared { get; set; }
public int ObjectsDeleted { get; set; }
public long BackupId { get; set; }
}
public class OperationLogDto
{
public long Id { get; set; }
public long UserId { get; set; }
public string Username { get; set; } = string.Empty;
public string Nickname { get; set; } = string.Empty;
public string Module { get; set; } = string.Empty;
public string Operation { get; set; } = string.Empty;
public string Detail { get; set; } = string.Empty;
public string Ip { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
public class OperationLogQueryRequest : PageRequest
{
public long? UserId { get; set; }
public string? Username { get; set; }
public string? Module { get; set; }
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
}
// ===== 备份 DTO =====
public class BackupDto
{
public long Id { get; set; }
public string FileName { get; set; } = string.Empty;
public long FileSize { get; set; }
public string Type { get; set; } = string.Empty;
public string Url { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; }
}
// ===== 唤醒协议 DTO =====
public class WakeProtocolDto
{
public long Id { get; set; }
public string TerminalType { get; set; } = string.Empty;
public string ProtocolPrefix { get; set; } = string.Empty;
public string ParamTemplate { get; set; } = string.Empty;
public UserStatus Status { get; set; }
}
public class CreateWakeProtocolRequest
{
public string TerminalType { get; set; } = string.Empty;
public string ProtocolPrefix { get; set; } = string.Empty;
public string ParamTemplate { get; set; } = string.Empty;
public UserStatus Status { get; set; } = UserStatus.Active;
}
// ===== 工作台 DTO =====
public class DashboardStats
{
public int ProjectCount { get; set; }
public int CustomerCount { get; set; }
public int TodayVisits { get; set; }
public int ActiveAuthorizations { get; set; }
public int UnreadMessages { get; set; }
}
public class TrendData
{
public string Date { get; set; } = string.Empty;
public int Visits { get; set; }
public int Experiences { get; set; }
}
public class CategoryDistribution
{
public string Name { get; set; } = string.Empty;
public int Count { get; set; }
}
public class DashboardData
{
public DashboardStats Stats { get; set; } = new();
public List<TrendData> Trends { get; set; } = new();
public List<CategoryDistribution> CategoryDistribution { get; set; } = new();
public List<OperationLogDto> RecentActivities { get; set; } = new();
public List<ProjectDto> HotProjects { get; set; } = new();
}