This commit is contained in:
aozhiwei 2023-04-17 20:06:59 +08:00
parent 0481a7d088
commit 4c775a46a9
2 changed files with 14 additions and 169 deletions

View File

@ -47,19 +47,7 @@ class ClientNet {
this.smMsgId = this.msgIdPb.lookup('SMMessageId_e'); this.smMsgId = this.msgIdPb.lookup('SMMessageId_e');
} }
{ {
this.selfRegisterMsgHandle('SMLogin'); //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');
} }
} }
@ -172,148 +160,6 @@ class ClientNet {
console.log(name, msg, (Buffer.concat([buf, msgBuf])).length); 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; module.exports = ClientNet;

View File

@ -41,7 +41,7 @@ class TestCase {
this.relationUrl = 'ws://127.0.0.1:7132'; this.relationUrl = 'ws://127.0.0.1:7132';
//this.relationUrl = 'ws://8.133.161.108/game1006/websocket/'; //this.relationUrl = 'ws://8.133.161.108/game1006/websocket/';
this.loginData = null; this.loginData = null;
this.relationWs = new ClientNet( this.gameWs = new ClientNet(
this.relationUrl, this.relationUrl,
'proto/cs_proto.proto', 'proto/cs_proto.proto',
'proto/cs_msgid.proto' 'proto/cs_msgid.proto'
@ -59,14 +59,15 @@ class TestCase {
async step1() { async step1() {
const startTick = getTickCount(); const startTick = getTickCount();
const {err, response} = await httpGet( 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', 'c': 'Login',
'a': 'auth', 'a': 'auth',
'gameid': 1006, 'channel': 6513,
'channel': 6000, 'login_type': 1001,
'account': 'test1', 'login_from': 1001,
'openid': 'test1' 'gameid': 2006,
'openid': 'e5vjg90hmboncfkqjDaiM8craNX23zPu'
}); });
this.loginData = response; this.loginData = response;
const endTick = getTickCount(); const endTick = getTickCount();
@ -74,15 +75,13 @@ class TestCase {
} }
async step2() { async step2() {
await this.relationWs.init(); await this.gameWs.init();
await this.relationWs.connect(); await this.gameWs.connect();
this.relationWs.on('connect', () => { this.gameWs.on('connect', () => {
console.log('relation onConnect'); console.log('relation onConnect');
//this.loginData['account_id'] = '6000_1006_gh36'; this.gameWs.accountId = this.loginData['account_id'];
//this.loginData['session_id'] = '1654932040_1654932019_997704543_9c6066a10f56f8fb8fc4210c3d9c0b85'; this.gameWs.sessionId = this.loginData['session_id'];
this.relationWs.accountId = this.loginData['account_id']; this.gameWs.sendMsg('CMLogin', {
this.relationWs.sessionId = this.loginData['session_id'];
this.relationWs.sendMsg('CMLogin', {
account_id: this.loginData['account_id'], account_id: this.loginData['account_id'],
session_id: this.loginData['session_id'], session_id: this.loginData['session_id'],
}); });