收藏夹列表
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
- [ ] 從caddy日誌收集用戶訪問目標數據時間
|
- [ ] 從caddy日誌收集用戶訪問目標數據時間
|
||||||
- [ ] 計算指標作爲API提供輸出
|
- [ ] 計算指標作爲API提供輸出
|
||||||
- [ ] 數據與指標統覽後臺
|
- [ ] 數據與指標統覽後臺
|
||||||
- [ ] 游戏 作品 文章 收藏夹 分别添加喜欢数点赞数是否喜欢是否点赞字段
|
- [x] 游戏 作品 文章 收藏夹 分别添加喜欢数点赞数是否喜欢是否点赞字段
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -34,11 +34,11 @@ var CollectionItems = &graphql.Field{
|
|||||||
Description: "收藏列表",
|
Description: "收藏列表",
|
||||||
Type: graphql.NewObject(graphql.ObjectConfig{
|
Type: graphql.NewObject(graphql.ObjectConfig{
|
||||||
Name: "CollectConnection",
|
Name: "CollectConnection",
|
||||||
Description: "条件筛选收藏列表",
|
Description: "条件筛选收藏夹列表",
|
||||||
Fields: graphql.Fields{
|
Fields: graphql.Fields{
|
||||||
"list": &graphql.Field{Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
|
"list": &graphql.Field{Type: graphql.NewList(graphql.NewObject(graphql.ObjectConfig{
|
||||||
Name: "collection",
|
Name: "collection",
|
||||||
Description: "收藏",
|
Description: "收藏夹",
|
||||||
Fields: graphql.Fields{
|
Fields: graphql.Fields{
|
||||||
"id": &graphql.Field{Type: graphql.Int, Description: "ID"},
|
"id": &graphql.Field{Type: graphql.Int, Description: "ID"},
|
||||||
"type": &graphql.Field{Type: graphql.Int, Description: "类型"},
|
"type": &graphql.Field{Type: graphql.Int, Description: "类型"},
|
||||||
@@ -52,8 +52,8 @@ var CollectionItems = &graphql.Field{
|
|||||||
"fan": &graphql.Field{Type: graphql.Boolean, Description: "当前用户是否关注"},
|
"fan": &graphql.Field{Type: graphql.Boolean, Description: "当前用户是否关注"},
|
||||||
"user": &graphql.Field{Type: userType, Description: "用户"},
|
"user": &graphql.Field{Type: userType, Description: "用户"},
|
||||||
},
|
},
|
||||||
})), Description: "收藏列表"},
|
})), Description: "收藏夹列表"},
|
||||||
"total": &graphql.Field{Type: graphql.Int, Description: "收藏总数"},
|
"total": &graphql.Field{Type: graphql.Int, Description: "收藏夹总数"},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Args: graphql.FieldConfigArgument{
|
Args: graphql.FieldConfigArgument{
|
||||||
@@ -82,6 +82,7 @@ var CollectionItems = &graphql.Field{
|
|||||||
Column: clause.Column{Name: p.Args["sort"].(string)},
|
Column: clause.Column{Name: p.Args["sort"].(string)},
|
||||||
Desc: p.Args["order"].(string) == "DESC",
|
Desc: p.Args["order"].(string) == "DESC",
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := db.Limit(limit).Preload("User").Order(order).Find(&collects).Error; err != nil {
|
if err := db.Limit(limit).Preload("User").Order(order).Find(&collects).Error; err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Reference in New Issue
Block a user