| @@ -51,14 +51,15 @@ type ImageTopicRelation struct { | |||||
| } | } | ||||
| type SearchImageOptions struct { | type SearchImageOptions struct { | ||||
| Keyword string | |||||
| UID int64 | |||||
| IncludePublicOnly bool | |||||
| IncludePrivateOnly bool | |||||
| IncludeStarByMe bool | |||||
| IncludeCustom bool | |||||
| IncludeOwnerOnly bool | |||||
| Topics string | |||||
| Keyword string | |||||
| UID int64 | |||||
| IncludePublicOnly bool | |||||
| IncludeOfficialOnly bool | |||||
| IncludePrivateOnly bool | |||||
| IncludeStarByMe bool | |||||
| IncludeCustom bool | |||||
| IncludeOwnerOnly bool | |||||
| Topics string | |||||
| ListOptions | ListOptions | ||||
| SearchOrderBy | SearchOrderBy | ||||
| } | } | ||||
| @@ -319,6 +320,9 @@ func SearchImageCondition(opts *SearchImageOptions) builder.Cond { | |||||
| cond = cond.And(builder.Eq{"uid": opts.UID}) | cond = cond.And(builder.Eq{"uid": opts.UID}) | ||||
| } | } | ||||
| if opts.IncludeOfficialOnly { | |||||
| cond = cond.And(builder.Eq{"type": RECOMMOND_TYPE}) | |||||
| } | |||||
| if opts.IncludeStarByMe { | if opts.IncludeStarByMe { | ||||
| @@ -798,11 +798,12 @@ func CloudBrainShowModels(ctx *context.Context) { | |||||
| func GetPublicImages(ctx *context.Context) { | func GetPublicImages(ctx *context.Context) { | ||||
| opts := models.SearchImageOptions{ | opts := models.SearchImageOptions{ | ||||
| IncludePrivateOnly: true, | |||||
| UID: -1, | |||||
| Keyword: ctx.Query("q"), | |||||
| Topics: ctx.Query("topic"), | |||||
| SearchOrderBy: "type desc, num_stars desc", | |||||
| IncludePrivateOnly: true, | |||||
| UID: -1, | |||||
| Keyword: ctx.Query("q"), | |||||
| Topics: ctx.Query("topic"), | |||||
| IncludeOfficialOnly: ctx.QueryBool("recommend"), | |||||
| SearchOrderBy: "type desc, num_stars desc", | |||||
| } | } | ||||
| getImages(ctx, &opts) | getImages(ctx, &opts) | ||||