防止重复
This commit is contained in:
25
api/image.go
25
api/image.go
@@ -105,7 +105,6 @@ var imageType = graphql.NewObject(graphql.ObjectConfig{
|
||||
fmt.Println(user_id, p.Source.(Image).ID, praise, "E", err)
|
||||
return false, nil
|
||||
}
|
||||
//fmt.Println(user_id, p.Source.(Image).ID, praise)
|
||||
if praise > 0 {
|
||||
return true, nil
|
||||
}
|
||||
@@ -536,24 +535,6 @@ var ImageItems = &graphql.Field{
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println(color, r, g, b, precision)
|
||||
//query = query.Where(goqu.Or(
|
||||
// goqu.And(
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_r", 0)).Gt(r-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_r", 0)).Lt(r+precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_g", 0)).Gt(g-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_g", 0)).Lt(g+precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_b", 0)).Gt(b-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_b", 0)).Lt(b+precision),
|
||||
// ),
|
||||
// goqu.And(
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_r", 1)).Gt(r-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_r", 1)).Lt(r+precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_g", 1)).Gt(g-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_g", 1)).Lt(g+precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_b", 1)).Gt(b-precision),
|
||||
// goqu.L(fmt.Sprintf("web_images.color_%d_b", 1)).Lt(b+precision),
|
||||
// ),
|
||||
//))
|
||||
|
||||
query1, _, _ := goqu.Dialect("mysql").From("web_images").Select("id").Where(
|
||||
goqu.And(
|
||||
@@ -602,12 +583,6 @@ var ImageItems = &graphql.Field{
|
||||
)).As("row_num"))
|
||||
}
|
||||
|
||||
//// 针对排行榜优化, 减少结果集
|
||||
//if p.Args["sort"] != nil && p.Args["sort"].(string) == "day_rank" {
|
||||
// fmt.Println("针对排行榜优化, 减少结果集 day_rank > 0")
|
||||
// query = query.Where(goqu.L("day_rank > 0"))
|
||||
//}
|
||||
|
||||
// 图像按点赞顺序排序 p.Args["sort"].(string) == "praise_time"
|
||||
if p.Args["praise"] != nil {
|
||||
query = query.Select("web_images.id", goqu.L(
|
||||
|
Reference in New Issue
Block a user