更新任务触发

This commit is contained in:
wh_zcy 2023-05-05 16:57:10 +08:00
parent cc356997a3
commit dbe12ea192
45 changed files with 76 additions and 91 deletions

View File

@ -50,7 +50,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
}
this.module.DispenseRes(session, level.Award, true)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype151, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype151, 1))
}
session.SendMsg(string(this.module.GetType()), "receive", &pb.AcademyReceiveResp{Issucc: true})
return

View File

@ -40,7 +40,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.ArenaChallenge
Tasks: record.Tasks,
}})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype130, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype130, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype130, 1))
} else {
session.SendMsg(string(this.module.GetType()), "challenge", &pb.ArenaChallengeResp{Code: cd, Info: nil})
}

View File

@ -62,7 +62,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
bulestate = pb.BattleRecordState_DefendLost
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype131, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype131, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype131, 1))
} else {
if req.Revengeid != "" {
redstate = pb.BattleRecordState_RevengeFailed
@ -225,7 +225,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
code = pb.ErrorCode_DBError
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype128, red.Integral), comm.GettaskParam(comm.Rtype129, red.Dan))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype128, red.Integral), comm.GettaskParam(comm.Rtype129, red.Dan))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype128, red.Integral)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype129, red.Dan)
return

View File

@ -139,7 +139,7 @@ func (this *Battle) CreatePveBattle(session comm.IUserSession, req *pb.BattlePVE
for _, v := range req.Format.Friendformat {
if v != "" {
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
break
}
}
@ -249,7 +249,7 @@ func (this *Battle) CreateLPVEBattle(session comm.IUserSession, req *pb.BattleLP
for _, v := range req.Format.Friendformat {
if v != "" {
// this.ModuleRtask.SendToRtask(session, comm.Rtype108, 1)
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype108, 1))
break
}
}
@ -378,7 +378,7 @@ func (this *Battle) CheckBattleReport(session comm.IUserSession, report *pb.Batt
this.moonfantasy.Trigger(session, report)
for _, v := range report.Completetask {
// this.ModuleRtask.SendToRtask(session, comm.Rtype157, int32(report.Info.Ptype), v)
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype157, int32(report.Info.Ptype), v))
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype157, int32(report.Info.Ptype), v))
}
return pb.ErrorCode_Success, true
}

View File

@ -21,6 +21,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
return
}

View File

@ -75,7 +75,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
}
go this.module.modelChat.sendChatToWorld(msg, max_chat)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype62, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype62, 1))
//随机任务
// if _, err = this.service.AcrossClusterRpcGo(
// context.Background(),
@ -117,7 +117,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
go this.module.modelChat.sendChatToCrossServer(msg, max_chat)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype106, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype106, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype106, 1))
break
default:
code = pb.ErrorCode_ReqParameterError

View File

@ -91,7 +91,7 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
lv.Pass = true
this.module.DispenseRes(session, level.Award, true)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype140, 1, level.Id)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
}
lv.Progress = int32((float64(len(lv.Passmanster)+len(lv.Passdrop)) / float64(len(level.Passdroplist)+len(level.PassformatList))) * float64(100))
if err = this.module.modelCombat.updateInfo(info); err != nil {

View File

@ -100,7 +100,7 @@ func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (cod
lv.Pass = true
this.module.DispenseRes(session, level.Award, true)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype140, 1, level.Id)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype140, 1))
}
lv.Progress = int32((float64(len(lv.Passmanster)+len(lv.Passdrop)) / float64(len(level.Passdroplist)+len(level.PassformatList))) * float64(100))
if err = this.module.modelCombat.updateInfo(info); err != nil {

View File

@ -90,7 +90,7 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype94, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype94, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype94, 1))
session.SendMsg(string(this.module.GetType()), "ench", &pb.EquipmentEnchResp{Issucc: true, Equipment: equip})
return
}

View File

@ -191,7 +191,7 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
}
if len(tasks) > 0 {
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: updatequipment})

View File

@ -208,7 +208,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype96, 1)
}
if len(tasks) > 0 {
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
return

View File

@ -67,7 +67,7 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype95, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype95, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype95, 1))
session.SendMsg(string(this.module.GetType()), "wash", &pb.EquipmentWashResp{Eid: req.Eid, AdverbEntry: adverbEntry})
return
}

View File

@ -135,7 +135,7 @@ func (this *modelEquipmentComp) AddEquipments(session comm.IUserSession, cIds ma
//异步出发任务启动
if len(tasks) > 0 {
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
if len(add) > 0 {

View File

@ -135,7 +135,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
// 拥有xx个好友
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype10, int32(len(agreeIds)))
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype10, int32(len(agreeIds))))
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype10, int32(len(agreeIds))))
resp := &pb.FriendAgreeResp{
Num: optNum,
}

View File

@ -98,6 +98,6 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
// 随机任务Rtype13
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype13, 1)
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype13, 1))
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype13, 1))
return
}

View File

@ -100,6 +100,6 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
// 赠送X次友情点
// this.moduleFriend.ModuleRtask.SendToRtask(session, comm.Rtype11, 1)
this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype11, 1))
go this.moduleFriend.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype11, 1))
return
}

View File

@ -79,6 +79,6 @@ func (this *apiComp) CreateFood(session comm.IUserSession, req *pb.GourmetCreate
Cid: curFood,
FirstGet: bFirst,
})
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype150, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype150, 1))
return
}

View File

@ -117,6 +117,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (c
}
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
return
}

View File

@ -121,7 +121,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.HeroBuyReq) (code pb
tasks = append(tasks, comm.GettaskParam(comm.Rtype67, v.N, utils.ToInt32(v.T)))
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
session.SendMsg(string(this.module.GetType()), "buy", &pb.HeroBuyResp{
IsSucc: true,
Onebuy: record.Onebuy + req.BuyCount,

View File

@ -86,6 +86,6 @@ func (this *apiComp) Fusion(session comm.IUserSession, req *pb.HeroFusionReq) (c
session.SendMsg(string(this.module.GetType()), HeroFusionResp, &pb.HeroFusionResp{Heroid: conf.Hero})
// 通过融合获得指定英雄
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype139, utils.ToInt32(conf.Hero))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype139, utils.ToInt32(conf.Hero)))
return
}

View File

@ -137,6 +137,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
szTask = append(szTask, comm.GettaskParam(comm.Rtype55, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype56, 1, 1, cfg.Job))
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
return
}

View File

@ -96,7 +96,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
szTask = append(szTask, comm.GettaskParam(comm.Rtype28, 1))
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype115, utils.ToInt32(_hero.HeroID), _hero.Star)
return
}

View File

@ -596,7 +596,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex
}
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype33, 1, 1, hero.Lv))
this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.moduleHero.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
//this.moduleHero.ModuleRtask.SendToRtask(session, comm.Rtype33, 1, 1, hero.Lv)
}
}

View File

@ -100,7 +100,7 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
szTask = append(szTask, comm.GettaskParam(comm.Rtype1, 1, utils.ToInt32(heroCfgId)))
szTask = append(szTask, comm.GettaskParam(comm.Rtype30, 1, cfg.Color))
szTask = append(szTask, comm.GettaskParam(comm.Rtype31, 1, cfg.Color))
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
}
return
@ -174,7 +174,7 @@ func (this *Hero) SendRdTask(session comm.IUserSession) {
//this.ModuleRtask.SendToRtask(session, comm.Rtype46, v1, k1, k)
}
}
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
}
//英雄列表
@ -759,7 +759,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou
}
szTask = append(szTask, comm.GettaskParam(comm.Rtype89, drawCount))
this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
}
func (this *Hero) newCondition(heroRecord *pb.DBHeroRecord) (get bool, starIndex int32) {

View File

@ -140,6 +140,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
}
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
return
}

View File

@ -61,7 +61,7 @@ func (this *apiComp) Useitem(session comm.IUserSession, req *pb.ItemsUseItemReq)
//随机任务
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype21, 1)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype22, utils.ToInt32(sale.Prize[0].T))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype21, 1), comm.GettaskParam(comm.Rtype22, utils.ToInt32(sale.Prize[0].T)))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype21, 1), comm.GettaskParam(comm.Rtype22, utils.ToInt32(sale.Prize[0].T)))
case 4: //自选宝箱
if prop = this.module.configure.GetDropData(itemcf.BoxId); prop == nil {

View File

@ -153,7 +153,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv))
}
return

View File

@ -221,6 +221,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype160, allStar)
tasks = append(tasks, comm.GettaskParam(comm.Rtype160, allStar))
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
return
}

View File

@ -44,12 +44,12 @@ type ModuleBase struct {
ModuleTools comm.ITools //工具类 获取一些通用配置
}
//重构模块配置对象
// 重构模块配置对象
func (this *ModuleBase) NewOptions() (options core.IModuleOptions) {
return new(Options)
}
//模块初始化接口
// 模块初始化接口
func (this *ModuleBase) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
this.service = service.(base.IRPCXService)
this.module = module
@ -59,7 +59,7 @@ func (this *ModuleBase) Init(service core.IService, module core.IModule, options
return
}
//模块启动接口
// 模块启动接口
func (this *ModuleBase) Start() (err error) {
if err = this.ModuleBase.Start(); err != nil {
return
@ -138,12 +138,12 @@ func (this *ModuleBase) Start() (err error) {
return
}
//判断当前环境是本服还还是跨服
// 判断当前环境是本服还还是跨服
func (this *ModuleBase) IsCross() bool {
return db.IsCross()
}
//获取跨服标签
// 获取跨服标签
func (this *ModuleBase) GetCrossTag() string {
return db.CrossTag()
}
@ -166,7 +166,7 @@ func (this *ModuleBase) PutUserSession(session comm.IUserSession) {
return
}
//向指定用户发送消息
// 向指定用户发送消息
func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Message, uid string) (err error) {
user := this.ModuleUser.GetUserSession(uid)
if user == nil {
@ -180,7 +180,7 @@ func (this *ModuleBase) SendMsgToUser(mainType, subType string, msg proto.Messag
return
}
//向多个用户发送消息
// 向多个用户发送消息
func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Message, uids ...string) (err error) {
var (
users map[string]*pb.CacheUser = make(map[string]*pb.CacheUser)
@ -226,7 +226,7 @@ func (this *ModuleBase) SendMsgToUsers(mainType, subType string, msg proto.Messa
return
}
//向多个用户发送消息
// 向多个用户发送消息
func (this *ModuleBase) SendMsgToCUsers(mainType, subType string, msg proto.Message, users ...*pb.CacheUser) (err error) {
var (
gateways map[string]map[string][]string = make(map[string]map[string][]string)
@ -262,7 +262,7 @@ func (this *ModuleBase) SendMsgToCUsers(mainType, subType string, msg proto.Mess
return
}
//向多个用户发送消息
// 向多个用户发送消息
func (this *ModuleBase) SendMsgToSession(mainType, subType string, msg proto.Message, users ...comm.IUserSession) (err error) {
var (
gateways map[string]map[string][]string = make(map[string]map[string][]string)
@ -335,7 +335,7 @@ func (this *ModuleBase) CheckRes(session comm.IUserSession, res []*cfg.Gameatn)
return
}
//消耗资源
// 消耗资源
func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode) {
var (
items map[string]int32 // 道具背包 批量处理
@ -379,7 +379,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
this.Debug("消耗玩家资源", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "attrs", Value: attrs})
if count, ok := attrs[comm.ResDiamond]; ok {
// this.ModuleRtask.SendToRtask(session, comm.Rtype104, -count)
this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
go this.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype104, -count))
}
}
if len(items) > 0 {
@ -393,7 +393,7 @@ func (this *ModuleBase) ConsumeRes(session comm.IUserSession, res []*cfg.Gameatn
return
}
//发放资源
// 发放资源
func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode) {
var (
items map[string]int32 // 道具背包 批量处理
@ -478,7 +478,7 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
return
}
//跨服对象获取数据操作对象
// 跨服对象获取数据操作对象
func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string, expired time.Duration) (model *db.DBModel, err error) {
var conn *db.DBConn
if session.GetServiecTag() == this.service.GetTag() {
@ -494,7 +494,7 @@ func (this *ModuleBase) GetDBNodule(session comm.IUserSession, tableName string,
return
}
//跨服对象获取数据操作对象
// 跨服对象获取数据操作对象
func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration) (model *db.DBModel, err error) {
var (
conn *db.DBConn
@ -512,7 +512,7 @@ func (this *ModuleBase) GetCrossDBModel(tableName string, expired time.Duration)
return
}
//跨服对象获取数据操作对象
// 跨服对象获取数据操作对象
func (this *ModuleBase) GetDBModelByUid(uid, tableName string, expired time.Duration) (model *db.DBModel, err error) {
var (
stag string
@ -534,7 +534,7 @@ func (this *ModuleBase) GetDBModelByUid(uid, tableName string, expired time.Dura
return
}
//日志接口
// 日志接口
func (this *ModuleBase) Debug(msg string, args ...log.Field) {
this.options.GetLog().Debug(msg, args...)
}
@ -623,7 +623,7 @@ func (this *ModuleBase) PanicWithField(msg string, fields ...log.Field) {
}
//发放资源
// 发放资源
func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gameatn, bPush bool) (code pb.ErrorCode, atno []*pb.UserAtno) {
var (
items map[string]int32 // 道具背包 批量处理

View File

@ -47,7 +47,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
},
})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype88, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype88, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype88, 1))
} else {
session.SendMsg(string(this.module.GetType()), "battle", &pb.MoonfantasyBattleResp{Code: cd})
}

View File

@ -135,7 +135,7 @@ func (this *modelDreamComp) trigger(session comm.IUserSession) {
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
return
}
@ -189,7 +189,7 @@ func (this *modelDreamComp) triggerbyid(session comm.IUserSession, boosid string
this.module.modelDream.noticeuserfriend(session, mdata.Id, chat)
session.SendMsg(string(this.module.GetType()), "trigger", &pb.MoonfantasyTriggerPush{Issucc: true, Mid: mdata.Id, Monster: mdata.Monster})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype87, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype87, 1))
return
}

View File

@ -155,6 +155,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype58, 1)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype59, pagoda.PagodaId)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype58, 1), comm.GettaskParam(comm.Rtype59, pagoda.PagodaId))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype58, 1), comm.GettaskParam(comm.Rtype59, pagoda.PagodaId))
return
}

View File

@ -102,7 +102,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
"knapsack": room.Knapsack,
filed: pillar,
})
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype149, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype149, 1))
session.SendMsg(string(this.module.GetType()), "practice", &pb.PracticePracticeResp{Pillar: pillar})
return
}

View File

@ -246,7 +246,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.PracticeReceiveR
this.module.PutUserSession(_session)
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, minutes))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype135, minutes))
session.SendMsg(string(this.module.GetType()), "receive", &pb.PracticeReceiveResp{Pillar: pillar, Knapsack: room.Knapsack})
return
}

View File

@ -61,7 +61,7 @@ func (this *apiComp) UnLock(session comm.IUserSession, req *pb.PracticeUnLockReq
filed: pillar,
"pillarf": room.Pillarf,
})
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype152, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype152, 1))
session.SendMsg(string(this.module.GetType()), "unlock", &pb.PracticeUnLockResp{Info: room})
return
}

View File

@ -358,7 +358,6 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
return
}
lock, _ := this.modelRtask.userlock(uid)
err := lock.Lock()
if err != nil {
@ -380,10 +379,10 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
this.modelRtaskRecord.record = record
for _, tp := range taskParams {
this.Debug("任务触发",
log.Field{Key: "uid", Value: uid},
log.Field{Key: "type", Value: tp.TT},
log.Field{Key: "params", Value: tp.Params})
// this.Debug("任务触发",
// log.Field{Key: "uid", Value: uid},
// log.Field{Key: "type", Value: tp.TT},
// log.Field{Key: "params", Value: tp.Params})
if code := this.processOneTask(session, tp.TT, tp.Params...); code != pb.ErrorCode_Success {
// this.Error("任务处理", log.Field{Key: "uid", Value: uid}, log.Field{Key: "code", Value: code})

View File

@ -133,7 +133,7 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
}
}
if len(tasks) > 0 {
this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), tasks...)
}
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})

View File

@ -157,7 +157,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
}
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{"refreshnumgoldShop": shopData.RefreshnumgoldShop, "refreshtimegoldShop": shopData.RefreshtimegoldShop, filed: sdata})
} else if !req.IsManualRefresh {
// refresh := int(this.module.privilege.GetCountByPrivilegeId(session.GetUserId(), comm.PrivilegeType2))
@ -200,7 +200,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
goods = transGoods(items, sdata)
this.module.modelShop.Change(session.GetUserId(), map[string]interface{}{filed: sdata})
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype105, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype105, 1))
} else { //返回以前的商品列表
if items, err = this.module.configure.GetShopItemsConfigureByIds(sdata.Items...); err != nil {
code = pb.ErrorCode_SystemError

View File

@ -55,7 +55,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
// 触发任务条件
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
// 发邮件
if err := this.module.modelSociaty.sendMail("GuildApproved", []string{sociaty.Name}, []string{req.Uid}); err != nil {
this.module.Error("发送邮件 模板ID:GuildApproved",

View File

@ -96,7 +96,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
if !isCheck {
// 触发任务条件
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype109, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype109, 1))
}
rsp := &pb.SociatyApplyResp{
Uid: uid,

View File

@ -169,6 +169,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
}
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype153, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype153, 1))
return
}

View File

@ -121,7 +121,7 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
}
if req.Figure != 0 {
this.module.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype72, 1))
go this.module.ModuleRtask.TriggerTask(uid, comm.GettaskParam(comm.Rtype72, 1))
}
this.mail.SendMailByCid(session, comm.Welcomemail, nil)

View File

@ -133,7 +133,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
this.module.RecoverUserPsStart(user.Uid)
// 日常登录任务
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype8, 1)
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype8, 1))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype8, 1))
this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
rsp.Data = user

View File

@ -152,6 +152,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
}
}
}
this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
return
}

View File

@ -70,7 +70,6 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
if ibattle, ok := battleModule.(comm.IBattle); ok {
var isWin bool
if code, isWin = ibattle.CheckBattleReport(session, req.Report); code == pb.ErrorCode_Success {
if isWin {
if battleConf, ok := this.module.worldBattleConf.GetDataMap()[req.BattleConfId]; ok {
if code := this.module.DispenseRes(session, []*cfg.Gameatn{battleConf.Playexp}, true); code != pb.ErrorCode_Success {
@ -80,26 +79,18 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
)
} else {
//触发任务
this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
go this.module.ModuleRtask.TriggerTask(session.GetUserId(), comm.GettaskParam(comm.Rtype70, 1, req.BattleConfId))
}
}
}
if userTask.CurrentTask == nil {
userTask.CurrentTask = make(map[int32]*pb.Worldtask)
}
if req.CondiId != 0 {
if _, ok := utils.Findx(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId); !ok {
userTask.CurrentTask[req.GroupId].CondiIds = append(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId)
}
} else {
for _, condId := range taskConf.Completetask {
if _, ok := utils.Findx(userTask.CurrentTask[req.GroupId].CondiIds, condId); !ok {
userTask.CurrentTask[req.GroupId].CondiIds = append(userTask.CurrentTask[req.GroupId].CondiIds, condId)
}
}
if _, ok := utils.Findx(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId); !ok {
userTask.CurrentTask[req.GroupId].CondiIds = append(userTask.CurrentTask[req.GroupId].CondiIds, req.CondiId)
}
update := map[string]interface{}{
"currentTask": userTask.CurrentTask,
}
@ -115,11 +106,6 @@ func (this *apiComp) Battlefinish(session comm.IUserSession, req *pb.WorldtaskBa
CondiIds: userTask.CurrentTask[req.GroupId].CondiIds,
})
//结束任务
if taskConf.DeliverNpc == 0 {
this.module.modelWorldtask.taskFinish(session, req.GroupId, req.TaskId, userTask, taskConf)
this.module.modelWorldtask.taskFinishPush(session, req.GroupId, userTask, taskConf)
}
}
this.module.Debug("校验战报",
log.Field{Key: "uid", Value: session.GetUserId()},