43 lines
1.7 KiB
Go
43 lines
1.7 KiB
Go
package common_structure
|
||
|
||
import "time"
|
||
|
||
type LogType = string
|
||
|
||
const (
|
||
LogTypeOrder LogType = "order" // 订单
|
||
LogTypeProduct LogType = "product" // 商品
|
||
LogTypeMerchant LogType = "merchant" // 商家
|
||
LogTypeMerchantUser LogType = "merchant_user" // 商家用户
|
||
LogTypePay LogType = "pay" // 支付
|
||
LogTypeUser LogType = "user" // 用户
|
||
LogTypeGPS LogType = "gps" // gps
|
||
LogTypeSMS LogType = "sms" // 短信
|
||
LogTypeSystem LogType = "system" // 系统、日志、定时任务初始化、定时任务、mq初始化等
|
||
)
|
||
|
||
type LogInfo struct {
|
||
InfoType LogType `json:"info_type"` // 日志类型,按被操作对象划分
|
||
Operator Operator `json:"operator"` // 操作人
|
||
ObjectorID int `json:"objector_id"` // 被操作对象ID,如果是gps,短信等服务则为0
|
||
Title string `json:"title"` // 标题,做什么事情
|
||
Param interface{} `json:"param"` // 参数,请求参数,函数、方法就是参数
|
||
Result interface{} `json:"result"` // 结果,返回值
|
||
ErrStr string `json:"err_str"` // 错误信息,json转义error没有自动存储,需要手动转义
|
||
At time.Time `json:"at"` // 记录时间
|
||
}
|
||
|
||
type OperatorType = string
|
||
|
||
const (
|
||
SystemOperatorType OperatorType = "system" // 系统
|
||
AdminOperatorType OperatorType = "admin" // 管理员
|
||
MerchantOperatorType OperatorType = "merchant" // 商家
|
||
UserOperatorType OperatorType = "user" // 用户
|
||
)
|
||
|
||
type Operator struct {
|
||
ID int // 系统ID设置0
|
||
OperatorType OperatorType
|
||
}
|