Refactor code

This commit is contained in:
wenxu12345 2021-12-30 18:22:56 +08:00
parent 1b11cd571e
commit 324152e363

View File

@ -184,7 +184,11 @@ func GetGroupAllMemberList(c *gin.Context) {
} }
func ProtoToMap(pb proto.Message, idFix bool) map[string]interface{} { func ProtoToMap(pb proto.Message, idFix bool) map[string]interface{} {
marshaler := jsonpb.Marshaler{} marshaler := jsonpb.Marshaler{
OrigName: true,
EnumsAsInts: false,
EmitDefaults: true,
}
s, _ := marshaler.MarshalToString(pb) s, _ := marshaler.MarshalToString(pb)
out := make(map[string]interface{}) out := make(map[string]interface{})
json.Unmarshal([]byte(s), &out) json.Unmarshal([]byte(s), &out)