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; } /// /// 当前授权 ID(一个客户最多一条授权记录,可能为 null) /// public long? AuthorizationId { get; set; } /// /// 当前授权状态(Cancelled=0, Active=1, Expired=2) /// public AuthorizationStatus? AuthorizationStatus { get; set; } /// /// 当前授权到期时间 /// 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; /// /// 默认密码 hm123456(8位含字母+数字,符合密码强度校验) /// public string Password { get; set; } = "hm123456"; /// /// 头像(本地上传后的URL) /// 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; } /// /// 是否只查询员工(排除客户角色)。Employees 页面传 true,避免返回客户数据 /// 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; /// /// 视频封面(已废弃,保留字段返回默认值) /// 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 PlatformList { get; set; } = new(); /// /// 平台信息(含图标URL),供前端展示平台图标 /// public List PlatformItems { get; set; } = new(); public ProjectStatus Status { get; set; } /// /// 是否推荐(已废弃,保留字段返回默认值) /// public bool IsFeatured { get; set; } /// /// 排序值(已废弃,保留字段返回默认值) /// 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 Tags { get; set; } = new(); /// /// 标签信息(含颜色),供前端展示标签颜色 /// public List TagItems { get; set; } = new(); /// /// 分类图标URL,供前端展示分类图标 /// public string CategoryIcon { get; set; } = string.Empty; /// /// 截图列表(已废弃,保留字段返回空列表) /// public List 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; /// /// 视频封面(已废弃,可选字段,不再使用) /// 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; /// /// 是否推荐(已废弃,可选字段,不再使用) /// public bool IsFeatured { get; set; } /// /// 排序值(已废弃,可选字段,不再使用) /// public int SortOrder { get; set; } public List TagIds { get; set; } = new(); /// /// 截图列表(已废弃,可选字段,不再使用) /// public List Screenshots { get; set; } = new(); /// /// 资源包唤醒协议更新列表(仅更新已上传资源包的唤醒协议参数,不涉及文件上传) /// public List Packages { get; set; } = new(); } public class UpdateProjectRequest : CreateProjectRequest { } /// /// 资源包唤醒协议更新 DTO(用于项目保存时同步更新已上传资源包的唤醒协议参数) /// 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; } /// /// 体验记录 DTO:用于个人中心展示用户的项目体验历史 /// public class ExperienceLogDto { public long Id { get; set; } public long ProjectId { get; set; } /// 项目名称(已删除的项目返回空字符串,前端兜底显示"已删除项目") public string ProjectName { get; set; } = string.Empty; /// 项目封面签名URL(已删除项目返回空字符串) public string ProjectCover { get; set; } = string.Empty; /// 体验时长(秒) public int DurationSeconds { get; set; } /// 体验时间 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; /// /// 标签的 Icon 字段存储的是颜色 hex 值(如 #1677FF),用于前端标签背景色 /// 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; } /// /// 原始文件名(上传时的文件名) /// public string FileName { get; set; } = string.Empty; public string Url { get; set; } = string.Empty; public long FileSize { get; set; } public DateTime CreatedAt { get; set; } /// /// 唤醒协议前缀(Android/PC 平台使用,固定为 millisim) /// public string WakeProtocolPrefix { get; set; } = string.Empty; /// /// 唤醒协议参数(Android/PC 平台使用) /// public string WakeProtocolParam { get; set; } = string.Empty; /// /// WebGL 解压后的根路径对象键(仅 WebGL 类型使用,用于在线运行) /// 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; /// /// 项目 ID(已废弃,客户级授权不再关联项目) /// 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 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; } /// /// 公开系统设置 DTO(无需鉴权):用于前台/后台 Layout 显示平台名、Logo、备案号等 /// 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; /// 客服热线/电话 public string ContactPhone { get; set; } = string.Empty; /// 商务邮箱 public string ContactEmail { get; set; } = string.Empty; /// 公司地址 public string ContactAddress { get; set; } = string.Empty; /// 官方网站 public string ContactWebsite { get; set; } = string.Empty; /// 工作时间 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; /// /// 前台首页是否显示合作伙伴模块 /// public bool ShowPartners { get; set; } = true; /// /// 前台是否显示"关于我们"页面 /// public bool ShowAbout { get; set; } = true; } /// /// 文件上传结果DTO /// public class UploadResultDto { /// 可访问的签名URL(用于预览显示) public string Url { get; set; } = string.Empty; /// 对象键或本地路径(用于数据库存储) public string Key { get; set; } = string.Empty; } public class UpdateSettingsRequest { public Dictionary 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 IntroParagraphs { get; set; } = new(); public List Stats { get; set; } = new(); public string MissionTitle { get; set; } = "使命与愿景"; public List MissionCards { get; set; } = new(); public string TimelineTitle { get; set; } = "发展历程"; public List 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 Trends { get; set; } = new(); public List CategoryDistribution { get; set; } = new(); public List RecentActivities { get; set; } = new(); public List HotProjects { get; set; } = new(); }