disableAppInfoLogic.go 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 DisableAppInfoLogic struct {
  9. ctx context.Context
  10. svcCtx *svc.ServiceContext
  11. logx.Logger
  12. }
  13. func NewDisableAppInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DisableAppInfoLogic {
  14. return &DisableAppInfoLogic{
  15. ctx: ctx,
  16. svcCtx: svcCtx,
  17. Logger: logx.WithContext(ctx),
  18. }
  19. }
  20. func (l *DisableAppInfoLogic) DisableAppInfo(in *pb.DisableAppInfoReq) (*pb.DisableAppInfoResp, error) {
  21. appInfo, err := l.svcCtx.AppInfo.FindOneByAppName(l.ctx, in.AppName)
  22. if err != nil {
  23. return nil, err
  24. }
  25. if appInfo.Status != 1 {
  26. appInfo.Status = 1
  27. err = l.svcCtx.AppInfo.Update(l.ctx, appInfo)
  28. if err != nil {
  29. return nil, err
  30. }
  31. }
  32. return &pb.DisableAppInfoResp{Ok: true}, nil
  33. }