This commit is contained in:
liwei1dao 2022-06-14 13:40:10 +08:00
commit b3226065b9
2 changed files with 34 additions and 6 deletions

View File

@ -36,12 +36,12 @@ func (this *MComp_DBComp) Start() (err error) {
return
}
func (this *MComp_DBComp) InsertModelLogs(table string, uID string, dbType comm.LogHandleType, where interface{}, target interface{}) (err error) {
func (this *MComp_DBComp) InsertModelLogs(table string, uID string, target interface{}) (err error) {
data := &comm.Autogenerated{
ID: primitive.NewObjectID().Hex(),
UID: uID,
Act: string(dbType),
Act: string(comm.LogHandleType_Insert),
}
data.D = append(data.D, table) // D[0]
data.D = append(data.D, target) // D[1]
@ -53,12 +53,12 @@ func (this *MComp_DBComp) InsertModelLogs(table string, uID string, dbType comm.
return err
}
func (this *MComp_DBComp) DeleteModelLogs(table string, uID string, dbType comm.LogHandleType, where interface{}, target interface{}) (err error) {
func (this *MComp_DBComp) DeleteModelLogs(table string, uID string, where interface{}, target interface{}) (err error) {
data := &comm.Autogenerated{
ID: primitive.NewObjectID().Hex(),
UID: uID,
Act: string(dbType),
Act: string(comm.LogHandleType_Delete),
}
data.D = append(data.D, table) // D[0]
@ -72,12 +72,12 @@ func (this *MComp_DBComp) DeleteModelLogs(table string, uID string, dbType comm.
return err
}
func (this *MComp_DBComp) UpdateModelLogs(table string, uID string, dbType comm.LogHandleType, where interface{}, target interface{}) (err error) {
func (this *MComp_DBComp) UpdateModelLogs(table string, uID string, where interface{}, target interface{}) (err error) {
data := &comm.Autogenerated{
ID: primitive.NewObjectID().Hex(),
UID: uID,
Act: string(dbType),
Act: string(comm.LogHandleType_Update),
}
data.D = append(data.D, table) // D[0]
data.D = append(data.D, where) // D[1]

28
modules/mail_test.go Normal file
View File

@ -0,0 +1,28 @@
package modules
import (
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
"testing"
"time"
)
var (
obj MComp_DBComp
)
func TestCreatemoudles(t *testing.T) {
_mail := &pb.DB_MailData{
UserId: "uid123",
Title: "系统邮件",
Contex: "恭喜获得专属礼包一份",
CreateTime: uint64(time.Now().Unix()),
DueTime: uint64(time.Now().Unix()) + 30*24*3600,
Check: false,
Reward: false,
}
obj.InsertModelLogs("mail", "uid123", _mail)
log.Debugf("insert : %v", _mail)
}