按设备筛选游戏截图
This commit is contained in:
		@@ -126,6 +126,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
			"id":          &graphql.Field{Type: graphql.Int, Description: "ID"},
 | 
								"id":          &graphql.Field{Type: graphql.Int, Description: "ID"},
 | 
				
			||||||
			"title":       &graphql.Field{Type: graphql.String, Description: "标题"},
 | 
								"title":       &graphql.Field{Type: graphql.String, Description: "标题"},
 | 
				
			||||||
			"orientation": &graphql.Field{Type: graphql.String, Description: "方向"},
 | 
								"orientation": &graphql.Field{Type: graphql.String, Description: "方向"},
 | 
				
			||||||
 | 
								"device":      &graphql.Field{Type: graphql.String, Description: "设备"},
 | 
				
			||||||
			"tags":        &graphql.Field{Type: graphql.String, Description: "标签"},
 | 
								"tags":        &graphql.Field{Type: graphql.String, Description: "标签"},
 | 
				
			||||||
			"user":        &graphql.Field{Type: user, Description: "所属用户"},
 | 
								"user":        &graphql.Field{Type: user, Description: "所属用户"},
 | 
				
			||||||
			"create_time": &graphql.Field{Type: graphql.DateTime, Description: "创建时间"},
 | 
								"create_time": &graphql.Field{Type: graphql.DateTime, Description: "创建时间"},
 | 
				
			||||||
@@ -394,6 +395,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
				},
 | 
									},
 | 
				
			||||||
			}),
 | 
								}),
 | 
				
			||||||
			Args: graphql.FieldConfigArgument{
 | 
								Args: graphql.FieldConfigArgument{
 | 
				
			||||||
 | 
									"device":        &graphql.ArgumentConfig{Type: graphql.String, Description: "游戏设备"},
 | 
				
			||||||
				"sort":          &graphql.ArgumentConfig{Type: graphql.String, Description: "排序方法"},
 | 
									"sort":          &graphql.ArgumentConfig{Type: graphql.String, Description: "排序方法"},
 | 
				
			||||||
				"order":         &graphql.ArgumentConfig{Type: orderType, Description: "排序方向", DefaultValue: "ASC"},
 | 
									"order":         &graphql.ArgumentConfig{Type: orderType, Description: "排序方向", DefaultValue: "ASC"},
 | 
				
			||||||
				"orientation":   &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选横屏竖屏图像"},
 | 
									"orientation":   &graphql.ArgumentConfig{Type: graphql.String, Description: "筛选横屏竖屏图像"},
 | 
				
			||||||
@@ -568,6 +570,11 @@ func NewSchema(config Config) (graphql.Schema, error) {
 | 
				
			|||||||
					query.Where("article_orientation = ?", args.Orientation)
 | 
										query.Where("article_orientation = ?", args.Orientation)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									// 数据库中筛选:游戏设备
 | 
				
			||||||
 | 
									if p.Args["device"] != nil {
 | 
				
			||||||
 | 
										query = query.Joins("JOIN web_article ON web_images.article_id = web_article.id AND web_article.device = ?", p.Args["device"])
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// 排序
 | 
									// 排序
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// 截取:取交集
 | 
									// 截取:取交集
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -113,6 +113,7 @@ type Article struct {
 | 
				
			|||||||
	ID          int       `json:"id"          db:"id" gorm:"primaryKey"`
 | 
						ID          int       `json:"id"          db:"id" gorm:"primaryKey"`
 | 
				
			||||||
	Title       string    `json:"title"       db:"title"`
 | 
						Title       string    `json:"title"       db:"title"`
 | 
				
			||||||
	Orientation string    `json:"orientation" db:"orientation"`
 | 
						Orientation string    `json:"orientation" db:"orientation"`
 | 
				
			||||||
 | 
						Device      string    `json:"device"      db:"device"`
 | 
				
			||||||
	Tags        string    `json:"tags"        db:"tags"`
 | 
						Tags        string    `json:"tags"        db:"tags"`
 | 
				
			||||||
	UserId      int       `json:"user_id"     db:"user_id"`
 | 
						UserId      int       `json:"user_id"     db:"user_id"`
 | 
				
			||||||
	User        User      `json:"user"        gorm:"foreignKey:UserId"`
 | 
						User        User      `json:"user"        gorm:"foreignKey:UserId"`
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user