From 919f53913ac08453f7e583f44df2ed928f6597e2 Mon Sep 17 00:00:00 2001 From: coward Date: Fri, 5 Jan 2024 17:29:43 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E4=B8=BAresponse=E6=B7=BB=E5=8A=A0String?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- response.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/response.go b/response.go index a5ab7ad..79b9896 100644 --- a/response.go +++ b/response.go @@ -1,5 +1,7 @@ package wx_helper_sdk +import "encoding/json" + // CommonResponse // @description: 公共返回 type CommonResponse struct { @@ -8,6 +10,11 @@ type CommonResponse struct { Data any `json:"data"` } +func (r *CommonResponse) String() string { + data, _ := json.Marshal(r) + return string(data) +} + // UserInfo // @description: 当前用户信息 type UserInfo struct { @@ -25,6 +32,11 @@ type UserInfo struct { Wxid string `json:"wxid"` } +func (r *UserInfo) String() string { + data, _ := json.Marshal(r) + return string(data) +} + // Friend // @description: 朋友信息 type Friend struct { @@ -40,6 +52,11 @@ type Friend struct { Wxid string `json:"wxid"` } +func (r *Friend) String() string { + data, _ := json.Marshal(r) + return string(data) +} + // ChatRoomDetail // @description: 群聊详情 type ChatRoomDetail struct { @@ -49,6 +66,11 @@ type ChatRoomDetail struct { Xml string `json:"xml"` } +func (r *ChatRoomDetail) String() string { + data, _ := json.Marshal(r) + return string(data) +} + // ChatRoomMembers // @description: 群聊人员信息 type ChatRoomMembers struct { @@ -58,3 +80,8 @@ type ChatRoomMembers struct { MemberNickname string `json:"memberNickname"` Members string `json:"members"` } + +func (r *ChatRoomMembers) String() string { + data, _ := json.Marshal(r) + return string(data) +}