package mail import ( "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/lego/core" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" ) const ( QueryUserMailResp = "queryusermailresp" ReadUserMailResp = "readusermailresp" GetUserMailAttachmentResp = "getusermailattachmentresp" DelUserMailResp = "delusermailresp" GetNewEMailResp = "getnewEmailresp" ) type Api_Comp struct { modules.MComp_GateComp service core.IService module *Mail pack comm.IPack } func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MComp_GateComp.Init(service, module, comp, options) this.service = service this.module = module.(*Mail) //创建uid索引 this.module.db_comp.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return } func (this *Api_Comp) Start() (err error) { err = this.MComp_GateComp.Start() var module core.IModule if module, err = this.service.GetModule(comm.SM_PackModule); err != nil { return } this.pack = module.(comm.IPack) return }