114 lines
3.1 KiB
Go
114 lines
3.1 KiB
Go
// Package cp 定义 CP/兄弟/姐妹关系的领域事实和值对象。
|
|
package cp
|
|
|
|
const (
|
|
RelationTypeCP = "cp"
|
|
RelationTypeBrother = "brother"
|
|
RelationTypeSister = "sister"
|
|
|
|
ApplicationStatusPending = "pending"
|
|
ApplicationStatusAccepted = "accepted"
|
|
ApplicationStatusRejected = "rejected"
|
|
ApplicationStatusExpired = "expired"
|
|
ApplicationStatusBlocked = "blocked"
|
|
|
|
RelationshipStatusActive = "active"
|
|
RelationshipStatusEnded = "ended"
|
|
|
|
GiftTypeCodeCP = "cp"
|
|
|
|
EventTypeApplicationCreated = "UserCPApplicationCreated"
|
|
EventTypeApplicationAccepted = "UserCPApplicationAccepted"
|
|
EventTypeApplicationRejected = "UserCPApplicationRejected"
|
|
EventTypeRelationshipCreated = "UserCPRelationshipCreated"
|
|
EventTypeRelationshipIntimacyChanged = "UserCPRelationshipIntimacyChanged"
|
|
EventTypeRelationshipLevelUp = "UserCPRelationshipLevelUp"
|
|
)
|
|
|
|
// UserProfile 是 CP 申请和关系展示用的用户快照。
|
|
type UserProfile struct {
|
|
UserID int64
|
|
DisplayUserID string
|
|
Username string
|
|
Avatar string
|
|
}
|
|
|
|
// GiftSnapshot 固化触发申请或亲密值增长的礼物展示信息。
|
|
type GiftSnapshot struct {
|
|
GiftID string
|
|
GiftName string
|
|
GiftIconURL string
|
|
GiftAnimationURL string
|
|
GiftCount int32
|
|
GiftValue int64
|
|
BillingReceiptID string
|
|
}
|
|
|
|
// Application 表达一次关系申请,只有 target 用户可以处理 pending 状态。
|
|
type Application struct {
|
|
ApplicationID string
|
|
RelationType string
|
|
Status string
|
|
Requester UserProfile
|
|
Target UserProfile
|
|
RoomID string
|
|
RoomRegionID int64
|
|
Gift GiftSnapshot
|
|
CreatedAtMS int64
|
|
UpdatedAtMS int64
|
|
ExpiresAtMS int64
|
|
DecidedAtMS int64
|
|
SourceEventID string
|
|
SourceCommandID string
|
|
}
|
|
|
|
// Relationship 表达 A/B 已建立的一种 active 关系;展示时由 service 填充 me/partner。
|
|
type Relationship struct {
|
|
RelationshipID string
|
|
RelationType string
|
|
Status string
|
|
UserAID int64
|
|
UserBID int64
|
|
Me UserProfile
|
|
Partner UserProfile
|
|
IntimacyValue int64
|
|
Level int32
|
|
CurrentLevelThreshold int64
|
|
NextLevelThreshold int64
|
|
NeededForNextLevel int64
|
|
LevelProgressPercent int32
|
|
MaxLevel bool
|
|
SourceApplicationID string
|
|
FormedAtMS int64
|
|
UpdatedAtMS int64
|
|
}
|
|
|
|
// GiftEvent 是 room outbox 中 RoomGiftSent 转换后的 CP 关系消费输入。
|
|
type GiftEvent struct {
|
|
AppCode string
|
|
EventID string
|
|
RoomID string
|
|
RoomVersion int64
|
|
OccurredAtMS int64
|
|
SenderUserID int64
|
|
TargetUserID int64
|
|
GiftID string
|
|
GiftCount int32
|
|
GiftValue int64
|
|
BillingReceiptID string
|
|
VisibleRegionID int64
|
|
CommandID string
|
|
GiftTypeCode string
|
|
CPRelationType string
|
|
GiftName string
|
|
GiftIconURL string
|
|
GiftAnimationURL string
|
|
}
|
|
|
|
// ConsumeResult 汇总一次送礼事件对 CP 领域产生的变化。
|
|
type ConsumeResult struct {
|
|
Consumed bool
|
|
Application Application
|
|
Relationship Relationship
|
|
}
|