From 4c775a46a9652b4577cf3cd3381290525f1edcf8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 17 Apr 2023 20:06:59 +0800 Subject: [PATCH] 1 --- server/tools/robot/kcpclient/clientnet.js | 156 +--------------------- server/tools/robot/kcpclient/testcase.js | 27 ++-- 2 files changed, 14 insertions(+), 169 deletions(-) diff --git a/server/tools/robot/kcpclient/clientnet.js b/server/tools/robot/kcpclient/clientnet.js index b23de10b..d82ebcba 100644 --- a/server/tools/robot/kcpclient/clientnet.js +++ b/server/tools/robot/kcpclient/clientnet.js @@ -47,19 +47,7 @@ class ClientNet { this.smMsgId = this.msgIdPb.lookup('SMMessageId_e'); } { - this.selfRegisterMsgHandle('SMLogin'); - this.selfRegisterMsgHandle('SMGuildCreate'); - this.selfRegisterMsgHandle('SMGuildInfo'); - this.selfRegisterMsgHandle('SMGuildMemberList'); - this.selfRegisterMsgHandle('SMGuildSearch'); - this.selfRegisterMsgHandle('SMGuildSearchMember'); - this.selfRegisterMsgHandle('SMGuildAgree'); - this.selfRegisterMsgHandle('SMGuildMemberSetJob'); - this.selfRegisterMsgHandle('SMGuildApplyList'); - this.selfRegisterMsgHandle('SMGuildChange'); - this.selfRegisterMsgHandle('SMGuildSetPermission'); - this.selfRegisterMsgHandle('SMUserInfoUpdate'); - this.selfRegisterMsgHandle('SMPing'); + //this.selfRegisterMsgHandle('SMLogin'); } } @@ -172,148 +160,6 @@ class ClientNet { console.log(name, msg, (Buffer.concat([buf, msgBuf])).length); } - SMLogin(msg) { - if (msg.errcode) { - return; - } - if (!msg.user_info.guild_id) { - /*this.sendMsg( - 'CMGuildJoin', - { - 'guild_id': 10010 - });*/ - this.sendMsg( - 'CMGuildCreate', - { - 'guild_name': 'test_guild1' - }); - } else { - this.sendMsg( - 'CMGuildInfo', - { - 'guild_id': msg.user_info.guild_id - }); - this.sendMsg( - 'CMGuildApplyList', - { - }); - this.sendMsg( - 'CMGuildAgree', - { - 'applyid': "10072" - }); - } - /*this.sendMsg( - 'CMGuildAgree', - { - 'applyid': "10000" - }); - this.sendMsg( - 'CMGuildMemberSetJob', - { - 'member_id': "6000_1006_227", - "job": 3 - }); - this.sendMsg( - 'CMPing', - { - });*/ - } - - SMGuildCreate(msg) { - this.sendMsg( - 'CMGuildInfo', - { - 'guild_id': msg.guild_id - }); - } - - SMGuildInfo(msg) { - this.sendMsg( - 'CMGuildMemberList', - { - }); - this.sendMsg( - 'CMGuildApplyList', - { - }); - this.sendMsg( - 'CMGuildSearch', - { - 'guild_name': '' - }); - this.sendMsg( - 'CMGuildSearchMember', - { - 'target_id': this.accountId - }); - this.sendMsg( - 'CMGuildChange', - { - 'guild_notice': 'test notice' - }); - this.sendMsg( - 'CMGuildSetPermission', - { - 'permission': { - 'job': 1, - 'switchs': [ - { - 'key': 110001, - 'val': 0 - }, - { - 'key': 110002, - 'val': 0 - }, - { - 'key': 110003, - 'val': 0 - } - ] - } - }); - } - - SMGuildMemberList(msg) { - - } - - SMGuildSearch(msg) { - } - - SMGuildSearchMember(msg) { - - } - - SMGuildAgree(msg) { - - } - - SMGuildMemberSetJob(msg) { - - } - - SMGuildApplyList(msg) { - - } - - SMGuildChange(msg) { - - } - - SMGuildSetPermission(msg) { - - } - - SMUserInfoUpdate(msg) { - - } - - SMPing(msg) { - - } - } module.exports = ClientNet; diff --git a/server/tools/robot/kcpclient/testcase.js b/server/tools/robot/kcpclient/testcase.js index 88739b17..d88db2c0 100644 --- a/server/tools/robot/kcpclient/testcase.js +++ b/server/tools/robot/kcpclient/testcase.js @@ -41,7 +41,7 @@ class TestCase { this.relationUrl = 'ws://127.0.0.1:7132'; //this.relationUrl = 'ws://8.133.161.108/game1006/websocket/'; this.loginData = null; - this.relationWs = new ClientNet( + this.gameWs = new ClientNet( this.relationUrl, 'proto/cs_proto.proto', 'proto/cs_msgid.proto' @@ -59,14 +59,15 @@ class TestCase { async step1() { const startTick = getTickCount(); const {err, response} = await httpGet( - 'http://8.133.161.108/game1006/api/webapp/index.php', + 'https://login-test.kingsome.cn/webapp/index.php', { 'c': 'Login', 'a': 'auth', - 'gameid': 1006, - 'channel': 6000, - 'account': 'test1', - 'openid': 'test1' + 'channel': 6513, + 'login_type': 1001, + 'login_from': 1001, + 'gameid': 2006, + 'openid': 'e5vjg90hmboncfkqjDaiM8craNX23zPu' }); this.loginData = response; const endTick = getTickCount(); @@ -74,15 +75,13 @@ class TestCase { } async step2() { - await this.relationWs.init(); - await this.relationWs.connect(); - this.relationWs.on('connect', () => { + await this.gameWs.init(); + await this.gameWs.connect(); + this.gameWs.on('connect', () => { console.log('relation onConnect'); - //this.loginData['account_id'] = '6000_1006_gh36'; - //this.loginData['session_id'] = '1654932040_1654932019_997704543_9c6066a10f56f8fb8fc4210c3d9c0b85'; - this.relationWs.accountId = this.loginData['account_id']; - this.relationWs.sessionId = this.loginData['session_id']; - this.relationWs.sendMsg('CMLogin', { + this.gameWs.accountId = this.loginData['account_id']; + this.gameWs.sessionId = this.loginData['session_id']; + this.gameWs.sendMsg('CMLogin', { account_id: this.loginData['account_id'], session_id: this.loginData['session_id'], });