更新功能开启

This commit is contained in:
wh_zcy 2022-09-15 20:33:34 +08:00
parent 621f50bff3
commit 2320b9a280
5 changed files with 36 additions and 82 deletions

View File

@ -66,6 +66,7 @@ const (
//数据表名定义处 //数据表名定义处
const ( const (
TableSys = "sys"
///数据日志表 ///数据日志表
TableModellog = "model_log" TableModellog = "model_log"
///用户会话数据表 ///用户会话数据表
@ -200,6 +201,12 @@ const (
ResTaskActive = "taskActive" //任务活跃度 ResTaskActive = "taskActive" //任务活跃度
) )
const (
Gold int32 = 1 //金币
Diamond int32 = 2 //钻石
)
type TaskType int32 type TaskType int32
// 日常任务事件类型 // 日常任务事件类型

View File

@ -15,6 +15,10 @@ type (
Describe string //调用描述 Describe string //调用描述
} }
ISys interface {
IsAccess(funcName string, userLv int32) bool
}
//邮件业务模块对外接口定义 提供给其他模块使用的 //邮件业务模块对外接口定义 提供给其他模块使用的
Imail interface { Imail interface {
CreateNewMail(session IUserSession, mail *pb.DBMailData) bool CreateNewMail(session IUserSession, mail *pb.DBMailData) bool

View File

@ -25,6 +25,7 @@ type ModuleBase struct {
options IOptions options IOptions
scomp comm.ISC_GateRouteComp //网关服务组件 scomp comm.ISC_GateRouteComp //网关服务组件
//常用的一些通用模块 在底层注册好 //常用的一些通用模块 在底层注册好
ModuleSys comm.ISys //系统
ModuleUser comm.IUser //用户模块 ModuleUser comm.IUser //用户模块
ModuleItems comm.IItems //道具背包模块 ModuleItems comm.IItems //道具背包模块
ModuleHero comm.IHero //英雄模块 ModuleHero comm.IHero //英雄模块
@ -62,6 +63,7 @@ func (this *ModuleBase) Start() (err error) {
if module, err = this.service.GetModule(comm.ModuleUser); err != nil { if module, err = this.service.GetModule(comm.ModuleUser); err != nil {
return return
} }
this.ModuleUser = module.(comm.IUser) this.ModuleUser = module.(comm.IUser)
if module, err = this.service.GetModule(comm.ModuleItems); err != nil { if module, err = this.service.GetModule(comm.ModuleItems); err != nil {
return return
@ -90,6 +92,11 @@ func (this *ModuleBase) Start() (err error) {
return return
} }
this.ModuleRtask = module.(comm.IRtask) this.ModuleRtask = module.(comm.IRtask)
if module, err = this.service.GetModule(comm.ModuleSys); err != nil {
return
}
this.ModuleSys = module.(comm.ISys)
return return
} }

View File

@ -53,7 +53,7 @@ func (this *apiComp) Choose(session comm.IUserSession, req *pb.RtaskChooseReq) (
// 校验限定条件 // 校验限定条件
if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), chooseCnf.PreTid); !ok { if err, ok := this.moduleRtask.modelRtask.checkCondi(session.GetUserId(), chooseCnf.PreTid); !ok {
this.moduleRtask.Error(err.Error()) log.Errorf("no reach condi err: %v", err)
code = pb.ErrorCode_RtaskCondiNoReach code = pb.ErrorCode_RtaskCondiNoReach
return return
} }

View File

@ -125,13 +125,6 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
cfg: typeCfg, cfg: typeCfg,
verify: this.modelRtask.verfiyRtype10, verify: this.modelRtask.verfiyRtype10,
}) })
case comm.Rtype11:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15: case comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15:
this.registerVerifyHandle(v.Id, &rtaskCondi{ this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg, cfg: typeCfg,
@ -139,47 +132,22 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
verify: this.modelRtaskRecord.verifyFromDb, verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.addUpdate, update: this.modelRtaskRecord.addUpdate,
}) })
case comm.Rtype16, comm.Rtype17, comm.Rtype19:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype18:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.lessThanParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype20: case comm.Rtype20:
this.registerVerifyHandle(v.Id, &rtaskCondi{ this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg, cfg: typeCfg,
verify: this.modelRtask.verifyRtype20, verify: this.modelRtask.verifyRtype20,
}) })
case comm.Rtype21: case comm.Rtype11, comm.Rtype16, comm.Rtype17, comm.Rtype21,
comm.Rtype22, comm.Rtype35, comm.Rtype40, comm.Rtype44,
comm.Rtype59, comm.Rtype61, comm.Rtype70:
this.registerVerifyHandle(v.Id, &rtaskCondi{ this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg, cfg: typeCfg,
find: this.modelRtaskRecord.equalParams, find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb, verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate, update: this.modelRtaskRecord.overrideUpdate,
}) })
case comm.Rtype22: case comm.Rtype18, comm.Rtype19, comm.Rtype23, comm.Rtype24,
this.registerVerifyHandle(v.Id, &rtaskCondi{ comm.Rtype25, comm.Rtype26, comm.Rtype27,
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype23:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.lessThanParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.addUpdate,
})
case comm.Rtype24, comm.Rtype25, comm.Rtype26, comm.Rtype27,
comm.Rtype28, comm.Rtype29, comm.Rtype30, comm.Rtype31, comm.Rtype28, comm.Rtype29, comm.Rtype30, comm.Rtype31,
comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36, comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36,
comm.Rtype37, comm.Rtype38, comm.Rtype39, comm.Rtype41, comm.Rtype37, comm.Rtype38, comm.Rtype39, comm.Rtype41,
@ -188,60 +156,18 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
comm.Rtype50, comm.Rtype51, comm.Rtype52, comm.Rtype53, comm.Rtype50, comm.Rtype51, comm.Rtype52, comm.Rtype53,
comm.Rtype54, comm.Rtype55, comm.Rtype56, comm.Rtype57, comm.Rtype54, comm.Rtype55, comm.Rtype56, comm.Rtype57,
comm.Rtype58, comm.Rtype60, comm.Rtype62, comm.Rtype64, comm.Rtype58, comm.Rtype60, comm.Rtype62, comm.Rtype64,
comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype69: comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype69:
this.registerVerifyHandle(v.Id, &rtaskCondi{ this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg, cfg: typeCfg,
find: this.modelRtaskRecord.lessThanParams, find: this.modelRtaskRecord.lessThanParams,
verify: this.modelRtaskRecord.verifyFromDb, verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.addUpdate, update: this.modelRtaskRecord.addUpdate,
}) })
case comm.Rtype35:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype40:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype44, comm.Rtype59:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype61:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype63: case comm.Rtype63:
this.registerVerifyHandle(v.Id, &rtaskCondi{ this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg, cfg: typeCfg,
verify: this.modelRtask.verifyRtype63, verify: this.modelRtask.verifyRtype63,
}) })
case comm.Rtype68:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
case comm.Rtype70:
this.registerVerifyHandle(v.Id, &rtaskCondi{
cfg: typeCfg,
find: this.modelRtaskRecord.equalParams,
verify: this.modelRtaskRecord.verifyFromDb,
update: this.modelRtaskRecord.overrideUpdate,
})
default: default:
log.Warnf("rtaskType[%v] not register", typeCfg.Type) log.Warnf("rtaskType[%v] not register", typeCfg.Type)
} }
@ -257,6 +183,12 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
condi *rtaskCondi condi *rtaskCondi
) )
user := this.ModuleUser.GetUser(session.GetUserId())
if user == nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
for _, v := range this.handleMap { for _, v := range this.handleMap {
// 找到任务类型 // 找到任务类型
if int32(rtaskType) == v.cfg.Type { if int32(rtaskType) == v.cfg.Type {
@ -266,7 +198,11 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
if condiId = v.find(v.cfg, params...); condiId == 0 { if condiId = v.find(v.cfg, params...); condiId == 0 {
continue continue
} else { } else {
condi = v //数据记录方式是1
if v.cfg.Datatype == 1 ||
v.cfg.Datatype == 2 && this.ModuleSys.IsAccess("task", user.Lv) {
condi = v
}
break break
} }
} }