getAppInfoLogic.go 987 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package logic
  2. import (
  3. "GtDataStore/app/cmd/organization/internal/svc"
  4. "GtDataStore/app/cmd/organization/pb"
  5. "context"
  6. "github.com/zeromicro/go-zero/core/logx"
  7. )
  8. type GetAppInfoLogic struct {
  9. ctx context.Context
  10. svcCtx *svc.ServiceContext
  11. logx.Logger
  12. }
  13. func NewGetAppInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetAppInfoLogic {
  14. return &GetAppInfoLogic{
  15. ctx: ctx,
  16. svcCtx: svcCtx,
  17. Logger: logx.WithContext(ctx),
  18. }
  19. }
  20. func (l *GetAppInfoLogic) GetAppInfo(in *pb.GetAppInfoReq) (*pb.GetAppInfoResp, error) {
  21. appInfo, err := l.svcCtx.AppInfo.FindOneByAppName(l.ctx, in.AppName)
  22. if err != nil {
  23. return nil, err
  24. }
  25. return &pb.GetAppInfoResp{AppInfo: &pb.AppInfo{
  26. Id: appInfo.Id,
  27. AppName: appInfo.AppName,
  28. ProjectIds: appInfo.ProjectIds,
  29. Secret: appInfo.Secret,
  30. Status: appInfo.Status,
  31. ExpireAt: appInfo.ExpireAt.Format("2006-01-02 15:04:05"),
  32. CTime: appInfo.MTime.Format("2006-01-02 15:04:05"),
  33. }}, nil
  34. }