From d691648916fae1326d0847414e523f21da2f518d Mon Sep 17 00:00:00 2001 From: zhaoxiaorong Date: Fri, 11 Apr 2025 17:53:50 +0800 Subject: [PATCH] fix --- oplog/new.go | 9 +++------ oplog/types.go | 3 +++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/oplog/new.go b/oplog/new.go index 8393f3f..9b732fb 100644 --- a/oplog/new.go +++ b/oplog/new.go @@ -6,15 +6,12 @@ import ( "net/http" ) -func New(endpoint string, data []*LogItem) error { +func New(endpoint string, data LogRequest) error { go PostLog(data, endpoint) return nil } -func PostLog(data []*LogItem, endpoint string) (resp *http.Response, err error) { - request := map[string]any{ - "data": data, - } - jsonBytes, err := json.Marshal(request) +func PostLog(data LogRequest, endpoint string) (resp *http.Response, err error) { + jsonBytes, err := json.Marshal(data) if err != nil { return nil, err } diff --git a/oplog/types.go b/oplog/types.go index 1851c58..dd93a77 100644 --- a/oplog/types.go +++ b/oplog/types.go @@ -1,5 +1,8 @@ package oplog +type LogRequest struct { + Data []*LogItem `json:"data"` +} type LogItem struct { OpID uint `json:"op_id"` OpName string `json:"op_name"`