游戏筛选:按精选
This commit is contained in:
		@@ -22,6 +22,7 @@ type Game struct {
 | 
				
			|||||||
	Device       string    `json:"device"`
 | 
						Device       string    `json:"device"`
 | 
				
			||||||
	Orientation  string    `json:"orientation"`
 | 
						Orientation  string    `json:"orientation"`
 | 
				
			||||||
	Tags         string    `json:"tags"`
 | 
						Tags         string    `json:"tags"`
 | 
				
			||||||
 | 
						Rank         string    `json:"rank"`
 | 
				
			||||||
	UserId       int       `json:"user_id"`
 | 
						UserId       int       `json:"user_id"`
 | 
				
			||||||
	Content      string    `json:"content"`
 | 
						Content      string    `json:"content"`
 | 
				
			||||||
	CategoryID   int       `json:"category_id"`
 | 
						CategoryID   int       `json:"category_id"`
 | 
				
			||||||
@@ -58,6 +59,7 @@ var gameType = graphql.NewObject(graphql.ObjectConfig{
 | 
				
			|||||||
		"title":         &graphql.Field{Type: graphql.String, Description: "游戏标题"},
 | 
							"title":         &graphql.Field{Type: graphql.String, Description: "游戏标题"},
 | 
				
			||||||
		"era":           &graphql.Field{Type: graphql.String, Description: "游戏上线年份"},
 | 
							"era":           &graphql.Field{Type: graphql.String, Description: "游戏上线年份"},
 | 
				
			||||||
		"tags":          &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: "游戏风格"},
 | 
							"style":         &graphql.Field{Type: graphql.String, Description: "游戏风格"},
 | 
				
			||||||
		"device":        &graphql.Field{Type: graphql.String, Description: "游戏平台"},
 | 
							"device":        &graphql.Field{Type: graphql.String, Description: "游戏平台"},
 | 
				
			||||||
		"orientation":   &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})
 | 
							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 {
 | 
								if p.Args[format] != nil {
 | 
				
			||||||
				query = query.Where(goqu.C(format).Eq(p.Args[format]))
 | 
									query = query.Where(goqu.C(format).Eq(p.Args[format]))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user