36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
modentity "spark-server/internal/module/moderation/entity"
|
|
)
|
|
|
|
type HitRow struct {
|
|
ID int64 `gorm:"column:id;primaryKey"`
|
|
UserID int64 `gorm:"column:user_id"`
|
|
ConversationID int64 `gorm:"column:conversation_id"`
|
|
WordID int64 `gorm:"column:word_id"`
|
|
Category int8 `gorm:"column:category"`
|
|
Action int8 `gorm:"column:action"`
|
|
Excerpt string `gorm:"column:excerpt"`
|
|
RealIP string `gorm:"column:real_ip"`
|
|
CreatedAt time.Time `gorm:"column:created_at"`
|
|
}
|
|
|
|
func (HitRow) TableName() string { return "t_sensitive_hits" }
|
|
|
|
func hitFromEntity(id int64, userID, convID int64, h modentity.HitMatch, realIP string, at time.Time) HitRow {
|
|
return HitRow{
|
|
ID: id,
|
|
UserID: userID,
|
|
ConversationID: convID,
|
|
WordID: h.WordID,
|
|
Category: int8(h.Category),
|
|
Action: int8(h.Action),
|
|
Excerpt: h.Excerpt,
|
|
RealIP: realIP,
|
|
CreatedAt: at,
|
|
}
|
|
}
|