清库后活动数据自动填充

This commit is contained in:
meixiongfeng 2023-12-26 13:49:45 +08:00
parent 1d46dac1e7
commit f7db22665e
2 changed files with 28 additions and 67 deletions

View File

@ -134,6 +134,7 @@ func (this *modelHdList) loadHdInfo() (err error) {
if _, err = this.DB.InsertMany(core.SqlTable(this.TableName), data); err != nil { if _, err = this.DB.InsertMany(core.SqlTable(this.TableName), data); err != nil {
return return
} }
this.module.ReloadActivity()
return return
} }
return return

View File

@ -97,6 +97,15 @@ func (this *Activity) Start() (err error) {
} }
this.uigame = module.(comm.IUiGame) this.uigame = module.(comm.IUiGame)
if !db.IsCross() { if !db.IsCross() {
this.ReloadActivity()
}
this.service.RegisterFunctionName(string(comm.Rpc_ActivityOver), this.Rpc_ActivityOver)
this.service.RegisterFunctionName(string(comm.Rpc_ActivityStart), this.Rpc_ActivityStart)
return
}
func (this *Activity) ReloadActivity() {
this.modelhdList.LoadActivityData() this.modelhdList.LoadActivityData()
for k, v := range this.modelhdList.activity { for k, v := range this.modelhdList.activity {
switch k { switch k {
@ -120,11 +129,6 @@ func (this *Activity) Start() (err error) {
break break
} }
} }
}
this.service.RegisterFunctionName(string(comm.Rpc_ActivityOver), this.Rpc_ActivityOver)
this.service.RegisterFunctionName(string(comm.Rpc_ActivityStart), this.Rpc_ActivityStart)
return
} }
func (this *Activity) OnInstallComp() { func (this *Activity) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
@ -134,50 +138,6 @@ func (this *Activity) OnInstallComp() {
this.modelhdList = this.RegisterComp(new(modelHdList)).(*modelHdList) this.modelhdList = this.RegisterComp(new(modelHdList)).(*modelHdList)
} }
// 创建一条活动数据
// func (this *Activity) CreateHdData() (err error) {
// var db *pb.DBHuodong
// db = &pb.DBHuodong{
// Id: primitive.NewObjectID().Hex(),
// Hdid: 10001,
// Rtime: 1680105599,
// Itype: 0,
// Name: "累计充值活动",
// Img: "",
// Showtime: "03月15日00:00-03月20日23:59",
// PressImg: "huodong_btn4_1.png",
// Intr: "累计充值,限时福利",
// Etime: 1680105599,
// NormalImg: "huodong_btn4.png",
// Stime: 1679414400,
// Tab: 2,
// Ttype: 0,
// Icon: "ico_event_yxjl",
// Open: 1,
// Order: 102,
// Stype: 10009,
// Htype: 9,
// Data: &pb.ActivityInfo{},
// }
// for i := 0; i < 6; i++ {
// var p []*pb.UserAssets
// p = append(p, &pb.UserAssets{
// A: "item",
// T: "10000001",
// N: 1,
// })
// db.Data.Prize = append(db.Data.Prize, &pb.Arr{
// Prize: p,
// Val: int32(i) + 1,
// })
// }
// this.modelhdList.addHdInfo(db)
// fmt.Printf("%v", db)
// return
// }
func (this *Activity) CreateHdData() (err error) { func (this *Activity) CreateHdData() (err error) {
this.modelhdList.getHdInfo() this.modelhdList.getHdInfo()
return return