This commit is contained in:
aozhiwei 2024-03-21 17:27:14 +08:00
parent 14d9884bba
commit 6f783f4197
2 changed files with 224 additions and 7 deletions

View File

@ -10,12 +10,6 @@ type CsNetMsgHandler f5.NetMsgHandler[MsgHandler];
type MsgHandlerImpl struct { type MsgHandlerImpl struct {
} }
func (this *SMLogin) Err(errCode int32, errMsg string) *SMLogin {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return nil
}
var handlers [2000]*CsNetMsgHandler var handlers [2000]*CsNetMsgHandler
func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler { func GetNetMsgHandler(msgId uint16) *CsNetMsgHandler {
@ -527,6 +521,204 @@ func (this *SMSetJoinCond) GetNetMsgId() uint16 {
return uint16(SMMessageIdE__SMSetJoinCond) return uint16(SMMessageIdE__SMSetJoinCond)
} }
func (this *SMLogin) Err(errCode int32, errMsg string) *SMLogin {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMReconnect) Err(errCode int32, errMsg string) *SMReconnect {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSearchUser) Err(errCode int32, errMsg string) *SMSearchUser {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSearchUserByAccountId) Err(errCode int32, errMsg string) *SMSearchUserByAccountId {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMAddFriendRequest) Err(errCode int32, errMsg string) *SMAddFriendRequest {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMAcceptFriendRequest) Err(errCode int32, errMsg string) *SMAcceptFriendRequest {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMRejectFriendRequest) Err(errCode int32, errMsg string) *SMRejectFriendRequest {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMListPendingFriendRequest) Err(errCode int32, errMsg string) *SMListPendingFriendRequest {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMListFriend) Err(errCode int32, errMsg string) *SMListFriend {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMDeleteFriendShip) Err(errCode int32, errMsg string) *SMDeleteFriendShip {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMBlacklist) Err(errCode int32, errMsg string) *SMBlacklist {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMAddBlacklist) Err(errCode int32, errMsg string) *SMAddBlacklist {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMRemoveBlacklist) Err(errCode int32, errMsg string) *SMRemoveBlacklist {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMInviteFriendMsg) Err(errCode int32, errMsg string) *SMInviteFriendMsg {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMGuildInfo) Err(errCode int32, errMsg string) *SMGuildInfo {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMRecommendGuildList) Err(errCode int32, errMsg string) *SMRecommendGuildList {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMGetTopGuildsByTotalStars) Err(errCode int32, errMsg string) *SMGetTopGuildsByTotalStars {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMCreateGuild) Err(errCode int32, errMsg string) *SMCreateGuild {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMApplyToGuild) Err(errCode int32, errMsg string) *SMApplyToGuild {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMApplyList) Err(errCode int32, errMsg string) *SMApplyList {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMApprove) Err(errCode int32, errMsg string) *SMApprove {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMReject) Err(errCode int32, errMsg string) *SMReject {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMLeaveGuild) Err(errCode int32, errMsg string) *SMLeaveGuild {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMDismissMember) Err(errCode int32, errMsg string) *SMDismissMember {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSetMemberLevel) Err(errCode int32, errMsg string) *SMSetMemberLevel {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMGuildMembersList) Err(errCode int32, errMsg string) *SMGuildMembersList {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMDisband) Err(errCode int32, errMsg string) *SMDisband {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSearchGuilds) Err(errCode int32, errMsg string) *SMSearchGuilds {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMGuildLogs) Err(errCode int32, errMsg string) *SMGuildLogs {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSetName) Err(errCode int32, errMsg string) *SMSetName {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSetAvatar) Err(errCode int32, errMsg string) *SMSetAvatar {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSetNotice) Err(errCode int32, errMsg string) *SMSetNotice {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func (this *SMSetJoinCond) Err(errCode int32, errMsg string) *SMSetJoinCond {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
func init() { func init() {
handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{ handlers[int(CMMessageIdE__CMPing)] = &CsNetMsgHandler{
@ -985,4 +1177,4 @@ func init() {
}, },
} }
} }

View File

@ -141,6 +141,31 @@ func (this *${item.name}) GetNetMsgId() uint16 {
`; `;
} }
}); });
this.csProtoPb.nested.cs.nestedArray.forEach(
(item) => {
if (item.name[0] == 'S' &&
item.name[1] == 'M') {
let hasErrCodeField = false;
let hasErrMsgField = false;
item.fieldsArray.forEach(
(item2) => {
if (item2.name == 'errcode') {
hasErrCodeField = true;
} else if (item2.name == 'errmsg') {
hasErrMsgField = true;
}
});
if (hasErrCodeField && hasErrMsgField) {
data += `
func (this *${item.name}) Err(errCode int32, errMsg string) *${item.name} {
this.Errcode = proto.Int32(errCode)
this.Errmsg = proto.String(errMsg)
return this
}
`;
}
}
});
data += ` data += `
func init() { func init() {
`; `;