From 45692b75f8655f40b438c7a8892b076908ffbcde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sun, 12 Dec 2021 00:04:15 +0800 Subject: [PATCH] fix(jce): ToByes lost some fields of SvcReqRegisterNew (#217) --- binary/jce/gen/structs_parser_tmp.go | 8 ++++---- binary/jce/structs_tobytes.go | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/binary/jce/gen/structs_parser_tmp.go b/binary/jce/gen/structs_parser_tmp.go index 26ccd631..f20901fa 100644 --- a/binary/jce/gen/structs_parser_tmp.go +++ b/binary/jce/gen/structs_parser_tmp.go @@ -68,16 +68,16 @@ func writeObject(w io.Writer, v reflect.Value, tag byte, name string) { w.Write([]byte(fmt.Sprintf("\tw.WriteInt64(int64(pkt.%s), %d)\n", name, tag))) case reflect.String: w.Write([]byte(fmt.Sprintf("\tw.WriteString(pkt.%s, %d)\n", name, tag))) + case reflect.Interface, reflect.Ptr: + w.Write([]byte(fmt.Sprintf("\tw.writeHead(10, %d)\n", tag))) + w.Write([]byte(fmt.Sprintf("\tw.buf.Write(pkt.%s.ToBytes())\n", name))) + w.Write([]byte("\tw.writeHead(11, 0)\n")) default: switch v.Interface().(type) { case float32: w.Write([]byte(fmt.Sprintf("\tw.WriteFloat32(pkt.%s, %d)\n", name, tag))) case float64: w.Write([]byte(fmt.Sprintf("\tw.WriteFloat64(pkt.%s, %d)\n", name, tag))) - case IJceStruct: - w.Write([]byte(fmt.Sprintf("\tw.writeHead(10, %d)\n", tag))) - w.Write([]byte(fmt.Sprintf("\tw.buf.Write(pkt.%s.ToBytes())\n", name))) - w.Write([]byte("\tw.writeHead(11, 0)\n")) } } } diff --git a/binary/jce/structs_tobytes.go b/binary/jce/structs_tobytes.go index 1e042498..e03ef5f7 100644 --- a/binary/jce/structs_tobytes.go +++ b/binary/jce/structs_tobytes.go @@ -229,6 +229,12 @@ func (pkt *SvcRespRegister) ToBytes() []byte { func (pkt *SvcReqRegisterNew) ToBytes() []byte { w := NewJceWriter() w.WriteInt64(pkt.RequestOptional, 0) + w.writeHead(10, 1) + w.buf.Write(pkt.C2CMsg.ToBytes()) + w.writeHead(11, 0) + w.writeHead(10, 2) + w.buf.Write(pkt.GroupMsg.ToBytes()) + w.writeHead(11, 0) w.WriteByte(pkt.DisGroupMsgFilter, 14) w.WriteByte(pkt.GroupMask, 15) w.WriteInt64(pkt.EndSeq, 16)