From 62d5b5f9b3d98a842e0c8bbdc5eeed1cb7ab5861 Mon Sep 17 00:00:00 2001 From: guosl Date: Mon, 29 Jul 2024 17:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=94=E7=94=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/repo/application.go | 2 +- internal/service/application/application.go | 4 ++-- internal/service/application/interface.go | 2 +- server/application/application.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/repo/application.go b/internal/repo/application.go index 191fc3d..4fecd19 100644 --- a/internal/repo/application.go +++ b/internal/repo/application.go @@ -66,7 +66,7 @@ func (u *applicationRepoS) SaveApplication(ctx context.Context, application Appl return fmt.Errorf("错误应用id:%d", application.ID) } - return u.db.Save(application).Error + return u.db.Model(application).Where("id",application.ID).Updates(map[string]interface{}{"secret":application.Secret,"name":application.Name,"description":application.Description}).Error } func (u *applicationRepoS) CreateApplication(ctx context.Context, application Application) error { diff --git a/internal/service/application/application.go b/internal/service/application/application.go index ca15883..9fb5f98 100644 --- a/internal/service/application/application.go +++ b/internal/service/application/application.go @@ -174,14 +174,14 @@ func (a *applicationService) DeleteMenu(ctx context.Context, info *appModel.DelM return err } -func (a *applicationService) Modify(ctx context.Context, info *appModel.Application) error { +func (a *applicationService) Modify(ctx context.Context, info *appModel.ApplicationInfo) error { dbApp := repo.Application{} err := copier.Copy(&dbApp, info) if err != nil { return err } - app, err := a.appRepo.GetAppByCode(ctx, info.Info.Code) + app, err := a.appRepo.GetAppByCode(ctx, info.Code) if err != nil { return err } diff --git a/internal/service/application/interface.go b/internal/service/application/interface.go index d0fbbd2..d4037fb 100644 --- a/internal/service/application/interface.go +++ b/internal/service/application/interface.go @@ -12,5 +12,5 @@ type ApplicationService interface { GetApp(ctx context.Context, req *appModel.GetAppReq) (app appModel.ApplicationInfo, err error) Search(ctx context.Context, query *appModel.Query) (rsp appModel.List, err error) Menus(ctx context.Context, info *appModel.MenusReq) (rsp []appModel.Menu, err error) - Modify(ctx context.Context, info *appModel.Application) error + Modify(ctx context.Context, info *appModel.ApplicationInfo) error } diff --git a/server/application/application.go b/server/application/application.go index 47b18b2..e5ff34e 100644 --- a/server/application/application.go +++ b/server/application/application.go @@ -35,7 +35,7 @@ func RegisterRoute(api *gin.RouterGroup) { api.DELETE("/delete", ginUtil.WrapNoRsp(server.DelApp)) api.GET("/search", ginUtil.Wrap(server.Search)) api.GET("/application", ginUtil.Wrap(server.Get)) - api.GET("/modify", ginUtil.WrapNoRsp(server.Modify)) + api.POST("/modify", ginUtil.WrapNoRsp(server.Modify)) } func (u *ApplicationServer) Create(ctx context.Context, req *appModel.CreateReq) (err error) { @@ -60,6 +60,6 @@ func (u *ApplicationServer) DelApp(ctx context.Context, req *appModel.DeleteAppR return u.applicationService.Delete(ctx, req) } -func (u *ApplicationServer) Modify(ctx context.Context, info *appModel.Application) error { +func (u *ApplicationServer) Modify(ctx context.Context, info *appModel.ApplicationInfo) error { return u.applicationService.Modify(ctx, info) }