游戏筛选:按精选
This commit is contained in:
		@@ -22,6 +22,7 @@ type Game struct {
 | 
			
		||||
	Device       string    `json:"device"`
 | 
			
		||||
	Orientation  string    `json:"orientation"`
 | 
			
		||||
	Tags         string    `json:"tags"`
 | 
			
		||||
	Rank         string    `json:"rank"`
 | 
			
		||||
	UserId       int       `json:"user_id"`
 | 
			
		||||
	Content      string    `json:"content"`
 | 
			
		||||
	CategoryID   int       `json:"category_id"`
 | 
			
		||||
@@ -58,6 +59,7 @@ var gameType = graphql.NewObject(graphql.ObjectConfig{
 | 
			
		||||
		"title":         &graphql.Field{Type: graphql.String, Description: "游戏标题"},
 | 
			
		||||
		"era":           &graphql.Field{Type: graphql.String, Description: "游戏上线年份"},
 | 
			
		||||
		"tags":          &graphql.Field{Type: graphql.String, Description: "游戏标签"},
 | 
			
		||||
		"rank":          &graphql.Field{Type: graphql.String, Description: "游戏精选"},
 | 
			
		||||
		"style":         &graphql.Field{Type: graphql.String, Description: "游戏风格"},
 | 
			
		||||
		"device":        &graphql.Field{Type: graphql.String, Description: "游戏平台"},
 | 
			
		||||
		"orientation":   &graphql.Field{Type: graphql.String, Description: "屏幕方向"},
 | 
			
		||||
@@ -123,7 +125,7 @@ var GameItems = &graphql.Field{
 | 
			
		||||
		var query = goqu.Dialect("mysql").From("web_article").Where(goqu.Ex{"category_top_id": 22})
 | 
			
		||||
 | 
			
		||||
		// 筛选条件
 | 
			
		||||
		for _, format := range []string{"id", "title", "style", "device", "orientation", "era", "category_id", "tags"} {
 | 
			
		||||
		for _, format := range []string{"id", "title", "style", "device", "orientation", "era", "category_id", "tags", "rank"} {
 | 
			
		||||
			if p.Args[format] != nil {
 | 
			
		||||
				query = query.Where(goqu.C(format).Eq(p.Args[format]))
 | 
			
		||||
			}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user