上传系统公告优化
This commit is contained in:
parent
97b1328fa4
commit
be3d022721
77
bin/压力测试报告101_1.txt
Normal file
77
bin/压力测试报告101_1.txt
Normal file
@ -0,0 +1,77 @@
|
||||
机器人总数: 3000
|
||||
成功数量: 3000
|
||||
失败数量: 0
|
||||
最大同时在线人数: 646
|
||||
消息总请求数: 429941
|
||||
消息总请求大小: 64.23MB
|
||||
消息总接收数: 6380970
|
||||
消息总接收大小: 2.85GB
|
||||
压测执行时长: 1230.46秒
|
||||
QPS: 349.42
|
||||
---消息压测详情----------------------------------------------------------------------------------------------------
|
||||
消息名:viking.challenge 请求次数:6000 请求数据:802.73KB --1.22% 接收数据:7.92MB --0.27% 耗时最小:18 ms 耗时最大:436 ms 平均耗时:26.61ms 中位耗时:25.00ms
|
||||
消息名:pagoda.challengeover 请求次数:6000 请求数据:9.82MB --15.30% 接收数据:404.30KB --0.01% 耗时最小:24 ms 耗时最大:398 ms 平均耗时:40.07ms 中位耗时:37.00ms
|
||||
消息名:mainline.challenge 请求次数:13434 请求数据:1.18MB --1.83% 接收数据:18.51MB --0.63% 耗时最小:18 ms 耗时最大:456 ms 平均耗时:27.36ms 中位耗时:25.00ms
|
||||
消息名:horoscope.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.01% 耗时最小:14 ms 耗时最大:188 ms 平均耗时:19.50ms 中位耗时:19.00ms
|
||||
消息名:friend.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:302.29KB --0.01% 耗时最小:14 ms 耗时最大:350 ms 平均耗时:19.56ms 中位耗时:19.00ms
|
||||
消息名:storyline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.01% 耗时最小:15 ms 耗时最大:56 ms 平均耗时:20.56ms 中位耗时:20.00ms
|
||||
消息名:mail.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:357.42KB --0.01% 耗时最小:14 ms 耗时最大:102 ms 平均耗时:19.79ms 中位耗时:19.00ms
|
||||
消息名:sys.funcgetlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:5.54MB --0.19% 耗时最小:15 ms 耗时最大:271 ms 平均耗时:21.28ms 中位耗时:21.00ms
|
||||
消息名:hero.drawcard 请求次数:3000 请求数据:17.58KB --0.03% 接收数据:1.94MB --0.07% 耗时最小:32 ms 耗时最大:507 ms 平均耗时:52.63ms 中位耗时:51.00ms
|
||||
消息名:wtask.battlefinish 请求次数:10478 请求数据:0.00B --0.00% 接收数据:384.89KB --0.01% 耗时最小:23 ms 耗时最大:440 ms 平均耗时:36.86ms 中位耗时:34.00ms
|
||||
消息名:arena.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:426.65KB --0.01% 耗时最小:14 ms 耗时最大:65 ms 平均耗时:20.44ms 中位耗时:20.00ms
|
||||
消息名:mail.getusermailattachment 请求次数:3000 请求数据:76.17KB --0.12% 接收数据:369.14KB --0.01% 耗时最小:16 ms 耗时最大:90 ms 平均耗时:22.65ms 中位耗时:22.00ms
|
||||
消息名:horoscope.upgrade 请求次数:3000 请求数据:11.72KB --0.02% 接收数据:14.65KB --0.00% 耗时最小:24 ms 耗时最大:349 ms 平均耗时:42.77ms 中位耗时:44.00ms
|
||||
消息名:wtask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:257.81KB --0.01% 耗时最小:14 ms 耗时最大:309 ms 平均耗时:21.02ms 中位耗时:20.00ms
|
||||
消息名:dragon.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:826.17KB --0.03% 耗时最小:14 ms 耗时最大:98 ms 平均耗时:19.90ms 中位耗时:20.00ms
|
||||
消息名:wtask.finish 请求次数:35868 请求数据:140.11KB --0.21% 接收数据:4.18MB --0.14% 耗时最小:17 ms 耗时最大:424 ms 平均耗时:27.90ms 中位耗时:25.00ms
|
||||
消息名:arena.challengereward 请求次数:15000 请求数据:25.88MB --40.30% 接收数据:102.54KB --0.00% 耗时最小:17 ms 耗时最大:317 ms 平均耗时:23.76ms 中位耗时:23.00ms
|
||||
消息名:friend.apply 请求次数:4513 请求数据:136.62KB --0.21% 接收数据:273.25KB --0.01% 耗时最小:14 ms 耗时最大:258 ms 平均耗时:20.35ms 中位耗时:20.00ms
|
||||
消息名:equipment.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:68 ms 平均耗时:19.91ms 中位耗时:20.00ms
|
||||
消息名:integral.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:190.43KB --0.01% 耗时最小:15 ms 耗时最大:70 ms 平均耗时:21.13ms 中位耗时:21.00ms
|
||||
消息名:wtask.boxreceive 请求次数:1478 请求数据:0.00B --0.00% 接收数据:75.05KB --0.00% 耗时最小:16 ms 耗时最大:66 ms 平均耗时:22.22ms 中位耗时:22.00ms
|
||||
消息名:arena.challenge 请求次数:15000 请求数据:2.35MB --3.65% 接收数据:25.52MB --0.87% 耗时最小:18 ms 耗时最大:446 ms 平均耗时:26.73ms 中位耗时:25.00ms
|
||||
消息名:pagoda.challenge 请求次数:6000 请求数据:791.02KB --1.20% 接收数据:9.80MB --0.34% 耗时最小:16 ms 耗时最大:334 ms 平均耗时:22.56ms 中位耗时:22.00ms
|
||||
消息名:friend.applylist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:110.73KB --0.00% 耗时最小:14 ms 耗时最大:323 ms 平均耗时:19.53ms 中位耗时:19.00ms
|
||||
消息名:items.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:1.19MB --0.04% 耗时最小:17 ms 耗时最大:260 ms 平均耗时:22.68ms 中位耗时:22.00ms
|
||||
消息名:gm.cmd 请求次数:45000 请求数据:958.01KB --1.46% 接收数据:175.78KB --0.01% 耗时最小:14 ms 耗时最大:128 ms 平均耗时:21.14ms 中位耗时:21.00ms
|
||||
消息名:mainline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:237.30KB --0.01% 耗时最小:15 ms 耗时最大:73 ms 平均耗时:21.35ms 中位耗时:21.00ms
|
||||
消息名:practice.info 请求次数:18000 请求数据:0.00B --0.00% 接收数据:1.73MB --0.06% 耗时最小:13 ms 耗时最大:441 ms 平均耗时:20.28ms 中位耗时:20.00ms
|
||||
消息名:dailytask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:51 ms 平均耗时:20.52ms 中位耗时:20.00ms
|
||||
消息名:equipment.upgrade 请求次数:30000 请求数据:761.72KB --1.16% 接收数据:3.57MB --0.12% 耗时最小:16 ms 耗时最大:421 ms 平均耗时:23.89ms 中位耗时:23.00ms
|
||||
消息名:mainline.challengeover 请求次数:13434 请求数据:12.63MB --19.67% 接收数据:2.25MB --0.08% 耗时最小:26 ms 耗时最大:375 ms 平均耗时:53.26ms 中位耗时:54.00ms
|
||||
消息名:mainline.levelpass 请求次数:28390 请求数据:82.03KB --0.12% 接收数据:1.34MB --0.05% 耗时最小:14 ms 耗时最大:424 ms 平均耗时:21.94ms 中位耗时:21.00ms
|
||||
消息名:user.login 请求次数:3000 请求数据:42.86KB --0.07% 接收数据:505.75KB --0.02% 耗时最小:25 ms 耗时最大:1034 ms 平均耗时:526.25ms 中位耗时:527.00ms
|
||||
消息名:friend.randlist 请求次数:4516 请求数据:0.00B --0.00% 接收数据:1.76MB --0.06% 耗时最小:14 ms 耗时最大:258 ms 平均耗时:20.93ms 中位耗时:20.00ms
|
||||
消息名:viking.challengeover 请求次数:6000 请求数据:7.95MB --12.38% 接收数据:1.45MB --0.05% 耗时最小:27 ms 耗时最大:419 ms 平均耗时:47.75ms 中位耗时:47.00ms
|
||||
消息名:wtask.battlestart 请求次数:10478 请求数据:0.00B --0.00% 接收数据:18.48MB --0.63% 耗时最小:15 ms 耗时最大:356 ms 平均耗时:22.11ms 中位耗时:22.00ms
|
||||
消息名:chat.send 请求次数:6000 请求数据:425.57KB --0.65% 接收数据:11.72KB --0.00% 耗时最小:13 ms 耗时最大:200 ms 平均耗时:19.77ms 中位耗时:19.00ms
|
||||
消息名:pagoda.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:178.71KB --0.01% 耗时最小:14 ms 耗时最大:78 ms 平均耗时:20.62ms 中位耗时:20.00ms
|
||||
消息名:shop.getlist 请求次数:3000 请求数据:5.86KB --0.01% 接收数据:3.12MB --0.11% 耗时最小:17 ms 耗时最大:69 ms 平均耗时:23.16ms 中位耗时:23.00ms
|
||||
消息名:passon.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:272.46KB --0.01% 耗时最小:15 ms 耗时最大:121 ms 平均耗时:20.61ms 中位耗时:20.00ms
|
||||
消息名:wtask.accept 请求次数:38868 请求数据:151.83KB --0.23% 接收数据:1.38MB --0.05% 耗时最小:14 ms 耗时最大:324 ms 平均耗时:21.17ms 中位耗时:21.00ms
|
||||
消息名:arena.matche 请求次数:3000 请求数据:0.00B --0.00% 接收数据:20.85MB --0.71% 耗时最小:18 ms 耗时最大:462 ms 平均耗时:43.08ms 中位耗时:43.00ms
|
||||
消息名:viking.getlist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:410.16KB --0.01% 耗时最小:14 ms 耗时最大:314 ms 平均耗时:20.38ms 中位耗时:20.00ms
|
||||
消息名:smithy.getstoveinfo 请求次数:15000 请求数据:0.00B --0.00% 接收数据:937.50KB --0.03% 耗时最小:13 ms 耗时最大:421 ms 平均耗时:20.01ms 中位耗时:19.00ms
|
||||
消息名:friend.agree 请求次数:1484 请求数据:55.76KB --0.08% 接收数据:62.24KB --0.00% 耗时最小:15 ms 耗时最大:68 ms 平均耗时:20.86ms 中位耗时:20.00ms
|
||||
消息名:hero.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:54 ms 平均耗时:21.06ms 中位耗时:21.00ms
|
||||
消息名:hero.talentlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:13 ms 耗时最大:129 ms 平均耗时:19.95ms 中位耗时:20.00ms
|
||||
消息名:wtask.completecondi 请求次数:15000 请求数据:0.00B --0.00% 接收数据:644.53KB --0.02% 耗时最小:15 ms 耗时最大:268 ms 平均耗时:21.91ms 中位耗时:21.00ms
|
||||
消息名:user.create 请求次数:3000 请求数据:60.44KB --0.09% 接收数据:60.44KB --0.00% 耗时最小:19 ms 耗时最大:64 ms 平均耗时:25.95ms 中位耗时:25.00ms
|
||||
消息名:hero.change 推送次数:62777 数据大小:75.70MB --2.59%
|
||||
消息名:library.change 推送次数:5925 数据大小:1.74MB --0.06%
|
||||
消息名:equipment.change 推送次数:31434 数据大小:3.49MB --0.12%
|
||||
消息名:chat.message 推送次数:5375367 数据大小:2.61GB --91.70%
|
||||
消息名:passon.lvchange 推送次数:25686 数据大小:50.17KB --0.00%
|
||||
消息名:user.skinlist 推送次数:3000 数据大小:263.67KB --0.01%
|
||||
消息名:user.reschanged 推送次数:199263 数据大小:3.92MB --0.13%
|
||||
消息名:friend.addagree 推送次数:1842 数据大小:166.63KB --0.01%
|
||||
消息名:items.change 推送次数:109393 数据大小:15.34MB --0.53%
|
||||
消息名:wtask.acceptchange 推送次数:17868 数据大小:444.05KB --0.01%
|
||||
消息名:user.loginqueuechange 推送次数:3000 数据大小:5.86KB --0.00%
|
||||
消息名:user.lvchanged 推送次数:22615 数据大小:767.37KB --0.03%
|
||||
消息名:dragon.change 推送次数:3000 数据大小:826.17KB --0.03%
|
||||
消息名:wtask.boxchange 推送次数:1478 数据大小:20.21KB --0.00%
|
||||
消息名:mail.getnewmail 推送次数:3000 数据大小:357.42KB --0.01%
|
||||
消息名:wtask.activationschange 推送次数:35868 数据大小:595.46KB --0.02%
|
||||
消息名:friend.addapply 推送次数:4513 数据大小:408.27KB --0.01%
|
@ -282,7 +282,7 @@ type (
|
||||
//推送消息到用户
|
||||
SendUserChat(msg *pb.DBChat) (errdata *pb.ErrorData)
|
||||
//广播系统消息
|
||||
SendSysChatToWorld(ctype ChatSystemType, appenddata interface{}, value0, value1 int32, agrs ...string) (errdata *pb.ErrorData)
|
||||
SendSysChatToWorld(session IUserSession, ctype ChatSystemType, appenddata interface{}, value0, value1 int32, agrs ...string) (errdata *pb.ErrorData)
|
||||
//广播系统消息
|
||||
SendSysChatToUser(session IUserSession, ctype ChatSystemType, value0, value1 int32, agrs ...string) (errdata *pb.ErrorData)
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ func (this *modelChatComp) sendChatToCrossServer(chat *pb.DBChat, queuecount int
|
||||
return
|
||||
}
|
||||
|
||||
// 发送聊天消息到私聊频道
|
||||
// 发送聊天消息到系统平道
|
||||
func (this *modelChatComp) sendChatToSystem(chat *pb.DBChat) (err error) {
|
||||
if err = this.module.pushChatToSystem(chat); err != nil {
|
||||
this.module.Errorln(err)
|
||||
|
@ -31,13 +31,14 @@ func NewModule() core.IModule {
|
||||
|
||||
type Chat struct {
|
||||
modules.ModuleBase
|
||||
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
|
||||
options *Options
|
||||
gm comm.IGm //gm模块
|
||||
sociaty comm.ISociaty //工会模块
|
||||
api_comp *apiComp
|
||||
configure *configureComp
|
||||
modelChat *modelChatComp
|
||||
service base.IRPCXService //rpc服务对象 通过这个对象可以发布服务和调用其他服务的接口
|
||||
options *Options
|
||||
gm comm.IGm //gm模块
|
||||
sociaty comm.ISociaty //工会模块
|
||||
api_comp *apiComp
|
||||
configure *configureComp
|
||||
modelChat *modelChatComp
|
||||
sysnoticeComp *sysnoticeComp
|
||||
}
|
||||
|
||||
// 重构模块配置对象
|
||||
@ -84,6 +85,7 @@ func (this *Chat) OnInstallComp() {
|
||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelChat = this.RegisterComp(new(modelChatComp)).(*modelChatComp)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
this.sysnoticeComp = this.RegisterComp(new(sysnoticeComp)).(*sysnoticeComp)
|
||||
}
|
||||
|
||||
// Event------------------------------------------------------------------------------------------------------------
|
||||
@ -254,7 +256,7 @@ func (this *Chat) SendUserChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
|
||||
}
|
||||
|
||||
// 广播系统消息
|
||||
func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata interface{}, value0 int32, value1 int32, agrs ...string) (errdata *pb.ErrorData) {
|
||||
func (this *Chat) SendSysChatToWorld(session comm.IUserSession, ctype comm.ChatSystemType, appenddata interface{}, value0 int32, value1 int32, agrs ...string) (errdata *pb.ErrorData) {
|
||||
var (
|
||||
jsonStr []byte
|
||||
err error
|
||||
@ -306,27 +308,8 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if this.IsCross() {
|
||||
if err = this.modelChat.sendChatToSystem(msg); err != nil {
|
||||
this.Errorln(err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if _, err = this.service.AcrossClusterRpcGo(
|
||||
context.Background(),
|
||||
this.GetCrossTag(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_ModuleChatPushChat),
|
||||
msg,
|
||||
nil); err != nil {
|
||||
this.Errorln(err)
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_RpcFuncExecutionError,
|
||||
Title: pb.ErrorCode_RpcFuncExecutionError.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
if !this.sysnoticeComp.pushsysmsg(msg) { //插满
|
||||
session.SendMsg(string(this.GetType()), "message", msg)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
90
modules/chat/sysnotice_comp.go
Normal file
90
modules/chat/sysnotice_comp.go
Normal file
@ -0,0 +1,90 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"context"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/core/cbase"
|
||||
"go_dreamfactory/pb"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
//系统公告维护组件
|
||||
type sysnoticeComp struct {
|
||||
cbase.ModuleCompBase
|
||||
module *Chat
|
||||
msgs []*pb.DBChat
|
||||
lock sync.RWMutex
|
||||
max int
|
||||
}
|
||||
|
||||
// 组件初始化接口
|
||||
func (this *sysnoticeComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||
this.ModuleCompBase.Init(service, module, comp, opt)
|
||||
this.module = module.(*Chat)
|
||||
this.msgs = make([]*pb.DBChat, 0, 10)
|
||||
this.max = 10
|
||||
return
|
||||
}
|
||||
|
||||
func (this *sysnoticeComp) Start() (err error) {
|
||||
this.ModuleCompBase.Start()
|
||||
go this.run()
|
||||
return
|
||||
}
|
||||
|
||||
//上传系统消息
|
||||
func (this *sysnoticeComp) pushsysmsg(msg *pb.DBChat) bool {
|
||||
var ok bool
|
||||
this.lock.Lock()
|
||||
if count := len(this.msgs); count < this.max {
|
||||
this.msgs = append(this.msgs, msg)
|
||||
ok = true
|
||||
}
|
||||
this.lock.Unlock()
|
||||
return ok
|
||||
}
|
||||
|
||||
func (this *sysnoticeComp) run() {
|
||||
timer := time.NewTicker(time.Second * 2)
|
||||
for {
|
||||
select {
|
||||
case <-timer.C:
|
||||
this.broadcastmsg()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (this *sysnoticeComp) broadcastmsg() {
|
||||
var (
|
||||
msg *pb.DBChat
|
||||
err error
|
||||
)
|
||||
this.lock.Lock()
|
||||
if len(this.msgs) > 0 {
|
||||
msg = this.msgs[0]
|
||||
this.msgs = this.msgs[1:]
|
||||
}
|
||||
this.lock.Unlock()
|
||||
if msg != nil {
|
||||
if this.module.IsCross() {
|
||||
if err = this.module.modelChat.sendChatToSystem(msg); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if _, err = this.module.service.AcrossClusterRpcGo(
|
||||
context.Background(),
|
||||
this.module.GetCrossTag(),
|
||||
comm.Service_Worker,
|
||||
string(comm.Rpc_ModuleChatPushChat),
|
||||
msg,
|
||||
nil); err != nil {
|
||||
this.module.Errorln(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -278,12 +278,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
} else if conf.Pos == 6 {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
|
||||
}
|
||||
//聊天系统通知
|
||||
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.module.chat.SendSysChatToWorld(comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
|
||||
} else {
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1))
|
||||
}
|
||||
@ -293,6 +288,13 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
if issucc { //聊天公告通知
|
||||
if user, err = this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.module.chat.SendSysChatToWorld(session, comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
}
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "EquipmentUpgradeReq", intensify.Need)
|
||||
})
|
||||
return
|
||||
|
@ -420,7 +420,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er
|
||||
} else if len(datas) == 2 && (datas[0] == "chat") {
|
||||
|
||||
if module, err := this.service.GetModule(comm.ModuleChat); err == nil {
|
||||
if errdata = module.(comm.IChat).SendSysChatToWorld(comm.ChatSystem10, nil, 5, 0, "xxx", "25001"); errdata != nil {
|
||||
if errdata = module.(comm.IChat).SendSysChatToWorld(session, comm.ChatSystem10, nil, 5, 0, "xxx", "25001"); errdata != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -96,12 +96,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
||||
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})
|
||||
session.SendMsg(string(this.module.GetType()), Awaken, &pb.HeroAwakenResp{Hero: _hero})
|
||||
|
||||
//英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem11, _hero, _hero.JuexingLv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
var tasks []*pb.BuriedParam
|
||||
|
||||
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype34, _hero.HeroID, _hero.JuexingLv))
|
||||
@ -137,7 +131,6 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
||||
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, _hero.HeroID, int32(iHeroId)))
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
@ -147,6 +140,12 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
|
||||
return
|
||||
}
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
//英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem11, _hero, _hero.JuexingLv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "HeroAwakenReq", awakenData.Phaseneed)
|
||||
})
|
||||
|
@ -304,15 +304,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
update["selectcount"] = heroRecord.Selectcount
|
||||
update["cur"] = heroRecord.Cur
|
||||
} else { // 非模拟抽不发奖
|
||||
var szHero []*pb.DBHero
|
||||
for _, hero := range add { // 奖励一次性发放
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||
HeroConf, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, hero.HeroID)
|
||||
}
|
||||
szHero = append(szHero, hero)
|
||||
}
|
||||
this.module.HeroLibrary(session, szCards, szHero)
|
||||
|
||||
this.module.DispenseAtno(session, allres, true)
|
||||
}
|
||||
this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update)
|
||||
@ -327,6 +319,15 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
||||
if req.DrawType != 1 {
|
||||
// 任务统计
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
var szHero []*pb.DBHero
|
||||
for _, hero := range add { // 奖励一次性发放
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||
HeroConf, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, hero.HeroID)
|
||||
}
|
||||
szHero = append(szHero, hero)
|
||||
}
|
||||
this.module.HeroLibrary(session, szCards, szHero)
|
||||
this.module.SendTaskMsg(session, szStar, req.DrawCount, req.DrawType, szCards)
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "HeroDrawCardReq", atno)
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "HeroDrawCardReq", costRes)
|
||||
@ -391,18 +392,6 @@ func (this *apiComp) wishDrawCard(session comm.IUserSession, heroRecord *pb.DBHe
|
||||
var hero *pb.DBHero
|
||||
|
||||
if hero, atno, errdata = this.module.CreateOneHero(session, heroRecord.WishHero); errdata == nil {
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.T == heroRecord.WishHero && v.N == 1 {
|
||||
go func() {
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||
if HeroConf, err := this.module.configure.GetHeroConfig(heroRecord.WishHero); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
rsp.Data = append(rsp.Data, &pb.AtnoData{Atno: atno})
|
||||
}
|
||||
|
||||
@ -418,6 +407,19 @@ func (this *apiComp) wishDrawCard(session comm.IUserSession, heroRecord *pb.DBHe
|
||||
rsp.Record = heroRecord
|
||||
session.SendMsg(string(this.module.GetType()), DrawCard, rsp)
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||
for _, v := range atno {
|
||||
if v.A == "hero" && v.T == heroRecord.WishHero && v.N == 1 {
|
||||
if HeroConf, err := this.module.configure.GetHeroConfig(heroRecord.WishHero); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, v.T)
|
||||
} else {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.module.Errorln(err)
|
||||
}
|
||||
this.module.WriteUserLog(session.GetUserId(), heroRecord.WishHero, comm.GMResAddType, "HeroDrawCardReq", atno)
|
||||
this.module.WriteUserLog(session.GetUserId(), heroRecord.WishHero, comm.GMResDelType, "HeroDrawCardReq", costRes)
|
||||
})
|
||||
|
@ -80,7 +80,7 @@ func (this *apiComp) SelectCard(session comm.IUserSession, req *pb.HeroSelectCar
|
||||
for _, hero := range add { // 奖励一次性发放
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 广播 首次获得英雄
|
||||
HeroConf, _ := this.module.configure.GetHeroConfig(hero.HeroID)
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, hero.HeroID)
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem13, hero, HeroConf.Star, 0, user.Name, hero.HeroID)
|
||||
}
|
||||
szHero = append(szHero, hero)
|
||||
}
|
||||
|
@ -120,12 +120,6 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
||||
return
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUpSkill, &pb.HeroStrengthenUpSkillResp{Hero: _hero})
|
||||
//英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem9, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
|
||||
// 推送 世界任务消息
|
||||
var tasks []*pb.BuriedParam
|
||||
@ -154,6 +148,12 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
|
||||
}
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype117, lvUpCount, utils.ToInt32(_hero.HeroID)))
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
//英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem9, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "HeroStrengthenUpSkillReq", cost)
|
||||
})
|
||||
|
@ -93,13 +93,6 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
||||
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUpStar, &pb.HeroStrengthenUpStarResp{Hero: _hero})
|
||||
|
||||
//英雄升星 【玩家名称】已将【英雄名称】培养至6星!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem8, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
|
||||
// 推送 世界任务消息
|
||||
var tasks []*pb.BuriedParam
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype6, _hero.Star, utils.ToInt32(_hero.HeroID)))
|
||||
@ -115,6 +108,12 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype114, _hero.Star, utils.ToInt32(_hero.HeroID)))
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype115, 1, _hero.Star))
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
//英雄升星 【玩家名称】已将【英雄名称】培养至6星!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem8, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
if len(starConf.Starup) > 0 {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "HeroStrengthenUpStarReq", starConf.Starup)
|
||||
|
@ -94,15 +94,15 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
|
||||
return
|
||||
}
|
||||
|
||||
//英雄升级 【玩家名称】已将【英雄名称】培养至60级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem7, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.HeroStrengthenUplvResp{Hero: _hero})
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
//英雄升级 【玩家名称】已将【英雄名称】培养至60级!
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem7, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "HeroStrengthenUplvReq", cost)
|
||||
})
|
||||
return
|
||||
|
@ -1076,12 +1076,12 @@ func (this *Hero) HeroLibrary(session comm.IUserSession, cids []string, addHero
|
||||
add = append(add, v.HeroID)
|
||||
}
|
||||
if db.IsCross() {
|
||||
go this.moduleFetter.SendRpcAddHero(session.GetUserId(), add, session.GetServiecTag())
|
||||
this.moduleFetter.SendRpcAddHero(session.GetUserId(), add, session.GetServiecTag())
|
||||
} else {
|
||||
go this.moduleFetter.AddHerosFetterData(session.GetUserId(), add) // 异步调用
|
||||
this.moduleFetter.AddHerosFetterData(session.GetUserId(), add) // 异步调用
|
||||
}
|
||||
|
||||
go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
})
|
||||
if len(addHero) > 0 {
|
||||
|
@ -126,20 +126,21 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.HuntingChallen
|
||||
BossType: req.BossType,
|
||||
Difficulty: req.Difficulty,
|
||||
})
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
if ps > 0 {
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem15, nil, req.BossType, req.Difficulty, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
if ps > 0 {
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResDelType, "HuntingChallengeReq", &cfg.Gameatn{
|
||||
A: "attr",
|
||||
T: "ps",
|
||||
N: ps,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -128,11 +128,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
|
||||
errdata = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 发系统公告
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
|
||||
// 记录爬塔明细数据
|
||||
if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 {
|
||||
@ -190,6 +185,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
}
|
||||
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { // 发系统公告
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
this.module.ModuleSys.CheckOpenCond(session, comm.OpencondTypePagoda, conf.Key)
|
||||
this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype168, pagoda.Data[conf.Tab], conf.Tab))
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "PagodaChallengeOverReq", conf.Reward)
|
||||
|
@ -220,11 +220,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
Sell: del,
|
||||
Heroexp: changExp,
|
||||
})
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
|
||||
// 随机任务统计
|
||||
var tasks []*pb.BuriedParam
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype73, 1, req.BossId, req.Difficulty))
|
||||
@ -252,6 +248,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
|
||||
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype180, req.BossId, 1))
|
||||
}
|
||||
if len(tasks) > 0 {
|
||||
if user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil {
|
||||
this.chat.SendSysChatToWorld(session, comm.ChatSystem14, nil, req.BossId, req.Difficulty, user.Name)
|
||||
} else {
|
||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||
}
|
||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||
this.module.ModuleBuried.TriggerBuried(session, tasks...)
|
||||
this.module.WriteUserLog(session.GetUserId(), req, comm.GMResAddType, "VikingChallengeOverReq", szAtno)
|
||||
|
Loading…
Reference in New Issue
Block a user