fix
This commit is contained in:
parent
8060cdb508
commit
d691648916
|
@ -6,15 +6,12 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func New(endpoint string, data []*LogItem) error {
|
func New(endpoint string, data LogRequest) error {
|
||||||
go PostLog(data, endpoint)
|
go PostLog(data, endpoint)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func PostLog(data []*LogItem, endpoint string) (resp *http.Response, err error) {
|
func PostLog(data LogRequest, endpoint string) (resp *http.Response, err error) {
|
||||||
request := map[string]any{
|
jsonBytes, err := json.Marshal(data)
|
||||||
"data": data,
|
|
||||||
}
|
|
||||||
jsonBytes, err := json.Marshal(request)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package oplog
|
package oplog
|
||||||
|
|
||||||
|
type LogRequest struct {
|
||||||
|
Data []*LogItem `json:"data"`
|
||||||
|
}
|
||||||
type LogItem struct {
|
type LogItem struct {
|
||||||
OpID uint `json:"op_id"`
|
OpID uint `json:"op_id"`
|
||||||
OpName string `json:"op_name"`
|
OpName string `json:"op_name"`
|
||||||
|
|
Loading…
Reference in New Issue