From e75c9a0304628e328358fb58af7d960623d5c942 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:38:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=89=E8=A3=85=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=BA=94=E7=94=A8=E5=A2=9E=E5=8A=A0=E4=B8=8E=E8=BF=9C?= =?UTF-8?q?=E7=A8=8B=E6=95=B0=E6=8D=AE=E5=BA=93=E5=90=8D=E7=A7=B0=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=20(#2212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/app.go | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/backend/app/service/app.go b/backend/app/service/app.go index 5f75cebd3..c297b3218 100644 --- a/backend/app/service/app.go +++ b/backend/app/service/app.go @@ -275,6 +275,20 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) ( appDetail model.AppDetail app model.App ) + appDetail, err = appDetailRepo.GetFirst(commonRepo.WithByID(req.AppDetailId)) + if err != nil { + return + } + app, err = appRepo.GetFirst(commonRepo.WithByID(appDetail.AppId)) + if err != nil { + return + } + if DatabaseKeys[app.Key] { + if existDatabases, _ := databaseRepo.GetList(commonRepo.WithByName(req.Name)); len(existDatabases) > 0 { + err = buserr.New(constant.ErrRemoteExist) + return + } + } for key := range req.Params { if !strings.Contains(key, "PANEL_APP_PORT") { continue @@ -292,14 +306,6 @@ func (a AppService) Install(ctx context.Context, req request.AppInstallCreate) ( } } - appDetail, err = appDetailRepo.GetFirst(commonRepo.WithByID(req.AppDetailId)) - if err != nil { - return - } - app, err = appRepo.GetFirst(commonRepo.WithByID(appDetail.AppId)) - if err != nil { - return - } if err = checkRequiredAndLimit(app); err != nil { return }