From 559e79c5a80dca33ac5b051d8dad8a04b568d525 Mon Sep 17 00:00:00 2001 From: yuguojian <18126816215> Date: Thu, 8 May 2025 00:54:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E5=85=AC?= =?UTF-8?q?=E5=85=B1=E7=BB=93=E6=9E=84=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- log.go | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/log.go b/log.go index d709892..047e8f6 100644 --- a/log.go +++ b/log.go @@ -2,20 +2,50 @@ package common_structure import "time" -type LogInfoType = string +type LogType = string const ( - LogInfoTypeOrder LogInfoType = "order" - LogInfoTypeProduct LogInfoType = "product" + LogTypeOrder LogType = "order" // 订单 + LogTypeProduct LogType = "product" // 商品 + LogTypeGPS LogType = "gps" // gps ) type LogInfo struct { - InfoType LogInfoType `json:"info_type"` // 类型 - ID int `json:"id"` // ID,订单ID,商品ID,商品SKUID之类的id - Operator interface{} `json:"operator"` // 操作人,商家用户对象,admin对象或者是系统,关闭订单消费队列等 - Title string `json:"title"` // 标题,做什么事情 - Param interface{} `json:"param"` // 参数,请求参数,函数、方法就是参数 - Result interface{} `json:"result"` // 结果,返回值 - ErrStr string `json:"err_str"` // 错误信息,json转义error没有自动存储,需要手动转义 - At time.Time `json:"at"` // 记录时间 + 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 +} + +type ObjectorType = string + +const ( + ObjectorTypeGPS ObjectorType = "gps" // gps + ObjectorTypeSMS ObjectorType = "sms" // sms + ObjectorTypeProduct ObjectorType = "product" + ObjectorTypeOrder ObjectorType = "order" + ObjectorTypePay ObjectorType = "pay" +) + +type Objector struct { + ID int // 系统ID设置0 + ObjectorType ObjectorType }