活动分类

This commit is contained in:
meixiongfeng 2023-07-31 17:20:11 +08:00
parent 6b093203f3
commit 3d2c87b003
3 changed files with 23 additions and 3 deletions

View File

@ -959,5 +959,6 @@ const (
)
const (
HuodongWarorder = 100002 // 战令活动
HdTypeWarorder = 1 // 圣桃战令类型
HdTypePay = 2 // 限时类型
)

View File

@ -24,7 +24,9 @@ func (this *modelHdList) Init(service core.IService, module core.IModule, comp c
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "hdid", Value: bsonx.Int32(1)}},
})
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
Keys: bsonx.Doc{{Key: "itype", Value: bsonx.Int32(1)}},
})
return
}
@ -67,3 +69,16 @@ func (this *modelHdList) addHdInfo(hd *pb.DBHuodong) error {
}
return nil
}
// 通过活动类型查找
func (this *modelHdList) getHdInfoByHdType(iType int32) (result *pb.DBHuodong, err error) {
_data := this.DBModel.DB.FindOne(comm.TableHdInfo, bson.M{"itype": iType})
result = &pb.DBHuodong{}
if err = _data.Decode(result); err != nil {
this.module.Errorln(err)
}
return
}

View File

@ -48,7 +48,7 @@ func (this *Activity) Start() (err error) {
err = this.ModuleBase.Start()
if !db.IsCross() {
if rst, err := this.modelhdList.getHdInfoByHdId(comm.HuodongWarorder); err == nil {
if rst, err := this.modelhdList.getHdInfoByHdType(comm.HdTypeWarorder); err == nil {
// 服务启动 获取活动信息
var module core.IModule
if module, err = this.service.GetModule(comm.ModuleWarorder); err == nil {
@ -57,6 +57,10 @@ func (this *Activity) Start() (err error) {
m.ActivityNotice(rst)
}
}
}
if rst, err := this.modelhdList.getHdInfoByHdType(comm.HdTypePay); err == nil {
// 服务启动 获取活动信息
var module core.IModule
if module, err = this.service.GetModule(comm.ModulePay); err == nil {
if m, ok := module.(comm.IPay); ok {
m.OpenActivity(1, rst.Stime)