Files
bl/modules/player/model/FRIEND.go
昔念 07d25b3e96 ```
feat(friend): 添加好友系统功能实现

完善好友管理功能,包括添加好友、回复好友请求、删除好友等操作,
同时优化了相关数据结构和接口定义。

BREAKING CHANGE: 调整了黑名单数据结构,将BlackInfo从结构体改为uint32数组
```
2026-01-20 06:15:55 +08:00

39 lines
858 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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{})
}