package friend import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/x/bsonx" ) type ModelAssist struct { modules.MCompModel moduleFriend *Friend } func (this *ModelAssist) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.TableName = comm.TableAssist err = this.MCompModel.Init(service, module, comp, options) this.moduleFriend = module.(*Friend) this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, }) return } // 获取助战英雄信息 func (this *ModelAssist) getAssist(uid string) (list *pb.DBAssistHero, err error) { list = &pb.DBAssistHero{} if err = this.Get(uid, list); err != nil { this.moduleFriend.Errorln(err) } return } // 修改助战列表信息 func (this *ModelAssist) modifyAssistData(uid string, update map[string]interface{}) (err error) { if err = this.Change(uid, update); err != nil { this.moduleFriend.Errorln(err) } return }