活动数据整理

This commit is contained in:
meixiongfeng 2023-12-12 15:44:59 +08:00
parent 7c3d3c4a2a
commit dc3039dad9
9 changed files with 57 additions and 9 deletions

View File

@ -979,7 +979,7 @@ const (
Rtype242 TaskType = 242 //辉月等级达到x级
Rtype243 TaskType = 243 //指定英雄满级且共鸣和觉醒升至最高状态
Rtype245 TaskType = 245 //招募到X品质X阵营的守护者X个
)
const (
MailLineEasy int32 = 1 // 简单

View File

@ -636,6 +636,7 @@ type (
}
IUiGame interface {
HDPSTodayConsum(uid string, ps int32) // 今日消耗的体力
IActivityNotice
}
IStonehenge interface {

View File

@ -31,6 +31,7 @@ type Activity struct {
shopcenter comm.IShopcenter // 活动中心
addrecharge comm.IAddrecharge // 活动中心
kftask comm.IActivityNotice // 开服任务
uigame comm.IUiGame // ui小游戏
}
func NewModule() core.IModule {
@ -91,7 +92,10 @@ func (this *Activity) Start() (err error) {
return
}
this.kftask = module.(comm.IActivityNotice)
if module, err = this.service.GetModule(comm.ModulePuzzle); err != nil {
return
}
this.uigame = module.(comm.IUiGame)
if !db.IsCross() {
this.modelhdList.LoadActivityData()
for k, v := range this.modelhdList.activity {
@ -111,6 +115,9 @@ func (this *Activity) Start() (err error) {
case pb.HdType_KFSevenTask:
this.kftask.ActivityOpenNotice(v)
break
case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner:
this.uigame.ActivityOpenNotice(v)
break
}
}
}
@ -385,6 +392,9 @@ func (this *Activity) Rpc_ActivityOver(ctx context.Context, args *pb.RPCGeneralR
case pb.HdType_KFSevenTask:
this.kftask.ActivityCloseNotice(hd)
break
case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner:
this.uigame.ActivityCloseNotice(hd)
break
}
}
}
@ -423,6 +433,9 @@ func (this *Activity) Rpc_ActivityStar(ctx context.Context, args *pb.RPCGeneralR
case pb.HdType_KFSevenTask:
this.kftask.ActivityOpenNotice(hd)
break
case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner:
this.uigame.ActivityOpenNotice(hd)
break
}
}
}

View File

@ -58,7 +58,7 @@ func (this *Integral) OnInstallComp() {
// 任务条件达成通知
func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) {
var bChange bool
this.Debug("积分bossm条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds})
this.Debug("积分boss条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds})
dt, err := this.modelIntegral.getIntegralList(session.GetUserId())
if dt.Itype != 2 { // 只有事件模式才有debuff
@ -95,7 +95,6 @@ func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIP
if dt.Buff[k] != 1 && v.State == pb.BuriedItemFinishState_buried_finish {
dt.Buff[k] = 1
bChange = true
}
}
if bChange {

View File

@ -25,10 +25,11 @@ func (this *apiComp) GetLattice(session comm.IUserSession, req *pb.UiGameGetLatt
)
update = make(map[string]interface{})
curTime := configure.Now().Unix()
if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在
if activity, err = this.module.GetActivityData(pb.HdType_HdLattice); err != nil { // 活动不存在
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityInvalid,
Title: pb.ErrorCode_ActivityInvalid.ToString(),
Message: err.Error(),
}
return
}

View File

@ -25,7 +25,7 @@ func (this *apiComp) GetMiner(session comm.IUserSession, req *pb.UiGameGetMinerR
)
update = make(map[string]interface{})
curTime := configure.Now().Unix()
if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在
if activity, err = this.module.GetActivityData(pb.HdType_HdMiner); err != nil { // 活动不存在
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityInvalid,
Title: pb.ErrorCode_ActivityInvalid.ToString(),

View File

@ -25,7 +25,7 @@ func (this *apiComp) GetPuzzle(session comm.IUserSession, req *pb.UiGameGetPuzzl
)
update = make(map[string]interface{})
curTime := configure.Now().Unix()
if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在
if activity, err = this.module.GetActivityData(pb.HdType_HdPuzzle); err != nil { // 活动不存在
errdata = &pb.ErrorData{
Code: pb.ErrorCode_ActivityInvalid,
Title: pb.ErrorCode_ActivityInvalid.ToString(),

View File

@ -15,6 +15,7 @@ import (
type modelLattice struct {
modules.MCompModel
module *UiGame
open bool // 游戏是否开启
}
func (this *modelLattice) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {

View File

@ -1,6 +1,7 @@
package uigame
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
@ -8,6 +9,7 @@ import (
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"sync"
"go_dreamfactory/modules"
)
@ -20,6 +22,8 @@ type UiGame struct {
service base.IRPCXService
modelLattice *modelLattice
modelMiner *modelMiner
lock sync.RWMutex
hdlist map[pb.HdType]*pb.DBHuodong
}
func NewModule() core.IModule {
@ -212,3 +216,32 @@ func (this *UiGame) HDPSTodayConsum(uid string, ps int32) {
}
}
}
func (this *UiGame) ActivityOpenNotice(hd *pb.DBHuodong) {
this.lock.Lock()
defer this.lock.Unlock()
this.hdlist[hd.Itype] = hd
}
// 活动关闭通知
func (this *UiGame) ActivityCloseNotice(hd *pb.DBHuodong) {
this.lock.Lock()
defer this.lock.Unlock()
if _, ok := this.hdlist[hd.Itype]; ok {
delete(this.hdlist, hd.Itype)
}
}
func (this *UiGame) GetActivityData(itype pb.HdType) (hd *pb.DBHuodong, err error) {
var (
ok bool
)
this.lock.RLock()
hd, ok = this.hdlist[itype]
this.lock.RUnlock()
if !ok {
err = fmt.Errorf("not found hditype:%d", itype)
return
}
return
}