package web import ( "errors" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" "go.mongodb.org/mongo-driver/bson/primitive" ) //公告邮件模块 type modelMailComp struct { modules.MCompModel module *Web } func (this *modelMailComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { this.TableName = "mail" this.MCompModel.Init(service, module, comp, opt) this.module = module.(*Web) return } //创建系统邮件 func (this *modelMailComp) CreateGMMail(mail *pb.DBMailData) (err error) { if mail == nil { return errors.New("not found mail") } mail.ObjId = primitive.NewObjectID().Hex() if _, err = this.DB.InsertOne(core.SqlTable(this.TableName), mail); err != nil { this.module.Errorln(err) return } return }