39 lines
858 B
Go
39 lines
858 B
Go
|
|
package model
|
|||
|
|
|
|||
|
|
import (
|
|||
|
|
"blazing/cool"
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
// 表名常量
|
|||
|
|
const TableNamePlayerFriend = "player_friend"
|
|||
|
|
|
|||
|
|
// Friend 对应数据库表 player_cdk_log,用于记录CDK兑换日志
|
|||
|
|
type Friend struct {
|
|||
|
|
Base
|
|||
|
|
PlayerID uint64 `gorm:"not null;index:idx_player_friend_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
|||
|
|
Friend []uint32 `gorm:"type:jsonb; comment:'好友列表'" json:"friend"`
|
|||
|
|
Black []uint32 `gorm:"type:jsonb; comment:'黑名单列表'" json:"black"`
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TableName 返回表名
|
|||
|
|
func (*Friend) TableName() string {
|
|||
|
|
return TableNamePlayerFriend
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// GroupName 返回表组名
|
|||
|
|
func (*Friend) GroupName() string {
|
|||
|
|
return "default"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// NewFriend 创建一个新的CDK记录
|
|||
|
|
func NewFriend() *Friend {
|
|||
|
|
return &Friend{
|
|||
|
|
Base: *NewBase(),
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// init 程序启动时自动创建表
|
|||
|
|
func init() {
|
|||
|
|
cool.CreateTable(&Friend{})
|
|||
|
|
}
|