removeAppInfoLogic.go 784 B

1234567891011121314151617181920212223242526272829303132333435
  1. package logic
  2. import (
  3. "context"
  4. "GtDataStore/app/cmd/organization/internal/svc"
  5. "GtDataStore/app/cmd/organization/pb"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type RemoveAppInfoLogic struct {
  9. ctx context.Context
  10. svcCtx *svc.ServiceContext
  11. logx.Logger
  12. }
  13. func NewRemoveAppInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RemoveAppInfoLogic {
  14. return &RemoveAppInfoLogic{
  15. ctx: ctx,
  16. svcCtx: svcCtx,
  17. Logger: logx.WithContext(ctx),
  18. }
  19. }
  20. func (l *RemoveAppInfoLogic) RemoveAppInfo(in *pb.RemoveAppInfoReq) (*pb.RemoveAppInfoResp, error) {
  21. appInfo, err := l.svcCtx.AppInfo.FindOneByAppName(l.ctx, in.AppName)
  22. if err != nil {
  23. return nil, err
  24. }
  25. err = l.svcCtx.AppInfo.Delete(l.ctx, appInfo.Id)
  26. return &pb.RemoveAppInfoResp{Ok: err == nil}, nil
  27. }