增加 emoji 表情计数字段

This commit is contained in:
2024-12-21 11:09:56 +08:00
parent a8d1748fc9
commit d0fb0a0c33
4 changed files with 41 additions and 1 deletions

View File

@@ -27,6 +27,11 @@ type Article struct {
PraiseCount int `json:"praise_count" gorm:"column:praise_num"`
CreateTime time.Time `json:"create_time" db:"create_time"`
UpdateTime time.Time `json:"update_time" db:"update_time"`
Emoji1 int `json:"emoji1"`
Emoji2 int `json:"emoji2"`
Emoji3 int `json:"emoji3"`
Emoji4 int `json:"emoji4"`
Emoji5 int `json:"emoji5"`
}
func (Article) TableName() string {
@@ -50,6 +55,11 @@ var articleType = graphql.NewObject(graphql.ObjectConfig{
"collect": &graphql.Field{Type: graphql.Boolean, Description: "当前用户是否收藏"},
"praise_count": &graphql.Field{Type: graphql.Int, Description: "点赞数"},
"collect_count": &graphql.Field{Type: graphql.Int, Description: "收藏数"},
"emoji1": &graphql.Field{Type: graphql.Int, Description: "表情1数量"},
"emoji2": &graphql.Field{Type: graphql.Int, Description: "表情2数量"},
"emoji3": &graphql.Field{Type: graphql.Int, Description: "表情3数量"},
"emoji4": &graphql.Field{Type: graphql.Int, Description: "表情4数量"},
"emoji5": &graphql.Field{Type: graphql.Int, Description: "表情5数量"},
},
})

View File

@@ -33,6 +33,11 @@ type Game struct {
TextList []string `json:"text_list" gorm:"-"`
CreateTime time.Time `json:"create_time"`
UpdateTime time.Time `json:"update_time"`
Emoji1 int `json:"emoji1"`
Emoji2 int `json:"emoji2"`
Emoji3 int `json:"emoji3"`
Emoji4 int `json:"emoji4"`
Emoji5 int `json:"emoji5"`
}
func (Game) TableName() string {
@@ -60,6 +65,11 @@ var gameType = graphql.NewObject(graphql.ObjectConfig{
"collect_count": &graphql.Field{Type: graphql.Int, Description: "收藏数"},
"text_count": &graphql.Field{Type: graphql.Int, Description: "文字数量"},
"text_list": &graphql.Field{Type: graphql.NewList(graphql.String), Description: "文字列表"},
"emoji1": &graphql.Field{Type: graphql.Int, Description: "表情1数量"},
"emoji2": &graphql.Field{Type: graphql.Int, Description: "表情2数量"},
"emoji3": &graphql.Field{Type: graphql.Int, Description: "表情3数量"},
"emoji4": &graphql.Field{Type: graphql.Int, Description: "表情4数量"},
"emoji5": &graphql.Field{Type: graphql.Int, Description: "表情5数量"},
},
})

View File

@@ -37,6 +37,11 @@ type Image struct {
User User `json:"user" gorm:"foreignKey:UserID"`
Article Article `json:"article" gorm:"foreignKey:ArticleID"`
Activity bool `json:"activity"`
Emoji1 int `json:"emoji1"`
Emoji2 int `json:"emoji2"`
Emoji3 int `json:"emoji3"`
Emoji4 int `json:"emoji4"`
Emoji5 int `json:"emoji5"`
}
func (Image) TableName() string {
@@ -150,7 +155,12 @@ var imageType = graphql.NewObject(graphql.ObjectConfig{
return p.Source.(Image).Text, nil
},
},
"user": &graphql.Field{Type: userType, Description: "图像所属用户"},
"user": &graphql.Field{Type: userType, Description: "图像所属用户"},
"emoji1": &graphql.Field{Type: graphql.Int, Description: "表情1数量"},
"emoji2": &graphql.Field{Type: graphql.Int, Description: "表情2数量"},
"emoji3": &graphql.Field{Type: graphql.Int, Description: "表情3数量"},
"emoji4": &graphql.Field{Type: graphql.Int, Description: "表情4数量"},
"emoji5": &graphql.Field{Type: graphql.Int, Description: "表情5数量"},
},
})

View File

@@ -29,6 +29,11 @@ type Work struct {
PraiseCount int `json:"praise_count" gorm:"column:praise_num"`
CreateTime time.Time `json:"create_time"`
UpdateTime time.Time `json:"update_time"`
Emoji1 int `json:"emoji1"`
Emoji2 int `json:"emoji2"`
Emoji3 int `json:"emoji3"`
Emoji4 int `json:"emoji4"`
Emoji5 int `json:"emoji5"`
}
func (Work) TableName() string {
@@ -49,6 +54,11 @@ var workType = graphql.NewObject(graphql.ObjectConfig{
"collect": &graphql.Field{Type: graphql.Boolean, Description: "当前用户是否收藏"},
"praise_count": &graphql.Field{Type: graphql.Int, Description: "点赞数"},
"collect_count": &graphql.Field{Type: graphql.Int, Description: "收藏数"},
"emoji1": &graphql.Field{Type: graphql.Int, Description: "表情1数量"},
"emoji2": &graphql.Field{Type: graphql.Int, Description: "表情2数量"},
"emoji3": &graphql.Field{Type: graphql.Int, Description: "表情3数量"},
"emoji4": &graphql.Field{Type: graphql.Int, Description: "表情4数量"},
"emoji5": &graphql.Field{Type: graphql.Int, Description: "表情5数量"},
},
})