itemHistoryDataInfoLogic.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package dtgateway
  2. import (
  3. "GtDataStore/app/cmd/dtgateway/internal/svc"
  4. "GtDataStore/app/cmd/dtgateway/internal/types"
  5. "GtDataStore/app/cmd/organization/pb"
  6. "GtDataStore/common/xerr"
  7. "context"
  8. "fmt"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type ItemHistoryDataInfoLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewItemHistoryDataInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataInfoLogic {
  17. return &ItemHistoryDataInfoLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *ItemHistoryDataInfoLogic) ItemHistoryDataInfo(req *types.ItemHistoryDataByTimeReq) (resp *types.CommonResponse, err error) {
  24. dataList, err := l.svcCtx.OrganizationRpc.ItemHistoryDataByTime(l.ctx, &pb.ItemHistoryDataByTimeReq{
  25. ProjectId: req.ProjectId,
  26. ItemName: req.ItemName,
  27. Stime: req.STime,
  28. Etime: req.ETime,
  29. })
  30. fmt.Println("rpc:", dataList)
  31. if err != nil {
  32. return nil, err
  33. }
  34. return &types.CommonResponse{
  35. Code: xerr.OK,
  36. Msg: xerr.MapErrMsg(xerr.OK),
  37. Data: dataList,
  38. }, nil
  39. }