12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package datacenter
- import (
- "GtDataStore/app/cmd/organization/pb"
- "context"
- "github.com/jinzhu/copier"
- "GtDataStore/app/cmd/api/internal/svc"
- "GtDataStore/app/cmd/api/internal/types"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type ItemHistoryDataInfoLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- func NewItemHistoryDataInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ItemHistoryDataInfoLogic {
- return &ItemHistoryDataInfoLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *ItemHistoryDataInfoLogic) ItemHistoryDataInfo(req *types.ItemHistoryDataByTimeResq) (resp *types.MultiAddItemHistoryDataReq, err error) {
- respList := make([]*types.ItemHistoryData, 0)
- dataList, err := l.svcCtx.OrganizationRpc.ItemHistoryDataByTime(l.ctx, &pb.ItemHistoryDataByTimeReq{
- ProjectId: req.ProjectId,
- ItemName: req.ItemName,
- Stime: req.STime,
- Etime: req.ETime,
- })
- if err != nil {
- return nil, err
- }
- for _, line := range dataList.List {
- tmp := &types.ItemHistoryData{}
- _ = copier.Copy(tmp, line)
- respList = append(respList, tmp)
- }
- return &types.MultiAddItemHistoryDataReq{List: respList}, nil
- }
|