Skip to content

Commit

Permalink
Merge pull request #23 from mylxsw/feature/group-chat
Browse files Browse the repository at this point in the history
v1.0.7
  • Loading branch information
mylxsw authored Oct 29, 2023
2 parents baaf2a7 + 6d478a3 commit 48e4a3b
Show file tree
Hide file tree
Showing 69 changed files with 2,546 additions and 1,330 deletions.
2 changes: 1 addition & 1 deletion api/controllers/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

const (
ErrQuotaNotEnough = "您的配额已用完,请续费后再试"
ErrQuotaNotEnough = "智慧果不足,请充值后再试"
ErrInvalidModel = "无效的模型"
ErrInvalidRequest = "请求参数错误"
ErrInternalError = "服务器故障,请稍后再试"
Expand Down
11 changes: 10 additions & 1 deletion api/controllers/creative.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package controllers

import (
"context"
"github.com/mylxsw/aidea-server/api/auth"
"github.com/mylxsw/aidea-server/internal/helper"
"net/http"
"strconv"

Expand Down Expand Up @@ -58,7 +60,7 @@ func (ctl *CreativeController) Gallery(ctx context.Context, webCtx web.Context)
}

// GalleryItem 作品图库详情
func (ctl *CreativeController) GalleryItem(ctx context.Context, webCtx web.Context) web.Response {
func (ctl *CreativeController) GalleryItem(ctx context.Context, webCtx web.Context, user *auth.UserOptional, client *auth.ClientInfo) web.Response {
id, err := strconv.Atoi(webCtx.PathVar("id"))
if err != nil {
return webCtx.JSONError(common.Text(webCtx, ctl.translater, common.ErrInvalidRequest), http.StatusBadRequest)
Expand All @@ -69,5 +71,12 @@ func (ctl *CreativeController) GalleryItem(ctx context.Context, webCtx web.Conte
return webCtx.JSONError(common.Text(webCtx, ctl.translater, common.ErrInternalError), http.StatusInternalServerError)
}

if helper.VersionNewer(client.Version, "1.0.6") {
return webCtx.JSON(web.M{
"data": item,
"is_internal_user": user.User != nil && user.User.InternalUser(),
})
}

return webCtx.JSON(item)
}
Loading

0 comments on commit 48e4a3b

Please sign in to comment.