报错修改

This commit is contained in:
meixiongfeng 2022-06-21 15:01:54 +08:00
parent 89ce9e9b08
commit 5d1f1f90a0
2 changed files with 12 additions and 7 deletions

View File

@ -5,9 +5,6 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/lego/core"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/x/bsonx"
)
const (
@ -30,10 +27,6 @@ func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core
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
}

View File

@ -9,7 +9,9 @@ import (
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/x/bsonx"
)
const (
@ -29,6 +31,16 @@ type IMail interface {
Mail_DelUserMail(objId string) bool
}
func (this *DB_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.Model_Comp.Init(service, module, comp, options)
//创建uid索引
this.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
})
return
}
func (this *DB_Comp) Mail_QueryUserMail(uId string) (mail []*pb.DB_MailData, err error) {
if _data, err := this.DB.Find(DB_MailTable, bson.M{"userid": uId}); err == nil {