diff --git a/modules/modeluserlog.go b/modules/modeluserlog.go index c634529bc..6dee0b2bb 100644 --- a/modules/modeluserlog.go +++ b/modules/modeluserlog.go @@ -6,6 +6,7 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" + "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" "go_dreamfactory/utils" "time" @@ -72,6 +73,7 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i Logtype: logType, Tag: tag, Data: string(jsonStr), + Ctime: configure.Now().Unix(), }); err != nil { log.Errorln(err) return @@ -83,9 +85,10 @@ func (this *modelUserLog) AddUserLog(uid string, itype int32, tag string, data i Id: primitive.NewObjectID().Hex(), Uid: uid, ExpireAt: time.Now().Add(time.Hour * 24 * 8).Unix(), - Tag: tag, Logtype: logType, + Tag: tag, Data: string(jsonStr), + Ctime: configure.Now().Unix(), }); err != nil { log.Errorln(err) return diff --git a/pb/userexpand.pb.go b/pb/userexpand.pb.go index 6252ccf48..a532d15e5 100644 --- a/pb/userexpand.pb.go +++ b/pb/userexpand.pb.go @@ -353,6 +353,7 @@ type DBUserLog struct { Logtype string `protobuf:"bytes,4,opt,name=logtype,proto3" json:"logtype"` Tag string `protobuf:"bytes,5,opt,name=tag,proto3" json:"tag"` Data string `protobuf:"bytes,6,opt,name=data,proto3" json:"data"` + Ctime int64 `protobuf:"varint,7,opt,name=ctime,proto3" json:"ctime"` // 写日志的时间 } func (x *DBUserLog) Reset() { @@ -429,6 +430,13 @@ func (x *DBUserLog) GetData() string { return "" } +func (x *DBUserLog) GetCtime() int64 { + if x != nil { + return x.Ctime + } + return 0 +} + var File_userexpand_proto protoreflect.FileDescriptor var file_userexpand_proto_rawDesc = []byte{ @@ -526,7 +534,7 @@ var file_userexpand_proto_rawDesc = []byte{ 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x66, 0x72, 0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x89, 0x01, 0x0a, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9f, 0x01, 0x0a, 0x09, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x4c, 0x6f, 0x67, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x65, @@ -535,8 +543,9 @@ var file_userexpand_proto_rawDesc = []byte{ 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x67, 0x74, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x61, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x61, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (