diff --git a/bin/gateway b/bin/gateway index f399537f7..5e0a3d906 100755 Binary files a/bin/gateway and b/bin/gateway differ diff --git a/bin/worker b/bin/worker index 8af319ed9..b46b1c12b 100755 Binary files a/bin/worker and b/bin/worker differ diff --git a/bin/压力测试报告104.txt b/bin/压力测试报告104.txt index faee08e9f..688074f55 100644 --- a/bin/压力测试报告104.txt +++ b/bin/压力测试报告104.txt @@ -1,77 +1,75 @@ -机器人总数: 3000 +机器人总数: 3000 成功数量: 3000 失败数量: 0 -最大同时在线人数: 2045 -消息总请求数: 426403 -消息总请求大小: 63.71MB -消息总接收数: 1677334 -消息总接收大小: 331.88MB -压测执行时长: 517.88秒 -QPS: 823.37 +最大同时在线人数: 3000 +消息总请求数: 456503 +消息总请求大小: 64.45MB +消息总接收数: 1667821 +消息总接收大小: 343.63MB +压测执行时长: 567.28秒 +QPS: 804.73 ---消息压测详情---------------------------------------------------------------------------------------------------- -消息名:user.create 请求次数:3000 请求数据:60.44KB --0.09% 接收数据:60.44KB --0.02% 耗时最小:20 ms 耗时最大:149 ms 平均耗时:40.61ms 中位耗时:32.00ms -消息名:wtask.accept 请求次数:39514 请求数据:154.35KB --0.24% 接收数据:1.39MB --0.42% 耗时最小:14 ms 耗时最大:290 ms 平均耗时:35.68ms 中位耗时:26.00ms -消息名:viking.getlist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:410.16KB --0.12% 耗时最小:14 ms 耗时最大:275 ms 平均耗时:34.34ms 中位耗时:25.00ms -消息名:smithy.getstoveinfo 请求次数:15000 请求数据:0.00B --0.00% 接收数据:937.50KB --0.28% 耗时最小:13 ms 耗时最大:142 ms 平均耗时:32.24ms 中位耗时:22.00ms -消息名:friend.apply 请求次数:4350 请求数据:131.69KB --0.20% 接收数据:263.38KB --0.08% 耗时最小:15 ms 耗时最大:145 ms 平均耗时:34.39ms 中位耗时:24.00ms -消息名:friend.agree 请求次数:1648 请求数据:65.21KB --0.10% 接收数据:74.75KB --0.02% 耗时最小:16 ms 耗时最大:134 ms 平均耗时:34.34ms 中位耗时:25.00ms -消息名:mainline.challengeover 请求次数:13077 请求数据:12.58MB --19.75% 接收数据:2.19MB --0.66% 耗时最小:27 ms 耗时最大:327 ms 平均耗时:62.76ms 中位耗时:56.00ms -消息名:hero.talentlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:173 ms 平均耗时:32.52ms 中位耗时:23.00ms -消息名:mainline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:237.30KB --0.07% 耗时最小:16 ms 耗时最大:127 ms 平均耗时:35.10ms 中位耗时:25.00ms -消息名:sys.funcgetlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:5.54MB --1.67% 耗时最小:15 ms 耗时最大:134 ms 平均耗时:34.90ms 中位耗时:24.00ms -消息名:wtask.completecondi 请求次数:15000 请求数据:0.00B --0.00% 接收数据:644.53KB --0.19% 耗时最小:15 ms 耗时最大:154 ms 平均耗时:35.65ms 中位耗时:25.00ms -消息名:mainline.levelpass 请求次数:27795 请求数据:82.03KB --0.13% 接收数据:1.33MB --0.40% 耗时最小:15 ms 耗时最大:402 ms 平均耗时:35.90ms 中位耗时:26.00ms -消息名:arena.challenge 请求次数:15000 请求数据:2.35MB --3.68% 接收数据:25.45MB --7.67% 耗时最小:18 ms 耗时最大:378 ms 平均耗时:38.92ms 中位耗时:29.00ms -消息名:viking.challenge 请求次数:6000 请求数据:802.73KB --1.23% 接收数据:7.91MB --2.38% 耗时最小:19 ms 耗时最大:149 ms 平均耗时:41.49ms 中位耗时:33.00ms -消息名:wtask.boxreceive 请求次数:1359 请求数据:0.00B --0.00% 接收数据:69.01KB --0.02% 耗时最小:16 ms 耗时最大:124 ms 平均耗时:38.01ms 中位耗时:31.00ms -消息名:user.login 请求次数:3000 请求数据:42.86KB --0.07% 接收数据:505.75KB --0.15% 耗时最小:28 ms 耗时最大:1085 ms 平均耗时:541.89ms 中位耗时:537.00ms -消息名:equipment.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:137 ms 平均耗时:32.97ms 中位耗时:23.00ms -消息名:friend.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:301.20KB --0.09% 耗时最小:14 ms 耗时最大:133 ms 平均耗时:32.86ms 中位耗时:22.00ms -消息名:storyline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.05% 耗时最小:14 ms 耗时最大:114 ms 平均耗时:34.49ms 中位耗时:23.00ms -消息名:dragon.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:826.17KB --0.24% 耗时最小:14 ms 耗时最大:373 ms 平均耗时:33.90ms 中位耗时:23.00ms -消息名:wtask.battlestart 请求次数:10359 请求数据:0.00B --0.00% 接收数据:18.28MB --5.51% 耗时最小:16 ms 耗时最大:259 ms 平均耗时:36.65ms 中位耗时:27.00ms -消息名:viking.challengeover 请求次数:6000 请求数据:7.93MB --12.45% 接收数据:1.45MB --0.44% 耗时最小:29 ms 耗时最大:212 ms 平均耗时:58.69ms 中位耗时:52.00ms -消息名:friend.randlist 请求次数:4352 请求数据:0.00B --0.00% 接收数据:1.70MB --0.51% 耗时最小:16 ms 耗时最大:283 ms 平均耗时:36.48ms 中位耗时:26.00ms -消息名:arena.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:426.65KB --0.13% 耗时最小:15 ms 耗时最大:304 ms 平均耗时:33.59ms 中位耗时:23.00ms -消息名:hero.drawcard 请求次数:3000 请求数据:17.58KB --0.03% 接收数据:1.95MB --0.59% 耗时最小:32 ms 耗时最大:199 ms 平均耗时:65.56ms 中位耗时:58.00ms -消息名:equipment.upgrade 请求次数:30000 请求数据:761.72KB --1.17% 接收数据:3.57MB --1.08% 耗时最小:16 ms 耗时最大:379 ms 平均耗时:36.98ms 中位耗时:26.00ms -消息名:pagoda.challenge 请求次数:6000 请求数据:791.02KB --1.21% 接收数据:9.78MB --2.95% 耗时最小:16 ms 耗时最大:130 ms 平均耗时:37.22ms 中位耗时:28.00ms -消息名:friend.applylist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:129.25KB --0.04% 耗时最小:14 ms 耗时最大:120 ms 平均耗时:32.90ms 中位耗时:23.00ms -消息名:mainline.challenge 请求次数:13077 请求数据:1.18MB --1.85% 接收数据:17.97MB --5.42% 耗时最小:18 ms 耗时最大:190 ms 平均耗时:41.95ms 中位耗时:32.00ms -消息名:horoscope.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.05% 耗时最小:14 ms 耗时最大:125 ms 平均耗时:33.47ms 中位耗时:22.00ms -消息名:mail.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:357.42KB --0.11% 耗时最小:14 ms 耗时最大:116 ms 平均耗时:33.37ms 中位耗时:22.00ms -消息名:wtask.finish 请求次数:36513 请求数据:142.63KB --0.22% 接收数据:4.08MB --1.23% 耗时最小:15 ms 耗时最大:309 ms 平均耗时:40.84ms 中位耗时:33.00ms -消息名:pagoda.challengeover 请求次数:6000 请求数据:9.81MB --15.39% 接收数据:404.30KB --0.12% 耗时最小:25 ms 耗时最大:165 ms 平均耗时:55.58ms 中位耗时:49.00ms -消息名:mail.getusermailattachment 请求次数:3000 请求数据:76.17KB --0.12% 接收数据:369.14KB --0.11% 耗时最小:17 ms 耗时最大:400 ms 平均耗时:37.80ms 中位耗时:28.00ms -消息名:hero.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:126 ms 平均耗时:34.39ms 中位耗时:24.00ms -消息名:gm.cmd 请求次数:48000 请求数据:993.16KB --1.52% 接收数据:181.64KB --0.05% 耗时最小:14 ms 耗时最大:374 ms 平均耗时:34.35ms 中位耗时:24.00ms -消息名:shop.getlist 请求次数:3000 请求数据:5.86KB --0.01% 接收数据:3.12MB --0.94% 耗时最小:17 ms 耗时最大:135 ms 平均耗时:37.61ms 中位耗时:27.00ms -消息名:passon.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:272.46KB --0.08% 耗时最小:14 ms 耗时最大:347 ms 平均耗时:34.47ms 中位耗时:23.00ms -消息名:dailytask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:168 ms 平均耗时:34.54ms 中位耗时:23.00ms -消息名:wtask.battlefinish 请求次数:10359 请求数据:0.00B --0.00% 接收数据:382.91KB --0.11% 耗时最小:27 ms 耗时最大:179 ms 平均耗时:52.78ms 中位耗时:45.00ms -消息名:arena.matche 请求次数:3000 请求数据:0.00B --0.00% 接收数据:20.82MB --6.27% 耗时最小:19 ms 耗时最大:178 ms 平均耗时:40.73ms 中位耗时:31.00ms -消息名:items.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:1.19MB --0.36% 耗时最小:17 ms 耗时最大:154 ms 平均耗时:36.71ms 中位耗时:27.00ms -消息名:wtask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:257.81KB --0.08% 耗时最小:15 ms 耗时最大:284 ms 平均耗时:34.82ms 中位耗时:24.00ms -消息名:pagoda.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:178.71KB --0.05% 耗时最小:15 ms 耗时最大:115 ms 平均耗时:34.35ms 中位耗时:23.00ms -消息名:practice.info 请求次数:18000 请求数据:0.00B --0.00% 接收数据:1.73MB --0.52% 耗时最小:14 ms 耗时最大:166 ms 平均耗时:32.80ms 中位耗时:23.00ms -消息名:integral.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:190.43KB --0.06% 耗时最小:15 ms 耗时最大:134 ms 平均耗时:35.33ms 中位耗时:24.00ms -消息名:arena.challengereward 请求次数:15000 请求数据:25.82MB --40.53% 接收数据:102.54KB --0.03% 耗时最小:17 ms 耗时最大:230 ms 平均耗时:36.79ms 中位耗时:27.00ms -消息名:horoscope.upgrade 请求次数:3000 请求数据:11.72KB --0.02% 接收数据:14.65KB --0.00% 耗时最小:25 ms 耗时最大:223 ms 平均耗时:52.10ms 中位耗时:45.00ms -消息名:mail.getnewmail 推送次数:3000 数据大小:357.42KB --0.11% -消息名:user.loginqueuechange 推送次数:3000 数据大小:5.86KB --0.00% -消息名:friend.addagree 推送次数:2154 数据大小:194.84KB --0.06% -消息名:library.change 推送次数:5781 数据大小:1.42MB --0.43% -消息名:items.change 推送次数:105357 数据大小:15.02MB --4.53% -消息名:dragon.change 推送次数:3000 数据大小:826.17KB --0.24% -消息名:user.skinlist 推送次数:3000 数据大小:263.67KB --0.08% -消息名:wtask.acceptchange 推送次数:17154 数据大小:429.29KB --0.13% -消息名:chat.message 推送次数:693504 数据大小:90.35MB --27.22% -消息名:equipment.change 推送次数:31077 数据大小:3.45MB --1.04% -消息名:user.lvchanged 推送次数:19281 数据大小:653.39KB --0.19% -消息名:notify.errornotify 推送次数:1 数据大小:84.00B --0.00% -消息名:user.reschanged 推送次数:191025 数据大小:3.76MB --1.13% -消息名:wtask.boxchange 推送次数:1359 数据大小:18.58KB --0.01% -消息名:hero.change 推送次数:62017 数据大小:76.98MB --23.19% -消息名:wtask.activationschange 推送次数:35154 数据大小:587.56KB --0.17% -消息名:passon.lvchange 推送次数:25722 数据大小:50.24KB --0.01% -消息名:friend.addapply 推送次数:4346 数据大小:393.14KB --0.12% +消息名:wtask.boxreceive 请求次数:1361 请求数据:0.00B --0.00% 接收数据:69.11KB --0.02% 耗时最小:15 ms 耗时最大:185 ms 平均耗时:32.17ms 中位耗时:27.00ms +消息名:viking.challenge 请求次数:6000 请求数据:802.73KB --1.22% 接收数据:7.91MB --2.30% 耗时最小:19 ms 耗时最大:354 ms 平均耗时:42.87ms 中位耗时:34.00ms +消息名:hero.talentlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:145 ms 平均耗时:22.43ms 中位耗时:21.00ms +消息名:gm.cmd 请求次数:48000 请求数据:993.16KB --1.50% 接收数据:181.64KB --0.05% 耗时最小:13 ms 耗时最大:251 ms 平均耗时:25.76ms 中位耗时:22.00ms +消息名:mainline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:237.30KB --0.07% 耗时最小:15 ms 耗时最大:303 ms 平均耗时:27.41ms 中位耗时:23.00ms +消息名:friend.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:302.50KB --0.09% 耗时最小:14 ms 耗时最大:96 ms 平均耗时:21.19ms 中位耗时:20.00ms +消息名:mail.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:357.42KB --0.10% 耗时最小:14 ms 耗时最大:115 ms 平均耗时:22.08ms 中位耗时:20.00ms +消息名:wtask.battlestart 请求次数:10361 请求数据:0.00B --0.00% 接收数据:18.28MB --5.32% 耗时最小:15 ms 耗时最大:399 ms 平均耗时:31.24ms 中位耗时:26.00ms +消息名:viking.challengeover 请求次数:6000 请求数据:7.94MB --12.31% 接收数据:1.45MB --0.42% 耗时最小:29 ms 耗时最大:644 ms 平均耗时:84.24ms 中位耗时:64.00ms +消息名:arena.matche 请求次数:3000 请求数据:0.00B --0.00% 接收数据:20.82MB --6.06% 耗时最小:19 ms 耗时最大:488 ms 平均耗时:31.06ms 中位耗时:27.00ms +消息名:pagoda.challenge 请求次数:6000 请求数据:791.02KB --1.20% 接收数据:9.78MB --2.85% 耗时最小:16 ms 耗时最大:313 ms 平均耗时:32.50ms 中位耗时:27.00ms +消息名:horoscope.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.05% 耗时最小:14 ms 耗时最大:124 ms 平均耗时:22.14ms 中位耗时:20.00ms +消息名:dailytask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:121 ms 平均耗时:24.70ms 中位耗时:22.00ms +消息名:integral.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:190.43KB --0.05% 耗时最小:16 ms 耗时最大:168 ms 平均耗时:27.27ms 中位耗时:24.00ms +消息名:wtask.accept 请求次数:39527 请求数据:154.40KB --0.23% 接收数据:1.39MB --0.40% 耗时最小:15 ms 耗时最大:479 ms 平均耗时:28.91ms 中位耗时:24.00ms +消息名:wtask.finish 请求次数:36527 请求数据:142.68KB --0.22% 接收数据:4.08MB --1.19% 耗时最小:15 ms 耗时最大:566 ms 平均耗时:40.81ms 中位耗时:32.00ms +消息名:mainline.challengeover 请求次数:13083 请求数据:12.58MB --19.52% 接收数据:2.19MB --0.64% 耗时最小:26 ms 耗时最大:763 ms 平均耗时:79.66ms 中位耗时:60.00ms +消息名:friend.randlist 请求次数:4397 请求数据:0.00B --0.00% 接收数据:1.72MB --0.50% 耗时最小:17 ms 耗时最大:456 ms 平均耗时:28.73ms 中位耗时:26.00ms +消息名:horoscope.upgrade 请求次数:3000 请求数据:11.72KB --0.02% 接收数据:14.65KB --0.00% 耗时最小:25 ms 耗时最大:323 ms 平均耗时:64.49ms 中位耗时:51.00ms +消息名:smithy.getstoveinfo 请求次数:15000 请求数据:0.00B --0.00% 接收数据:937.50KB --0.27% 耗时最小:14 ms 耗时最大:475 ms 平均耗时:24.21ms 中位耗时:21.00ms +消息名:user.login 请求次数:3000 请求数据:42.86KB --0.06% 接收数据:505.75KB --0.14% 耗时最小:20 ms 耗时最大:205 ms 平均耗时:37.93ms 中位耗时:31.00ms +消息名:arena.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:426.65KB --0.12% 耗时最小:14 ms 耗时最大:111 ms 平均耗时:23.33ms 中位耗时:22.00ms +消息名:practice.info 请求次数:18000 请求数据:0.00B --0.00% 接收数据:1.73MB --0.50% 耗时最小:14 ms 耗时最大:562 ms 平均耗时:23.91ms 中位耗时:22.00ms +消息名:storyline.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:172.85KB --0.05% 耗时最小:15 ms 耗时最大:142 ms 平均耗时:24.77ms 中位耗时:22.00ms +消息名:viking.getlist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:410.16KB --0.12% 耗时最小:14 ms 耗时最大:436 ms 平均耗时:25.46ms 中位耗时:22.00ms +消息名:pagoda.challengeover 请求次数:6000 请求数据:9.81MB --15.21% 接收数据:404.30KB --0.11% 耗时最小:24 ms 耗时最大:499 ms 平均耗时:75.37ms 中位耗时:58.00ms +消息名:items.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:1.19MB --0.35% 耗时最小:16 ms 耗时最大:176 ms 平均耗时:30.60ms 中位耗时:25.00ms +消息名:wtask.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:257.81KB --0.07% 耗时最小:15 ms 耗时最大:143 ms 平均耗时:26.05ms 中位耗时:23.00ms +消息名:pagoda.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:178.71KB --0.05% 耗时最小:15 ms 耗时最大:109 ms 平均耗时:24.86ms 中位耗时:22.00ms +消息名:passon.info 请求次数:3000 请求数据:0.00B --0.00% 接收数据:272.46KB --0.08% 耗时最小:15 ms 耗时最大:116 ms 平均耗时:25.18ms 中位耗时:22.00ms +消息名:equipment.upgrade 请求次数:60000 请求数据:1.49MB --2.31% 接收数据:7.14MB --2.08% 耗时最小:16 ms 耗时最大:609 ms 平均耗时:28.28ms 中位耗时:23.00ms +消息名:hero.list 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:106 ms 平均耗时:25.41ms 中位耗时:23.00ms +消息名:shop.getlist 请求次数:3000 请求数据:5.86KB --0.01% 接收数据:3.13MB --0.91% 耗时最小:17 ms 耗时最大:143 ms 平均耗时:30.80ms 中位耗时:26.00ms +消息名:sys.funcgetlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:5.54MB --1.61% 耗时最小:16 ms 耗时最大:128 ms 平均耗时:25.59ms 中位耗时:23.00ms +消息名:wtask.battlefinish 请求次数:10361 请求数据:0.00B --0.00% 接收数据:382.95KB --0.11% 耗时最小:27 ms 耗时最大:528 ms 平均耗时:68.40ms 中位耗时:52.00ms +消息名:mainline.levelpass 请求次数:27805 请求数据:82.03KB --0.12% 接收数据:1.33MB --0.39% 耗时最小:14 ms 耗时最大:441 ms 平均耗时:29.43ms 中位耗时:24.00ms +消息名:friend.applylist 请求次数:6000 请求数据:0.00B --0.00% 接收数据:124.84KB --0.04% 耗时最小:14 ms 耗时最大:372 ms 平均耗时:22.69ms 中位耗时:21.00ms +消息名:dragon.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:826.17KB --0.23% 耗时最小:14 ms 耗时最大:124 ms 平均耗时:23.84ms 中位耗时:21.00ms +消息名:hero.drawcard 请求次数:3000 请求数据:17.58KB --0.03% 接收数据:1.95MB --0.57% 耗时最小:31 ms 耗时最大:746 ms 平均耗时:101.06ms 中位耗时:69.00ms +消息名:wtask.completecondi 请求次数:15000 请求数据:0.00B --0.00% 接收数据:644.53KB --0.18% 耗时最小:15 ms 耗时最大:407 ms 平均耗时:29.17ms 中位耗时:25.00ms +消息名:arena.challengereward 请求次数:15000 请求数据:25.82MB --40.06% 接收数据:102.54KB --0.03% 耗时最小:17 ms 耗时最大:352 ms 平均耗时:31.61ms 中位耗时:27.00ms +消息名:mail.getusermailattachment 请求次数:3000 请求数据:76.17KB --0.12% 接收数据:369.14KB --0.10% 耗时最小:17 ms 耗时最大:161 ms 平均耗时:31.24ms 中位耗时:27.00ms +消息名:user.create 请求次数:3000 请求数据:60.44KB --0.09% 接收数据:60.44KB --0.02% 耗时最小:20 ms 耗时最大:195 ms 平均耗时:37.74ms 中位耗时:30.00ms +消息名:equipment.getlist 请求次数:3000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:94 ms 平均耗时:22.27ms 中位耗时:21.00ms +消息名:mainline.challenge 请求次数:13083 请求数据:1.18MB --1.82% 接收数据:17.98MB --5.23% 耗时最小:18 ms 耗时最大:519 ms 平均耗时:40.96ms 中位耗时:30.00ms +消息名:arena.challenge 请求次数:15000 请求数据:2.35MB --3.64% 接收数据:25.45MB --7.41% 耗时最小:19 ms 耗时最大:480 ms 平均耗时:35.82ms 中位耗时:30.00ms +消息名:friend.apply 请求次数:4395 请求数据:133.05KB --0.20% 接收数据:266.10KB --0.08% 耗时最小:15 ms 耗时最大:624 ms 平均耗时:26.21ms 中位耗时:23.00ms +消息名:friend.agree 请求次数:1603 请求数据:63.06KB --0.10% 接收数据:71.78KB --0.02% 耗时最小:16 ms 耗时最大:471 ms 平均耗时:29.14ms 中位耗时:25.00ms +消息名:chat.message 推送次数:626607 数据大小:97.83MB --28.47% +消息名:items.change 推送次数:105300 数据大小:15.00MB --4.37% +消息名:library.change 推送次数:5829 数据大小:1.42MB --0.41% +消息名:wtask.boxchange 推送次数:1361 数据大小:18.61KB --0.01% +消息名:wtask.acceptchange 推送次数:17166 数据大小:429.54KB --0.12% +消息名:user.reschanged 推送次数:221092 数据大小:4.41MB --1.28% +消息名:equipment.change 推送次数:31083 数据大小:3.45MB --1.00% +消息名:user.skinlist 推送次数:3000 数据大小:263.67KB --0.07% +消息名:friend.addagree 推送次数:2083 数据大小:188.50KB --0.05% +消息名:hero.change 推送次数:62103 数据大小:77.02MB --22.41% +消息名:friend.addapply 推送次数:4395 数据大小:397.54KB --0.11% +消息名:dragon.change 推送次数:3000 数据大小:826.17KB --0.23% +消息名:wtask.activationschange 推送次数:35166 数据大小:587.80KB --0.17% +消息名:user.lvchanged 推送次数:19316 数据大小:654.58KB --0.19% +消息名:mail.getnewmail 推送次数:3000 数据大小:357.42KB --0.10% +消息名:passon.lvchange 推送次数:25817 数据大小:50.42KB --0.01% diff --git a/bin/压力测试报告105.txt b/bin/压力测试报告105.txt new file mode 100644 index 000000000..8ac5b24a6 --- /dev/null +++ b/bin/压力测试报告105.txt @@ -0,0 +1,77 @@ +机器人总数: 5000 +成功数量: 5000 +失败数量: 0 +最大同时在线人数: 5000 +消息总请求数: 759770 +消息总请求大小: 107.40MB +消息总接收数: 3571217 +消息总接收大小: 646.03MB +压测执行时长: 739.37秒 +QPS: 1027.59 +---消息压测详情---------------------------------------------------------------------------------------------------- +消息名:equipment.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:737 ms 平均耗时:37.18ms 中位耗时:24.00ms +消息名:horoscope.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:288.09KB --0.04% 耗时最小:14 ms 耗时最大:841 ms 平均耗时:39.85ms 中位耗时:24.00ms +消息名:wtask.battlefinish 请求次数:17217 请求数据:0.00B --0.00% 接收数据:637.39KB --0.10% 耗时最小:26 ms 耗时最大:1639 ms 平均耗时:334.36ms 中位耗时:218.00ms +消息名:pagoda.challengeover 请求次数:10000 请求数据:16.34MB --15.22% 接收数据:673.83KB --0.10% 耗时最小:24 ms 耗时最大:1791 ms 平均耗时:352.56ms 中位耗时:227.00ms +消息名:horoscope.upgrade 请求次数:5000 请求数据:19.53KB --0.02% 接收数据:24.41KB --0.00% 耗时最小:24 ms 耗时最大:1351 ms 平均耗时:284.57ms 中位耗时:205.00ms +消息名:hero.talentlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:653 ms 平均耗时:35.14ms 中位耗时:23.00ms +消息名:arena.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:711.81KB --0.11% 耗时最小:15 ms 耗时最大:700 ms 平均耗时:38.70ms 中位耗时:26.00ms +消息名:shop.getlist 请求次数:5000 请求数据:9.77KB --0.01% 接收数据:5.22MB --0.81% 耗时最小:17 ms 耗时最大:708 ms 平均耗时:69.95ms 中位耗时:40.00ms +消息名:passon.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:454.10KB --0.07% 耗时最小:15 ms 耗时最大:646 ms 平均耗时:48.48ms 中位耗时:30.00ms +消息名:dailytask.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:14 ms 耗时最大:762 ms 平均耗时:50.77ms 中位耗时:31.00ms +消息名:wtask.finish 请求次数:60519 请求数据:236.40KB --0.21% 接收数据:6.75MB --1.04% 耗时最小:16 ms 耗时最大:1439 ms 平均耗时:158.96ms 中位耗时:104.00ms +消息名:mainline.challenge 请求次数:21651 请求数据:1.96MB --1.82% 接收数据:29.75MB --4.61% 耗时最小:19 ms 耗时最大:1421 ms 平均耗时:170.15ms 中位耗时:109.00ms +消息名:mainline.levelpass 请求次数:46085 请求数据:136.72KB --0.12% 接收数据:2.21MB --0.34% 耗时最小:15 ms 耗时最大:1211 ms 平均耗时:81.94ms 中位耗时:48.00ms +消息名:wtask.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:429.69KB --0.06% 耗时最小:15 ms 耗时最大:998 ms 平均耗时:56.38ms 中位耗时:32.00ms +消息名:friend.agree 请求次数:2347 请求数据:90.25KB --0.08% 接收数据:100.30KB --0.02% 耗时最小:16 ms 耗时最大:744 ms 平均耗时:59.34ms 中位耗时:45.00ms +消息名:arena.challenge 请求次数:25000 请求数据:3.91MB --3.64% 接收数据:42.42MB --6.57% 耗时最小:19 ms 耗时最大:1030 ms 平均耗时:82.67ms 中位耗时:64.00ms +消息名:practice.info 请求次数:30000 请求数据:0.00B --0.00% 接收数据:2.89MB --0.45% 耗时最小:14 ms 耗时最大:856 ms 平均耗时:46.12ms 中位耗时:29.00ms +消息名:wtask.accept 请求次数:65562 请求数据:256.10KB --0.23% 接收数据:2.32MB --0.36% 耗时最小:15 ms 耗时最大:1144 ms 平均耗时:82.70ms 中位耗时:55.00ms +消息名:viking.getlist 请求次数:10000 请求数据:0.00B --0.00% 接收数据:683.59KB --0.10% 耗时最小:14 ms 耗时最大:830 ms 平均耗时:55.33ms 中位耗时:34.00ms +消息名:pagoda.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:297.85KB --0.05% 耗时最小:14 ms 耗时最大:675 ms 平均耗时:47.12ms 中位耗时:29.00ms +消息名:sys.funcgetlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:9.23MB --1.43% 耗时最小:15 ms 耗时最大:729 ms 平均耗时:52.51ms 中位耗时:32.00ms +消息名:equipment.upgrade 请求次数:100000 请求数据:2.48MB --2.31% 接收数据:11.89MB --1.84% 耗时最小:16 ms 耗时最大:1330 ms 平均耗时:88.47ms 中位耗时:32.00ms +消息名:smithy.getstoveinfo 请求次数:25000 请求数据:0.00B --0.00% 接收数据:1.53MB --0.24% 耗时最小:13 ms 耗时最大:1106 ms 平均耗时:51.03ms 中位耗时:30.00ms +消息名:friend.applylist 请求次数:10000 请求数据:0.00B --0.00% 接收数据:179.21KB --0.03% 耗时最小:14 ms 耗时最大:777 ms 平均耗时:41.01ms 中位耗时:26.00ms +消息名:user.create 请求次数:5000 请求数据:101.46KB --0.09% 接收数据:101.46KB --0.02% 耗时最小:20 ms 耗时最大:1095 ms 平均耗时:97.07ms 中位耗时:51.00ms +消息名:wtask.battlestart 请求次数:17217 请求数据:0.00B --0.00% 接收数据:30.40MB --4.71% 耗时最小:16 ms 耗时最大:1049 ms 平均耗时:92.34ms 中位耗时:61.00ms +消息名:mainline.challengeover 请求次数:21651 请求数据:20.96MB --19.51% 接收数据:3.63MB --0.56% 耗时最小:28 ms 耗时最大:2619 ms 平均耗时:401.21ms 中位耗时:234.00ms +消息名:viking.challengeover 请求次数:10000 请求数据:13.22MB --12.31% 接收数据:2.41MB --0.37% 耗时最小:28 ms 耗时最大:1954 ms 平均耗时:396.37ms 中位耗时:260.00ms +消息名:friend.list 请求次数:5000 请求数据:0.00B --0.00% 接收数据:503.37KB --0.08% 耗时最小:14 ms 耗时最大:622 ms 平均耗时:33.28ms 中位耗时:23.00ms +消息名:wtask.completecondi 请求次数:25000 请求数据:0.00B --0.00% 接收数据:1.05MB --0.16% 耗时最小:15 ms 耗时最大:894 ms 平均耗时:80.73ms 中位耗时:49.00ms +消息名:wtask.boxreceive 请求次数:2217 请求数据:0.00B --0.00% 接收数据:112.58KB --0.02% 耗时最小:16 ms 耗时最大:719 ms 平均耗时:100.15ms 中位耗时:76.00ms +消息名:integral.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:317.38KB --0.05% 耗时最小:16 ms 耗时最大:807 ms 平均耗时:61.59ms 中位耗时:35.00ms +消息名:storyline.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:288.09KB --0.04% 耗时最小:15 ms 耗时最大:746 ms 平均耗时:51.01ms 中位耗时:30.00ms +消息名:dragon.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:1.34MB --0.21% 耗时最小:14 ms 耗时最大:737 ms 平均耗时:48.33ms 中位耗时:28.00ms +消息名:mail.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:595.70KB --0.09% 耗时最小:14 ms 耗时最大:698 ms 平均耗时:35.15ms 中位耗时:22.00ms +消息名:hero.drawcard 请求次数:5000 请求数据:29.30KB --0.03% 接收数据:3.24MB --0.50% 耗时最小:30 ms 耗时最大:2559 ms 平均耗时:474.03ms 中位耗时:212.00ms +消息名:viking.challenge 请求次数:10000 请求数据:1.31MB --1.22% 接收数据:13.18MB --2.04% 耗时最小:19 ms 耗时最大:1122 ms 平均耗时:167.75ms 中位耗时:114.00ms +消息名:mail.getusermailattachment 请求次数:5000 请求数据:126.95KB --0.12% 接收数据:615.23KB --0.09% 耗时最小:16 ms 耗时最大:785 ms 平均耗时:80.56ms 中位耗时:55.00ms +消息名:items.getlist 请求次数:5000 请求数据:0.00B --0.00% 接收数据:2.00MB --0.31% 耗时最小:16 ms 耗时最大:735 ms 平均耗时:75.82ms 中位耗时:41.00ms +消息名:hero.list 请求次数:5000 请求数据:0.00B --0.00% 接收数据:0.00B --0.00% 耗时最小:15 ms 耗时最大:720 ms 平均耗时:50.75ms 中位耗时:30.00ms +消息名:gm.cmd 请求次数:80000 请求数据:1.62MB --1.51% 接收数据:302.73KB --0.05% 耗时最小:6 ms 耗时最大:813 ms 平均耗时:50.30ms 中位耗时:27.00ms +消息名:mainline.info 请求次数:5000 请求数据:0.00B --0.00% 接收数据:395.51KB --0.06% 耗时最小:16 ms 耗时最大:662 ms 平均耗时:59.91ms 中位耗时:34.00ms +消息名:arena.matche 请求次数:5000 请求数据:0.00B --0.00% 接收数据:34.70MB --5.37% 耗时最小:19 ms 耗时最大:891 ms 平均耗时:74.02ms 中位耗时:64.00ms +消息名:arena.challengereward 请求次数:25000 请求数据:43.04MB --40.07% 接收数据:170.90KB --0.03% 耗时最小:18 ms 耗时最大:1066 ms 平均耗时:65.98ms 中位耗时:48.00ms +消息名:pagoda.challenge 请求次数:10000 请求数据:1.29MB --1.20% 接收数据:16.30MB --2.52% 耗时最小:17 ms 耗时最大:1095 ms 平均耗时:100.36ms 中位耗时:66.00ms +消息名:friend.randlist 请求次数:7653 请求数据:0.00B --0.00% 接收数据:2.99MB --0.46% 耗时最小:16 ms 耗时最大:873 ms 平均耗时:66.61ms 中位耗时:48.00ms +消息名:user.login 请求次数:5000 请求数据:72.16KB --0.07% 接收数据:843.65KB --0.13% 耗时最小:19 ms 耗时最大:80423ms 平均耗时:16440.62ms 中位耗时:92.00ms +消息名:friend.apply 请求次数:7651 请求数据:231.62KB --0.21% 接收数据:463.24KB --0.07% 耗时最小:14 ms 耗时最大:862 ms 平均耗时:52.07ms 中位耗时:37.00ms +消息名:library.change 推送次数:9682 数据大小:2.36MB --0.37% +消息名:wtask.boxchange 推送次数:2217 数据大小:30.31KB --0.00% +消息名:friend.addagree 推送次数:2981 数据大小:269.99KB --0.04% +消息名:user.loginqueuechange 推送次数:77411 数据大小:205.29KB --0.03% +消息名:equipment.change 推送次数:51651 数据大小:5.72MB --0.89% +消息名:wtask.acceptchange 推送次数:28302 数据大小:709.53KB --0.11% +消息名:passon.lvchange 推送次数:43178 数据大小:84.33KB --0.01% +消息名:dragon.change 推送次数:5000 数据大小:1.34MB --0.21% +消息名:chat.message 推送次数:1753706 数据大小:236.57MB --36.62% +消息名:mail.getnewmail 推送次数:5000 数据大小:595.70KB --0.09% +消息名:user.reschanged 推送次数:371863 数据大小:7.41MB --1.15% +消息名:wtask.activationschange 推送次数:58302 数据大小:973.70KB --0.15% +消息名:hero.change 推送次数:103253 数据大小:128.13MB --19.83% +消息名:friend.addapply 推送次数:7647 数据大小:692.90KB --0.10% +消息名:items.change 推送次数:174863 数据大小:24.94MB --3.86% +消息名:user.skinlist 推送次数:5000 数据大小:439.45KB --0.07% +消息名:notify.errornotify 推送次数:2 数据大小:168.00B --0.00% +消息名:user.lvchanged 推送次数:36391 数据大小:1.21MB --0.19% diff --git a/comm/const.go b/comm/const.go index 43ada34a9..331aefcef 100644 --- a/comm/const.go +++ b/comm/const.go @@ -1166,5 +1166,6 @@ const ( //session Session 临时数据key const ( - Session_User = "user" + Session_User = "user" + Session_UserExpand = "userexpand" ) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 22b80a320..7a36bac4a 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -311,16 +311,15 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq heroRecord.Cur = szCards update["selectcount"] = heroRecord.Selectcount update["cur"] = heroRecord.Cur - } else { // 非模拟抽不发奖 - - this.module.DispenseAtno(session, allres, true) } this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update) if req.DrawType != 1 { - if errdata, atno = this.module.DispenseAtno(session, reward, true); errdata != nil { // 发放许愿石奖励 - return - } + allres = append(allres, reward...) + + } + if errdata, atno = this.module.DispenseAtno(session, allres, true); errdata != nil { //同意发送奖励 + return } session.SendMsg(string(this.module.GetType()), DrawCard, rsp) diff --git a/modules/hero/api_strengthenUplv.go b/modules/hero/api_strengthenUplv.go index 7f8a86e30..9e867d2cd 100644 --- a/modules/hero/api_strengthenUplv.go +++ b/modules/hero/api_strengthenUplv.go @@ -86,7 +86,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren return } // 执行升级逻辑 - if _, errdata = this.module.modelHero.AddCardExp(session, _hero, addExp, nil); errdata != nil { // 加经验 + if _, errdata = this.module.modelHero.AddCardExp(session, []*pb.DBHero{_hero}, addExp, nil); errdata != nil { // 加经验 return } // 消耗金币 diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index e7c253765..460423cca 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -169,6 +169,15 @@ func (this *ModelHero) getOneHero(uid, heroId string) *pb.DBHero { return hero } +// 获取一个英雄(参数唯一objID) +func (this *ModelHero) getHeros(uid string, heroIds []string) (heros []*pb.DBHero, err error) { + heros = make([]*pb.DBHero, 0) + if err = this.GetListObjs(uid, heroIds, &heros); err != nil { + return + } + return +} + // 消耗英雄卡 func (this *ModelHero) consumeHeroCard(uid string, hero *pb.DBHero) (err error) { @@ -389,161 +398,176 @@ func (this *ModelHero) cleanData(uid string) { } } -func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, exp int32, model *db.DBModel) (curAddExp int32, errdata *pb.ErrorData) { +func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero, exp int32, model *db.DBModel) (curAddExp []int32, errdata *pb.ErrorData) { var ( - preLv int32 //加经验之前的等级 - curExp int32 // 加经验之后的经验 - curLv int32 // 加经验之后的等级 - update map[string]interface{} // 属性变化 + tasks []*pb.BuriedParam + changeupdate map[string]interface{} = make(map[string]interface{}) + maxlvhero *pb.DBHero ) - if hero == nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_HeroNoExist, - Title: pb.ErrorCode_HeroNoExist.ToString(), - } - return - } - update = make(map[string]interface{}, 0) - curExp = hero.Exp - curLv = hero.Lv - preLv = curLv - var maxLv int32 // 校验等级达到上限 - maxLv = this.module.configure.GetHeroMaxLv(hero.Star) - // 校验玩家等级 - if _user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { - if expConf := this.module.configure.GetPlayerlvConf(_user.Lv); expConf != nil { - if maxLv > expConf.HeroLv { - maxLv = expConf.HeroLv // 英雄最大等级限制 - } - } - } - - _data := this.module.configure.GetHeroLv(curLv) - if _data == nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ConfigNoFound, - Title: pb.ErrorCode_ConfigNoFound.ToString(), - } - return - } - - var maxExp int32 - maxExp = _data.Heroexp - if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 - curAddExp = 0 // 已经满级的时候 - //code = pb.ErrorCode_HeroMaxLv // - this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp) - return - } - curExp += exp // 先把经验加上 - for { // 死循环判断一键升级 - if _data.Heroexp == 0 { - curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 - curExp = 0 - break - } - maxExp = _data.Heroexp - if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级 - curAddExp = exp - (curExp - maxExp) // 减去超过部分的经验 - curLv = maxLv - curExp = maxExp - break - } - if maxExp > curExp { // 经验不够升级则不能执行升级操作 - break - } else { // 升级操作 - curExp -= maxExp - curLv += 1 // 经验够了 那么等级+1 - _data = this.module.configure.GetHeroLv(curLv) - if _data == nil { // 等级加失败了 回到原来的等级 - curLv -= 1 - break - } - } - } - - if curAddExp != 0 { - curAddExp = exp // 真正加的经验 - } - - this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp) - update["lv"] = curLv - update["exp"] = curExp - - hero.Lv = curLv - hero.Exp = curExp - if curLv-preLv > 0 { // 升级了 统计任务 - this.PropertyCompute(hero) - update["property"] = hero.Property - update["horoscopeProperty"] = hero.HoroscopeProperty - update["talentProperty"] = hero.TalentProperty - update["juexProperty"] = hero.JuexProperty - } - if model != nil { - if err := model.ChangeList(session.GetUserId(), hero.Id, update); err != nil { - this.module.Errorf("add hero exp failed ChangeList %v", err) + curAddExp = make([]int32, len(heros)) + for i, hero := range heros { + var ( + preLv int32 //加经验之前的等级 + curExp int32 // 加经验之后的经验 + curLv int32 // 加经验之后的等级 + update map[string]interface{} // 属性变化 + ) + if hero == nil { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), + Code: pb.ErrorCode_HeroNoExist, + Title: pb.ErrorCode_HeroNoExist.ToString(), } + return } - } else { - if err := this.ChangeList(session.GetUserId(), hero.Id, update); err != nil { - this.module.Errorf("add hero exp failed ChangeList %v", err) - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_DBError, - Title: pb.ErrorCode_DBError.ToString(), - Message: err.Error(), - } - } - } - - if curLv-preLv > 0 { // 升级了 统计任务 - var tasks []*pb.BuriedParam - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, curLv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) - // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) - if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) - //xx英雄满级、共鸣、觉醒至最高状态 - nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) - if nextAwaken == nil { // 达到满级觉醒 - if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { - var _l int32 - talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) - if err == nil { - for _, v := range talent { - if v.HeroId == hero.HeroID { - _l = int32(len(v.Talent)) - break - } - } - } - if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) - iHeroId, _ := strconv.Atoi(hero.HeroID) - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId))) - } + update = make(map[string]interface{}, 0) + curExp = hero.Exp + curLv = hero.Lv + preLv = curLv + var maxLv int32 // 校验等级达到上限 + maxLv = this.module.configure.GetHeroMaxLv(hero.Star) + // 校验玩家等级 + if _user, err := this.module.ModuleUser.GetUser(session.GetUserId()); err == nil { + if expConf := this.module.configure.GetPlayerlvConf(_user.Lv); expConf != nil { + if maxLv > expConf.HeroLv { + maxLv = expConf.HeroLv // 英雄最大等级限制 } } } - tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv)) - tasks = append(tasks, comm.GetBuriedParam(comm.Rtype118, hero.Lv, hero.JuexingLv)) - go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.passon.HeroUpLv(session, hero.HeroID, curLv) - this.module.ModuleBuried.TriggerBuried(session, tasks...) - }) + _data := this.module.configure.GetHeroLv(curLv) + if _data == nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + } + return + } + + var maxExp int32 + maxExp = _data.Heroexp + if maxLv <= curLv && curExp >= maxExp { // 加经验之前校验是否达到最大等级 + curAddExp[i] = 0 // 已经满级的时候 + //code = pb.ErrorCode_HeroMaxLv // + this.module.Debugf("英雄已经满级 不需要升级heroid:%s,addexp:%d", hero.Id, exp) + return + } + curExp += exp // 先把经验加上 + for { // 死循环判断一键升级 + if _data.Heroexp == 0 { + curAddExp[i] = exp - (curExp - maxExp) // 减去超过部分的经验 + curExp = 0 + break + } + maxExp = _data.Heroexp + if maxLv <= curLv && curExp >= maxExp { // 设置最大经验和等级 + curAddExp[i] = exp - (curExp - maxExp) // 减去超过部分的经验 + curLv = maxLv + curExp = maxExp + break + } + if maxExp > curExp { // 经验不够升级则不能执行升级操作 + break + } else { // 升级操作 + curExp -= maxExp + curLv += 1 // 经验够了 那么等级+1 + _data = this.module.configure.GetHeroLv(curLv) + if _data == nil { // 等级加失败了 回到原来的等级 + curLv -= 1 + break + } + } + } + + if curAddExp[i] != 0 { + curAddExp[i] = exp // 真正加的经验 + } + + this.module.Debugf("add hero exp :old lv:%d,old exp:%d,new lv:%d,new exp:%d,addexp:%d", hero.Lv, hero.Exp, curLv, curExp, exp) + update["lv"] = curLv + update["exp"] = curExp + + hero.Lv = curLv + hero.Exp = curExp + if curLv-preLv > 0 { // 升级了 统计任务 + if maxlvhero == nil || curLv > maxlvhero.Lv { + maxlvhero = hero + } + this.PropertyCompute(hero) + update["property"] = hero.Property + update["horoscopeProperty"] = hero.HoroscopeProperty + update["talentProperty"] = hero.TalentProperty + update["juexProperty"] = hero.JuexProperty + } + changeupdate[hero.Id] = update + if curLv-preLv > 0 { // 升级了 统计任务 + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, curLv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype24, curLv-preLv)) + // szTask = append(szTask, comm.GetBuriedParam(comm.Rtype29, 1, hero.Lv, utils.ToInt32(hero.HeroID))) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype23, hero.HeroID, hero.Star, hero.Lv)) + if cfg, _ := this.module.configure.GetHeroConfig(hero.HeroID); cfg != nil { + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype32, hero.HeroID, cfg.Color, hero.Lv)) + //xx英雄满级、共鸣、觉醒至最高状态 + nextAwaken, _ := this.module.configure.GetHeroAwakenConfig(hero.HeroID, hero.JuexingLv+1) + if nextAwaken == nil { // 达到满级觉醒 + if hero.Lv == this.module.configure.GetHeroMaxLv(hero.Star) { + var _l int32 + talent, err := this.module.modelTalent.GetHerotalent(session.GetUserId()) + if err == nil { + for _, v := range talent { + if v.HeroId == hero.HeroID { + _l = int32(len(v.Talent)) + break + } + } + } + if this.module.configure.GetHeroTalentMaxLv(hero.HeroID) == _l { + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype37, hero.HeroID, cfg.Color)) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype38, hero.HeroID)) + iHeroId, _ := strconv.Atoi(hero.HeroID) + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype243, hero.HeroID, int32(iHeroId))) + } + } + } + } + tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype111, hero.HeroID, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype112, 1, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype113, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype33, 1, 1, hero.Lv)) + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype118, hero.Lv, hero.JuexingLv)) + } } + + if model != nil { + if err := model.ChangeLists(session.GetUserId(), changeupdate); err != nil { + this.module.Errorln(err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + } else { + if err := this.ChangeLists(session.GetUserId(), changeupdate); err != nil { + this.module.Errorln(err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + } + + go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { + if maxlvhero != nil { + this.module.passon.HeroUpLv(session, maxlvhero.HeroID, maxlvhero.Lv) + } + this.module.ModuleBuried.TriggerBuried(session, tasks...) + }) return } diff --git a/modules/hero/module.go b/modules/hero/module.go index 678f9a0ce..5eac964e1 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -830,44 +830,67 @@ func (this *Hero) CheckPeachReward(session comm.IUserSession, ctime int64) { } return } + func (this *Hero) AddHerosExp(session comm.IUserSession, heroObjs []string, exp int32) (curAddExp []int32, errdata *pb.ErrorData) { var ( - _hero *pb.DBHero - _changeHero []*pb.DBHero // 变化的英雄 - addExp int32 + ids []string = make([]string, 0) + heros []*pb.DBHero + changeHero []*pb.DBHero // 变化的英雄 + addExp []int32 + err error ) - for _, heroObjID := range heroObjs { - if heroObjID == "" { - continue + curAddExp = make([]int32, len(heroObjs)) + for _, v := range heroObjs { + if v != "" { + ids = append(ids, v) } - if this.IsCross() { - _hero = &pb.DBHero{} - if model, err := this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName); err == nil { - if err := model.GetListObj(session.GetUserId(), heroObjID, _hero); err != nil { - this.Errorf("err:%v", err) - return - } - addExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, model) - if errdata == nil { - curAddExp = append(curAddExp, addExp) - } - } - } else { - _hero, errdata = this.GetHeroByObjID(session.GetUserId(), heroObjID) - if errdata != nil { - return - } - - addExp, errdata = this.modelHero.AddCardExp(session, _hero, exp, nil) - if errdata != nil { - curAddExp = append(curAddExp, addExp) - } - } - _changeHero = append(_changeHero, _hero) // 升级后的英雄 hero id 不变 } - if len(_changeHero) > 0 { - session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) + if this.IsCross() { + if model, err := this.GetDBModelByUid(session.GetUserId(), this.modelHero.TableName); err == nil { + if err := model.GetListObjs(session.GetUserId(), ids, &heros); err != nil { + this.Errorf("err:%v", err) + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + if addExp, errdata = this.modelHero.AddCardExp(session, heros, exp, model); errdata != nil { + return + } + for i, v := range heros { + for n, id := range heroObjs { + if v.Id == id { + curAddExp[n] = addExp[i] + } + } + } + changeHero = append(changeHero, heros...) + } + } else { + if heros, err = this.modelHero.getHeros(session.GetUserId(), ids); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Message: err.Error(), + } + return + } + + if addExp, errdata = this.modelHero.AddCardExp(session, heros, exp, nil); errdata != nil { + return + } + for i, v := range heros { + for n, id := range heroObjs { + if v.Id == id { + curAddExp[n] = addExp[i] + } + } + } + changeHero = append(changeHero, heros...) + } + if len(changeHero) > 0 { + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: changeHero}) } return } diff --git a/modules/mainline/api_challengeover.go b/modules/mainline/api_challengeover.go index 60dddde97..191c7de5d 100644 --- a/modules/mainline/api_challengeover.go +++ b/modules/mainline/api_challengeover.go @@ -157,6 +157,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MainlineCh } return } + session.SetMate(comm.Session_User, user) if lotteryward := this.module.ModuleTools.GetGroupDataByLottery(conf.Lotteryward, user.Vip, user.Lv); len(lotteryward) > 0 { if errdata, atno = this.module.DispenseAtno(session, lotteryward, true); errdata != nil { this.module.Debugf("Mline lotteryward DispenseRes err:+%v", lotteryward) diff --git a/modules/user/module.go b/modules/user/module.go index 5d0f67762..7dabc323b 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -477,32 +477,30 @@ func (this *User) change(session comm.IUserSession, attrs map[string]int32) (atn temp *pb.UserAtno err error ) - - user, err = this.GetUser(uid) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserSessionNobeing, - Title: pb.ErrorCode_UserSessionNobeing.ToString(), - Message: err.Error(), + if ok, userMate := session.GetMate(comm.Session_User); ok { + user = userMate.(*pb.DBUser) + } else { + if user, err = this.GetUser(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_UserSessionNobeing, + Title: pb.ErrorCode_UserSessionNobeing.ToString(), + Message: err.Error(), + } + return } - return - } - userEx, err = this.GetUserExpand(uid) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserExpandNull, - Title: pb.ErrorCode_UserExpandNull.ToString(), - Message: err.Error(), - } - return } - if user == nil || userEx == nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_UserSessionNobeing, - Title: pb.ErrorCode_UserSessionNobeing.ToString(), + if ok, userMate := session.GetMate(comm.Session_UserExpand); ok { + userEx = userMate.(*pb.DBUserExpand) + } else { + if userEx, err = this.GetUserExpand(uid); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_UserExpandNull, + Title: pb.ErrorCode_UserExpandNull.ToString(), + Message: err.Error(), + } + return } - return } change = &pb.UserResChangedPush{