🎨为response添加String方法
This commit is contained in:
parent
2cf8d40c80
commit
919f53913a
27
response.go
27
response.go
@ -1,5 +1,7 @@
|
|||||||
package wx_helper_sdk
|
package wx_helper_sdk
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
// CommonResponse
|
// CommonResponse
|
||||||
// @description: 公共返回
|
// @description: 公共返回
|
||||||
type CommonResponse struct {
|
type CommonResponse struct {
|
||||||
@ -8,6 +10,11 @@ type CommonResponse struct {
|
|||||||
Data any `json:"data"`
|
Data any `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *CommonResponse) String() string {
|
||||||
|
data, _ := json.Marshal(r)
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
// UserInfo
|
// UserInfo
|
||||||
// @description: 当前用户信息
|
// @description: 当前用户信息
|
||||||
type UserInfo struct {
|
type UserInfo struct {
|
||||||
@ -25,6 +32,11 @@ type UserInfo struct {
|
|||||||
Wxid string `json:"wxid"`
|
Wxid string `json:"wxid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *UserInfo) String() string {
|
||||||
|
data, _ := json.Marshal(r)
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
// Friend
|
// Friend
|
||||||
// @description: 朋友信息
|
// @description: 朋友信息
|
||||||
type Friend struct {
|
type Friend struct {
|
||||||
@ -40,6 +52,11 @@ type Friend struct {
|
|||||||
Wxid string `json:"wxid"`
|
Wxid string `json:"wxid"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Friend) String() string {
|
||||||
|
data, _ := json.Marshal(r)
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
// ChatRoomDetail
|
// ChatRoomDetail
|
||||||
// @description: 群聊详情
|
// @description: 群聊详情
|
||||||
type ChatRoomDetail struct {
|
type ChatRoomDetail struct {
|
||||||
@ -49,6 +66,11 @@ type ChatRoomDetail struct {
|
|||||||
Xml string `json:"xml"`
|
Xml string `json:"xml"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *ChatRoomDetail) String() string {
|
||||||
|
data, _ := json.Marshal(r)
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
|
||||||
// ChatRoomMembers
|
// ChatRoomMembers
|
||||||
// @description: 群聊人员信息
|
// @description: 群聊人员信息
|
||||||
type ChatRoomMembers struct {
|
type ChatRoomMembers struct {
|
||||||
@ -58,3 +80,8 @@ type ChatRoomMembers struct {
|
|||||||
MemberNickname string `json:"memberNickname"`
|
MemberNickname string `json:"memberNickname"`
|
||||||
Members string `json:"members"`
|
Members string `json:"members"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *ChatRoomMembers) String() string {
|
||||||
|
data, _ := json.Marshal(r)
|
||||||
|
return string(data)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user