按游戏类型筛选图像
This commit is contained in:
@@ -468,6 +468,16 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
},
|
||||
}),
|
||||
Args: graphql.FieldConfigArgument{
|
||||
"style": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏风格筛选图像"},
|
||||
"device": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏平台筛选图像"},
|
||||
"orientation": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏版式筛选图像"},
|
||||
"era": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏年份筛选图像"},
|
||||
"category_id": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏类型筛选图像(支持多选)"},
|
||||
|
||||
"tags": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏标签筛选图像(支持多选)(主题)"},
|
||||
"paramImagesDescFunc": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏功能筛选图像(支持多选)"},
|
||||
"paramImagesDescMaterial": &graphql.ArgumentConfig{Type: graphql.String, Description: "按游戏材质筛选图像(支持多选)"},
|
||||
|
||||
"color": &graphql.ArgumentConfig{Type: graphql.String, Description: "按主色调筛选图像, 使用十六进制颜色代码(#FF1414)"},
|
||||
"explorer_id": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
|
||||
"collect_id": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中指定收藏夹的"},
|
||||
@@ -484,14 +494,10 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
"collect_count": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中收藏数等于指定值的"},
|
||||
"article_id": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中属于指定文章ID的"},
|
||||
"user_id": &graphql.ArgumentConfig{Type: graphql.Int, Description: "筛选图像中属于指定用户ID的"},
|
||||
"era": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中指定上线年份的"},
|
||||
"device": &graphql.ArgumentConfig{Type: graphql.String, Description: "游戏设备"},
|
||||
"sort": &graphql.ArgumentConfig{Type: graphql.String, Description: "排序方法", DefaultValue: "id"},
|
||||
"orientation": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选横屏竖屏图像"},
|
||||
"content": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定内容的"},
|
||||
"remark": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定备注的"},
|
||||
"description": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定描述的"},
|
||||
"tags": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定标签的"},
|
||||
"rank": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定等级的"},
|
||||
"text": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中含有指定文字的"},
|
||||
"create_time": &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选图像中创建时间等于指定值的"},
|
||||
@@ -626,11 +632,6 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
applyTimeCondition("update_time", p.Args["update_time"].(string))
|
||||
}
|
||||
|
||||
// 数据库中筛选:横屏纵屏
|
||||
if p.Args["orientation"] != nil {
|
||||
query = query.Where(goqu.Ex{"article_orientation": p.Args["orientation"]})
|
||||
}
|
||||
|
||||
// 数据库中筛选:喜欢的截图
|
||||
if p.Args["praise"] != nil {
|
||||
query = query.Join(goqu.T("web_praise"), goqu.On(
|
||||
@@ -663,7 +664,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
))
|
||||
}
|
||||
|
||||
// 数据库中筛选:游戏设备
|
||||
// 按游戏风格筛选图像
|
||||
if p.Args["style"] != nil {
|
||||
query = query.Join(goqu.T("web_article"), goqu.On(
|
||||
goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
|
||||
goqu.I("web_article.style").Eq(p.Args["style"]),
|
||||
))
|
||||
}
|
||||
|
||||
// 按游戏平台筛选图像
|
||||
if p.Args["device"] != nil {
|
||||
query = query.Join(goqu.T("web_article"), goqu.On(
|
||||
goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
|
||||
@@ -671,7 +680,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
))
|
||||
}
|
||||
|
||||
// 数据库中筛选:游戏上线年份
|
||||
// 按游戏版式筛选图像
|
||||
if p.Args["orientation"] != nil {
|
||||
query = query.Join(goqu.T("web_article"), goqu.On(
|
||||
goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
|
||||
goqu.I("web_article.orientation").Eq(p.Args["orientation"]),
|
||||
))
|
||||
}
|
||||
|
||||
// 按游戏年份筛选图像
|
||||
if p.Args["era"] != nil {
|
||||
query = query.Join(goqu.T("web_article"), goqu.On(
|
||||
goqu.I("web_images.article_id").Eq(goqu.I("web_article.id")),
|
||||
@@ -679,6 +696,15 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
))
|
||||
}
|
||||
|
||||
// 按游戏类型筛选图像(逗号分割且去除空格)
|
||||
if p.Args["category_id"] != nil {
|
||||
category_ids := strings.Split(strings.ReplaceAll(p.Args["category_id"].(string), " ", ""), ", ")
|
||||
query = query.Join(goqu.T("web_article_category"), goqu.On(
|
||||
goqu.I("web_images.article_id").Eq(goqu.I("web_article_category.article_id")),
|
||||
goqu.I("web_article_category.category_id").In(category_ids),
|
||||
))
|
||||
}
|
||||
|
||||
// 数据库中筛选:按关注列表
|
||||
if p.Args["follower"] != nil {
|
||||
query = query.Join(goqu.T("web_fans"), goqu.On(
|
||||
|
Reference in New Issue
Block a user