优化对象的字段的排列

This commit is contained in:
eatMoreApple 2021-04-27 11:12:46 +08:00
parent 7ddcde9ab6
commit d84fbe1681
3 changed files with 302 additions and 303 deletions

6
bot.go
View File

@ -6,15 +6,15 @@ import (
)
type Bot struct {
Caller *Caller
self *Self
storage *Storage
ScanCallBack func(body []byte)
LoginCallBack func(body []byte)
UUIDCallback func(uuid string)
MessageHandler func(msg *Message)
err error
exit chan bool
Caller *Caller
self *Self
storage *Storage
}
// 判断当前用户是否正常在线

View File

@ -9,12 +9,12 @@ import "fmt"
// 登录信息
type LoginInfo struct {
Ret int `xml:"ret"`
WxUin int `xml:"wxuin"`
IsGrayScale int `xml:"isgrayscale"`
Message string `xml:"message"`
SKey string `xml:"skey"`
WxSid string `xml:"wxsid"`
WxUin int `xml:"wxuin"`
PassTicket string `xml:"pass_ticket"`
IsGrayScale int `xml:"isgrayscale"`
}
// 初始的请求信息
@ -26,8 +26,8 @@ type BaseRequest struct {
// 大部分返回对象都携带该信息
type BaseResponse struct {
ErrMsg string
Ret int
ErrMsg string
}
func (b BaseResponse) Ok() bool {
@ -64,28 +64,28 @@ type SyncKey struct {
// 初始化的相应信息
type WebInitResponse struct {
BaseResponse BaseResponse
Count int
ChatSet string
SKey string
SyncKey SyncKey
User User
ClientVersion int
SystemTime int64
GrayScale int
InviteStartCount int
MPSubscribeMsgCount int
MPSubscribeMsgList []MPSubscribeMsg
ClickReportInterval int
SystemTime int64
ChatSet string
SKey string
BaseResponse BaseResponse
SyncKey SyncKey
User User
MPSubscribeMsgList []MPSubscribeMsg
ContactList []User
}
// 公众号的订阅信息
type MPSubscribeMsg struct {
UserName string
Time int64
NickName string
MPArticleCount int
Time int64
UserName string
NickName string
MPArticleList []struct {
Title string
Cover string
@ -149,29 +149,29 @@ func (s *SyncCheckResponse) Error() string {
type WebWxSyncResponse struct {
AddMsgCount int
AddMsgList []*Message
BaseResponse BaseResponse
ContinueFlag int
DelContactCount int
ModChatRoomMemberCount int
ModChatRoomMemberList Members
ModContactCount int
Skey string
SyncCheckKey SyncKey
SyncKey SyncKey
BaseResponse BaseResponse
ModChatRoomMemberList Members
AddMsgList []*Message
}
type WebWxContactResponse struct {
BaseResponse BaseResponse
MemberCount int
MemberList []*User
Seq int
BaseResponse BaseResponse
MemberList []*User
}
type WebWxBatchContactResponse struct {
Count int
BaseResponse BaseResponse
ContactList []*User
Count int
}
type CheckLoginResponse struct {

View File

@ -13,44 +13,43 @@ import (
)
type Message struct {
IsAt bool
AppInfo struct {
AppID string
Type int
AppID string
}
AppMsgType int
Content string
CreateTime int64
EncryFileName string
FileName string
FileSize string
ForwardFlag int
FromUserName string
HasProductId int
ImgHeight int
ImgStatus int
ImgWidth int
MediaId string
MsgId string
ForwardFlag int
MsgType int
NewMsgId int64
OriContent string
PlayLength int64
RecommendInfo RecommendInfo
Status int
StatusNotifyCode int
StatusNotifyUserName string
SubMsgType int
VoiceLength int
CreateTime int64
NewMsgId int64
PlayLength int64
MediaId string
MsgId string
EncryFileName string
FileName string
FileSize string
Content string
FromUserName string
OriContent string
StatusNotifyUserName string
Ticket string
ToUserName string
Url string
VoiceLength int
IsAt bool
Bot *Bot
senderInGroupUserName string
RecommendInfo RecommendInfo
Bot *Bot
mu sync.RWMutex
item map[string]interface{}
Context context.Context
item map[string]interface{}
}
// 获取消息的发送者