Browse Source

提交代码

tags/v1.22.4.1^2
ychao_1983 3 years ago
parent
commit
854ee2683b
1 changed files with 14 additions and 12 deletions
  1. +14
    -12
      routers/repo/cloudbrain.go

+ 14
- 12
routers/repo/cloudbrain.go View File

@@ -813,10 +813,10 @@ func CloudBrainShowModels(ctx *context.Context) {
}

func GetPublicImages(ctx *context.Context) {
uid := getUID(ctx)
opts := models.SearchImageOptions{
IncludePublicOnly: true,
UID: -1,
UID: uid,
Keyword: ctx.Query("q"),
Topics: ctx.Query("topic"),
IncludeOfficialOnly: ctx.QueryBool("recommend"),
@@ -828,10 +828,7 @@ func GetPublicImages(ctx *context.Context) {
}

func GetCustomImages(ctx *context.Context) {
var uid int64 = -1
if ctx.IsSigned {
uid = ctx.User.ID
}
uid := getUID(ctx)
opts := models.SearchImageOptions{
UID: uid,
IncludeOwnerOnly: true,
@@ -844,10 +841,7 @@ func GetCustomImages(ctx *context.Context) {
}
func GetStarImages(ctx *context.Context) {

var uid int64 = -1
if ctx.IsSigned {
uid = ctx.User.ID
}
uid := getUID(ctx)
opts := models.SearchImageOptions{
UID: uid,
IncludeStarByMe: true,
@@ -859,10 +853,18 @@ func GetStarImages(ctx *context.Context) {

}

func GetAllImages(ctx *context.Context) {
func getUID(ctx *context.Context) int64 {
var uid int64 = -1
if ctx.IsSigned {
uid = ctx.User.ID
}
return uid
}

func GetAllImages(ctx *context.Context) {
uid := getUID(ctx)
opts := models.SearchImageOptions{
UID: -1,
UID: uid,
Keyword: ctx.Query("q"),
Topics: ctx.Query("topic"),
SearchOrderBy: "id desc",


Loading…
Cancel
Save