Files
danyang-match/miniapp/types/index.ts
T

249 lines
5.7 KiB
TypeScript
Raw Normal View History

2026-09-09 22:05:00 +08:00
/**
* 小程序全局类型定义
*/
// ===== 用户 & 账号 =====
export interface User {
id: string
wechatOpenid: string
phone: string | null
accountStatus: AccountStatus
relationshipStatus: RelationshipStatus
recommendationEnabled: boolean
lastLoginAt: string | null
createdAt: string
}
export type AccountStatus = 'normal' | 'reviewing_risk' | 'limited' | 'suspended' | 'banned' | 'closed'
export type RelationshipStatus = 'searching' | 'getting_to_know' | 'paused' | 'matched_successfully' | 'service_exited'
// ===== 资料 =====
export interface UserProfile {
userId: string
displayName: string | null
gender: 'male' | 'female' | 'other'
birthDate: string | null
heightCm: number | null
regionCode: string | null
regionName: string | null
maritalStatus: string | null
childrenStatus: string | null
educationCode: string | null
occupationCode: string | null
profileCompletion: number
profileStatus: ProfileStatus
createdAt: string
}
export type ProfileStatus = 'in_progress' | 'completed' | 'pending_review' | 'approved' | 'need_edit' | 'rejected'
// ===== 择偶偏好 =====
export interface UserPreference {
userId: string
minAge: number | null
maxAge: number | null
agePriority: 'required' | 'preferred'
minHeightCm: number | null
maxHeightCm: number | null
heightPriority: 'required' | 'preferred'
regionScope: string[] | null
regionPriority: 'required' | 'preferred'
maritalStatuses: string[] | null
maritalPriority: 'required' | 'preferred'
}
// ===== 关系 =====
export interface Match {
id: string
userAId: string
userBId: string
status: MatchStatus
source: string
matchedAt: string
successfulAt: string | null
}
export type MatchStatus = 'active' | 'getting_to_know' | 'unmatched' | 'successful'
export interface UserRelation {
id: string
userId: string
targetUserId: string
relationType: RelationType
createdAt: string
}
export type RelationType = 'liked' | 'passed' | 'blocked'
// ===== 推荐 =====
export interface RecommendationCandidate {
userId: string
recommendationLevel: 'high' | 'medium' | 'normal'
recommendationReasons: string[]
displayName?: string
age?: number
heightCm?: number
regionName?: string
}
// ===== 聊天 =====
export interface Conversation {
conversationId: string
matchId: string
otherUserId: string
otherDisplayName: string
otherAvatarUrl: string
lastMessageAt: string
unreadCount: number
status: ConversationStatus
canSendMessage: boolean
}
export type ConversationStatus = 'active' | 'unmatched' | 'blocked'
export interface Message {
messageId: string
conversationId: string
senderId: string
messageType: MessageType
content: string | null
fileId: string | null
status: MessageStatus
createdAt: string
mine: boolean
bubbleType: 'self' | 'other'
}
export type MessageType = 'text' | 'image' | 'system' | 'risk_notice'
export type MessageStatus = 'sent' | 'delivered' | 'read' | 'failed'
// ===== 活动 =====
export interface Activity {
id: string
title: string
description: string
status: ActivityStatus
totalLimit: number
maleLimit: number | null
femaleLimit: number | null
currentMaleCount: number
currentFemaleCount: number
registrationStartAt: string
registrationEndAt: string
activityStartAt: string
activityEndAt: string
location: string
address: string
category: string
coverImageUrl: string
}
export type ActivityStatus = 'draft' | 'registration_open' | 'registration_closed' | 'ongoing' | 'ended' | 'cancelled'
export interface ActivityRegistration {
id: string
activityId: string
userId: string
status: RegistrationStatus
registeredAt: string
checkinStatus: CheckinStatus
}
export type RegistrationStatus = 'pending' | 'approved' | 'rejected' | 'cancelled'
export type CheckinStatus = 'not_checked_in' | 'checked_in'
// ===== 举报 & 申诉 =====
export interface Report {
id: string
reporterId: string
targetUserId: string
reportType: ReportType
content: string
status: ReportStatus
createdAt: string
}
export type ReportType = 'fake_profile' | 'fake_marital_status' | 'harassment' | 'pornography' | 'advertising' | 'fraud' | 'money_inducement' | 'impersonation'
export type ReportStatus = 'pending' | 'processing' | 'resolved'
export interface Appeal {
id: string
appealId: string
reporterId: string
content: string
status: AppealStatus
createdAt: string
}
export type AppealStatus = 'pending' | 'processing' | 'resolved' | 'rejected'
// ===== 照片 =====
export interface UserPhoto {
id: string
userId: string
fileKey: string
photoType: 'avatar' | 'lifestyle'
sortOrder: number
reviewStatus: ReviewStatus
url?: string
}
export type ReviewStatus = 'pending' | 'approved' | 'need_edit' | 'rejected'
// ===== 认证 =====
export interface AuthTokens {
accessToken: string
refreshToken: string
expiresIn: number
userId: string
isNewUser: boolean
}
// ===== 成功牵手请求 =====
export interface SuccessRequest {
requestId: string
matchId: string
initiatedBy: string
status: 'pending' | 'confirmed' | 'declined'
confirmedBy: string | null
createdAt: string
resolvedAt: string | null
}
// ===== API 响应 =====
export interface ApiResponse<T = any> {
success: boolean
code: string
message: string
data: T
}
// ===== 分页 =====
export interface PageResult<T> {
items: T[]
nextCursor: string | null
hasMore: boolean
}
// ===== Like 结果 =====
export interface LikeResult {
action: 'liked'
mutual: boolean
mutualMatch?: boolean
matchCreated?: boolean
matchedConversationId?: string
}
// ===== 通知 =====
export interface Notification {
id: string
userId: string
type: string
title: string
content: string
targetType: string | null
targetId: string | null
isRead: boolean
createdAt: string
}