修改应用接口
This commit is contained in:
parent
802dd213ec
commit
62d5b5f9b3
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue