package blockchainservicelogic import ( "blockchain/internal/domain/usecase" "context" "time" "blockchain/gen_result/pb/code.30cm.net/digimon/app-cloudep-blockchain" "blockchain/internal/svc" "github.com/zeromicro/go-zero/core/logx" ) type GetHistoryKlineDataLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewGetHistoryKlineDataLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetHistoryKlineDataLogic { return &GetHistoryKlineDataLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *GetHistoryKlineDataLogic) GetHistoryKlineData(in *app_cloudep_blockchain.HistoryReq) (*app_cloudep_blockchain.OKResp, error) { go func() { st, _ := time.Parse(time.RFC3339, in.GetStartTime()) et, _ := time.Parse(time.RFC3339, in.GetEndTime()) _ = l.svcCtx.BinanceDataSource.UpsertKline(context.Background(), usecase.QueryKline{ Symbol: in.GetSymbol(), Interval: in.GetInterval(), StartTime: st.UnixNano(), EndTime: et.UnixNano(), }) return }() return &app_cloudep_blockchain.OKResp{}, nil }