38 lines
782 B
Go
38 lines
782 B
Go
package infra
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"git.apinb.com/bsm-sdk/core/utils"
|
|
)
|
|
|
|
type LogItem struct {
|
|
OpID uint `json:"op_id"`
|
|
OpName string `json:"op_name"`
|
|
OpType string `json:"op_type"`
|
|
Text string `json:"text"`
|
|
Code string `json:"code"`
|
|
Level uint `json:"level"`
|
|
Ip string `json:"ip"`
|
|
Module string `json:"module"`
|
|
Encry bool `json:"encry"`
|
|
}
|
|
|
|
var (
|
|
Type_Login string = "login"
|
|
Type_Logout string = "logout"
|
|
Type_Register string = "register"
|
|
Type_Update string = "update"
|
|
Type_Delete string = "delete"
|
|
Type_Query string = "query"
|
|
Type_Other string = "other"
|
|
Type_Create string = "create"
|
|
)
|
|
|
|
func PushLog(endpoint string, data []*LogItem) {
|
|
jsonBytes, _ := json.Marshal(data)
|
|
|
|
go utils.HttpPost(endpoint, nil, jsonBytes)
|
|
|
|
}
|