datastruct

package
v2.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMessageType

type AppMessageType int64

AppMessageType 应用消息类型

const (
	// UnknownAppmsg 未知消息类型
	UnknownAppmsg AppMessageType = 0
	// ReciveFileAppmsg 接收文件
	ReciveFileAppmsg AppMessageType = 6
	// StartShareLocation 共享位置
	StartShareLocation AppMessageType = 17
	// ReciveTransferAppmsg 收到转账
	ReciveTransferAppmsg AppMessageType = 2000
)

type BaseRequest

type BaseRequest struct {
	DeviceID string `json:"DeviceID"`
	Sid      string `json:"Sid"`
	Skey     string `json:"Skey"`
	Uin      string `json:"Uin"`
}

BaseRequest 基本请求结构,包含通用的请求信息

type BaseResponse

type BaseResponse struct {
	ErrMsg string `json:"ErrMsg"`
	Ret    int64  `json:"Ret"`
}

BaseResponse 服务器响应的基本结构体,通用

type Contact

type Contact struct {
	Alias            string   `json:"Alias"` // 微信号
	AppAccountFlag   int64    `json:"AppAccountFlag"`
	AttrStatus       int64    `json:"AttrStatus"`
	ChatRoomID       int64    `json:"ChatRoomId"`
	City             string   `json:"City"`
	ContactFlag      int64    `json:"ContactFlag"`
	DisplayName      string   `json:"DisplayName"`
	EncryChatRoomID  string   `json:"EncryChatRoomId"`
	HeadImgURL       string   `json:"HeadImgUrl"`
	HideInputBarFlag int64    `json:"HideInputBarFlag"`
	IsOwner          int64    `json:"IsOwner"`
	KeyWord          string   `json:"KeyWord"`
	MemberCount      int64    `json:"MemberCount"`
	MemberList       []Member `json:"MemberList"`
	NickName         string   `json:"NickName"` // 用户昵称
	OwnerUin         int64    `json:"OwnerUin"`
	PYInitial        string   `json:"PYInitial"`
	PYQuanPin        string   `json:"PYQuanPin"`
	Province         string   `json:"Province"`
	RemarkName       string   `json:"RemarkName"`      // 备注名称
	RemarkPYInitial  string   `json:"RemarkPYInitial"` // 拼音首字母
	RemarkPYQuanPin  string   `json:"RemarkPYQuanPin"` // 拼音全拼
	Sex              int64    `json:"Sex"`             // 性别,1男2女
	Signature        string   `json:"Signature"`       // 个性签名
	SnsFlag          int64    `json:"SnsFlag"`
	StarFriend       int64    `json:"StarFriend"` // 是否星标好友,1是0否
	Statues          int64    `json:"Statues"`
	Uin              int64    `json:"Uin"`
	UniFriend        int64    `json:"UniFriend"`
	UserName         string   `json:"UserName"` // 用户标识,收发信息都以此为依据,个体用户以@开头(包括公众号),群组以@@开头
	VerifyFlag       int64    `json:"VerifyFlag"`
}

Contact 联系人结构

func (Contact) GetMember

func (contact Contact) GetMember(userName string) (member Member, err error)

GetMember 根据userName获取成员

func (Contact) IsChatroom

func (contact Contact) IsChatroom() bool

IsChatroom 返回联系人是否为群组

func (Contact) IsNoFollowMoments

func (contact Contact) IsNoFollowMoments() bool

IsNoFollowMoments 返回是否不查看该联系人的朋友圈

func (Contact) IsNoShareMoments

func (contact Contact) IsNoShareMoments() bool

IsNoShareMoments 返回是否为不分享朋友圈的联系人

func (Contact) IsQuiet

func (contact Contact) IsQuiet() bool

IsQuiet 返回是否屏蔽该联系人的新消息提醒

func (Contact) IsStar

func (contact Contact) IsStar() bool

IsStar 返回联系人是否为星标联系人

func (Contact) IsTop

func (contact Contact) IsTop() bool

IsTop 返回该联系人是否置顶

type ContactFlag

type ContactFlag int64

ContactFlag 联系人标志

const (
	// ContactFlagStar 星标联系人
	ContactFlagStar ContactFlag = 64
	// ContactFlagNoShareMoments 不分享朋友圈的联系人
	ContactFlagNoShareMoments ContactFlag = 256
	// ContactFlagQuiet 屏蔽新消息提示的联系人
	ContactFlagQuiet ContactFlag = 512
	// ContactFlagTop 置顶联系人
	ContactFlagTop ContactFlag = 2048
	// ContactFlagNoFollowMoments 不查看其朋友圈的联系人
	ContactFlagNoFollowMoments ContactFlag = 65536
)

type GetBatchContactRequest

type GetBatchContactRequest struct {
	BaseRequest *BaseRequest                     `json:"BaseRequest"`
	Count       int64                            `json:"Count"`
	List        []GetBatchContactRequestListItem `json:"List"`
}

GetBatchContactRequest 获取群组联系人的请求

type GetBatchContactRequestListItem

type GetBatchContactRequestListItem struct {
	ChatRoomID string `json:"ChatRoomId"`
	UserName   string `json:"UserName"`
}

GetBatchContactRequestListItem 获取群组联系人的请求的列表元素

type GetBatchContactResponse

type GetBatchContactResponse struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	ContactList  []Contact     `json:"ContactList"`
	Count        int64         `json:"Count"`
}

GetBatchContactResponse 获取群组联系人的返回

type GetContactRespond

type GetContactRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	MemberCount  int64         `json:"MemberCount"`
	MemberList   []Contact     `json:"MemberList"`
	Seq          int64         `json:"Seq"`
}

GetContactRespond 获取联系人的返回

type GetCookieRespond

type GetCookieRespond struct {
	Ret         int64  `xml:"ret"`
	Message     string `xml:"message"`
	Skey        string `xml:"skey"`
	Wxsid       string `xml:"wxsid"`
	Wxuin       string `xml:"wxuin"`
	PassTicket  string `xml:"pass_ticket"`
	Isgrayscale int64  `xml:"isgrayscale"`
}

GetCookieRespond 获取Cookie的返回

type GetMessageRequest

type GetMessageRequest struct {
	BaseRequest *BaseRequest `json:"BaseRequest"`
	SyncKey     *SyncKey     `json:"SyncKey"`
	Rr          int64        `json:"rr"`
}

GetMessageRequest 获取新消息的轮询请求

type GetMessageRespond

type GetMessageRespond struct {
	BaseResponse    *BaseResponse `json:"BaseResponse"`
	AddMsgCount     int64         `json:"AddMsgCount"`
	AddMsgList      []Message     `json:"AddMsgList"`
	ContinueFlag    int64         `json:"ContinueFlag"`
	DelContactCount int64         `json:"DelContactCount"`
	DelContactList  []struct {
		ContactFlag int64  `json:"ContactFlag"`
		UserName    string `json:"UserName"`
	} `json:"DelContactList"`
	ModChatRoomMemberCount int64         `json:"ModChatRoomMemberCount"`
	ModChatRoomMemberList  []interface{} `json:"ModChatRoomMemberList"`
	ModContactCount        int64         `json:"ModContactCount"`
	ModContactList         []Contact     `json:"ModContactList"`
	Profile                *struct {
		Alias     string `json:"Alias"`
		BindEmail struct {
			Buff string `json:"Buff"`
		} `json:"BindEmail"`
		BindMobile struct {
			Buff string `json:"Buff"`
		} `json:"BindMobile"`
		BindUin           int64  `json:"BindUin"`
		BitFlag           int64  `json:"BitFlag"`
		HeadImgUpdateFlag int64  `json:"HeadImgUpdateFlag"`
		HeadImgURL        string `json:"HeadImgUrl"`
		NickName          *struct {
			Buff string `json:"Buff"`
		} `json:"NickName"`
		PersonalCard int64  `json:"PersonalCard"`
		Sex          int64  `json:"Sex"`
		Signature    string `json:"Signature"`
		Status       int64  `json:"Status"`
		UserName     *struct {
			Buff string `json:"Buff"`
		} `json:"UserName"`
	} `json:"Profile"`
	SKey         string   `json:"SKey"`
	SyncCheckKey *SyncKey `json:"SyncCheckKey"`
	SyncKey      *SyncKey `json:"SyncKey"`
}

GetMessageRespond 取回消息的返回

type Member

type Member struct {
	AttrStatus      int64  `json:"AttrStatus"`
	DisplayName     string `json:"DisplayName"`
	KeyWord         string `json:"KeyWord"`
	MemberStatus    int64  `json:"MemberStatus"`
	NickName        string `json:"NickName"`
	PYInitial       string `json:"PYInitial"`
	PYQuanPin       string `json:"PYQuanPin"`
	RemarkPYInitial string `json:"RemarkPYInitial"`
	RemarkPYQuanPin string `json:"RemarkPYQuanPin"`
	Uin             int64  `json:"Uin"`
	UserName        string `json:"UserName"`
}

Member 群成员

type Message

type Message struct {
	AppInfo *struct {
		AppID string `json:"AppID"`
		Type  int64  `json:"Type"`
	} `json:"AppInfo"`
	AppMsgType    AppMessageType `json:"AppMsgType"`
	Content       string         `json:"Content"`
	CreateTime    int64          `json:"CreateTime"`
	FileName      string         `json:"FileName"`
	FileSize      string         `json:"FileSize"`
	ForwardFlag   int64          `json:"ForwardFlag"`
	FromUserName  string         `json:"FromUserName"`
	HasProductID  int64          `json:"HasProductId"`
	ImgHeight     int64          `json:"ImgHeight"`
	ImgStatus     int64          `json:"ImgStatus"`
	ImgWidth      int64          `json:"ImgWidth"`
	MediaID       string         `json:"MediaId"`
	MsgID         string         `json:"MsgId"`
	MsgType       MessageType    `json:"MsgType"`
	NewMsgID      int64          `json:"NewMsgId"`
	OriContent    string         `json:"OriContent"`
	PlayLength    int64          `json:"PlayLength"`
	RecommendInfo *struct {
		Alias      string `json:"Alias"`
		AttrStatus int64  `json:"AttrStatus"`
		City       string `json:"City"`
		Content    string `json:"Content"`
		NickName   string `json:"NickName"`
		OpCode     int64  `json:"OpCode"`
		Province   string `json:"Province"`
		QQNum      int64  `json:"QQNum"`
		Scene      int64  `json:"Scene"`
		Sex        int64  `json:"Sex"`
		Signature  string `json:"Signature"`
		Ticket     string `json:"Ticket"`
		UserName   string `json:"UserName"`
		VerifyFlag int64  `json:"VerifyFlag"`
	} `json:"RecommendInfo"`
	Status               int64  `json:"Status"`
	StatusNotifyCode     int64  `json:"StatusNotifyCode"`
	StatusNotifyUserName string `json:"StatusNotifyUserName"`
	SubMsgType           int64  `json:"SubMsgType"`
	Ticket               string `json:"Ticket"`
	ToUserName           string `json:"ToUserName"`
	URL                  string `json:"Url"`
	VoiceLength          int64  `json:"VoiceLength"`
}

Message 微信消息结构体

func (Message) GetContent

func (msg Message) GetContent() (content string)

GetContent 获取消息,如果为群消息,则自动尝试获取真实消息本体

func (Message) GetMemberMsgContent

func (msg Message) GetMemberMsgContent() (content string, err error)

GetMemberMsgContent 获取群组消息的内容

func (Message) GetMemberUserName

func (msg Message) GetMemberUserName() (userName string, err error)

GetMemberUserName 获取群组消息的发件人

func (Message) IsChatroom

func (msg Message) IsChatroom() bool

IsChatroom 返回消息是否为群组消息

type MessageType

type MessageType int64

MessageType 消息类型

const (
	// TextMsg 文字消息
	TextMsg MessageType = 1
	// ImageMsg 图片消息
	ImageMsg MessageType = 3
	// VoiceMsg 音频消息
	VoiceMsg MessageType = 34
	// ContactCardMsg 名片
	ContactCardMsg MessageType = 42
	// LittleVideoMsg 小视频消息
	LittleVideoMsg MessageType = 43
	// AnimationEmotionsMsg 动画表情
	AnimationEmotionsMsg MessageType = 47
	// LinkMsg 链接消息类型,已知有转账、开始共享实时位置、合并转发聊天记录
	LinkMsg MessageType = 49
	// AppendMsg 拓展消息类型,已知有红包、停止共享实时位置
	AppendMsg MessageType = 10000
	// RevokeMsg 撤回消息
	RevokeMsg MessageType = 10002
)

type ModifyChatRoomTopicRequest

type ModifyChatRoomTopicRequest struct {
	BaseRequest  *BaseRequest `json:"BaseRequest"`
	ChatRoomName string       `json:"ChatRoomName"`
	NewTopic     string       `json:"NewTopic"`
}

ModifyChatRoomTopicRequest 修改群名的请求

type ModifyChatRoomTopicRespond

type ModifyChatRoomTopicRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	MemberCount  int64         `json:"MemberCount"`
	MemberList   []interface{} `json:"MemberList"`
}

ModifyChatRoomTopicRespond 修改群名的返回

type ModifyRemarkRequest

type ModifyRemarkRequest struct {
	BaseRequest *BaseRequest `json:"BaseRequest"`
	CmdID       int64        `json:"CmdId"`
	RemarkName  string       `json:"RemarkName"`
	UserName    string       `json:"UserName"`
}

ModifyRemarkRequest 修改用户备注的请求

type ModifyRemarkRespond

type ModifyRemarkRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
}

ModifyRemarkRespond 修改用户备注的返回

type RevokeMessageRequest

type RevokeMessageRequest struct {
	BaseRequest *BaseRequest `json:"BaseRequest"`
	ClientMsgID string       `json:"ClientMsgId"`
	SvrMsgID    string       `json:"SvrMsgId"`
	ToUserName  string       `json:"ToUserName"`
}

RevokeMessageRequest 撤回消息请求,需要附带要撤回消息的客户端、服务端消息ID

type RevokeMessageRespond

type RevokeMessageRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	Introduction string        `json:"Introduction"`
	SysWording   string        `json:"SysWording"`
}

RevokeMessageRespond 撤回消息的返回

type SendMessage

type SendMessage struct {
	ClientMsgID  string      `json:"ClientMsgId"`
	Content      string      `json:"Content"`
	FromUserName string      `json:"FromUserName"`
	LocalID      string      `json:"LocalID"`
	MediaID      string      `json:"MediaId"`
	ToUserName   string      `json:"ToUserName"`
	Type         MessageType `json:"Type"`
}

SendMessage 发送消息,可发送带媒体的消息

type SendMessageRequest

type SendMessageRequest struct {
	BaseRequest *BaseRequest `json:"BaseRequest"`
	Msg         *SendMessage `json:"Msg"`
	Scene       int64        `json:"Scene"`
}

SendMessageRequest 发送消息请求

type SendMessageRespond

type SendMessageRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	LocalID      string        `json:"LocalID"`
	MsgID        string        `json:"MsgID"`
}

SendMessageRespond 发送消息的返回

type StatusNotifyRequest

type StatusNotifyRequest struct {
	BaseRequest  *BaseRequest `json:"BaseRequest"`
	ClientMsgID  int64        `json:"ClientMsgId"`
	Code         int64        `json:"Code"`
	FromUserName string       `json:"FromUserName"`
	ToUserName   string       `json:"ToUserName"`
}

StatusNotifyRequest 状态通知请求

type StatusNotifyRespond

type StatusNotifyRespond struct {
	BaseResponse *BaseResponse `json:"BaseResponse"`
	MsgID        string        `json:"MsgID"`
}

StatusNotifyRespond 状态通知请求的返回

type SyncCheckRespond

type SyncCheckRespond struct {
	Retcode  string `json:" retcode"`
	Selector string `json:"selector"`
}

SyncCheckRespond 同步消息轮询的返回

type SyncKey

type SyncKey struct {
	Count int64         `json:"Count"`
	List  []SyncKeyItem `json:"List"`
}

SyncKey 同步Key

type SyncKeyItem

type SyncKeyItem struct {
	Key int64 `json:"Key"`
	Val int64 `json:"Val"`
}

SyncKeyItem 同步Key的元素

type TextMessage

type TextMessage struct {
	ClientMsgID  string      `json:"ClientMsgId"`
	Content      string      `json:"Content"`
	FromUserName string      `json:"FromUserName"`
	LocalID      string      `json:"LocalID"`
	ToUserName   string      `json:"ToUserName"`
	Type         MessageType `json:"Type"`
}

TextMessage 发送纯文本消息,用SendMessage也一样

type User

type User struct {
	AppAccountFlag    int64  `json:"AppAccountFlag"`
	ContactFlag       int64  `json:"ContactFlag"`
	HeadImgFlag       int64  `json:"HeadImgFlag"`
	HeadImgURL        string `json:"HeadImgUrl"`
	HideInputBarFlag  int64  `json:"HideInputBarFlag"`
	NickName          string `json:"NickName"`
	PYInitial         string `json:"PYInitial"`
	PYQuanPin         string `json:"PYQuanPin"`
	RemarkName        string `json:"RemarkName"`
	RemarkPYInitial   string `json:"RemarkPYInitial"`
	RemarkPYQuanPin   string `json:"RemarkPYQuanPin"`
	Sex               int64  `json:"Sex"`
	Signature         string `json:"Signature"`
	SnsFlag           int64  `json:"SnsFlag"`
	StarFriend        int64  `json:"StarFriend"`
	Uin               int64  `json:"Uin"`
	UserName          string `json:"UserName"`
	VerifyFlag        int64  `json:"VerifyFlag"`
	WebWxPluginSwitch int64  `json:"WebWxPluginSwitch"`
}

User 当前登陆用户的结构体

type WxInitRequestBody

type WxInitRequestBody struct {
	BaseRequest *BaseRequest `json:"BaseRequest"`
}

WxInitRequestBody 微信初始化请求

type WxInitRespond

type WxInitRespond struct {
	BaseResponse        *BaseResponse `json:"BaseResponse"`
	ChatSet             string        `json:"ChatSet"`
	ClickReportInterval int64         `json:"ClickReportInterval"`
	ClientVersion       int64         `json:"ClientVersion"`
	ContactList         []Contact     `json:"ContactList"`
	Count               int64         `json:"Count"`
	GrayScale           int64         `json:"GrayScale"`
	InviteStartCount    int64         `json:"InviteStartCount"`
	MPSubscribeMsgCount int64         `json:"MPSubscribeMsgCount"`
	MPSubscribeMsgList  []interface{} `json:"MPSubscribeMsgList"`
	SKey                string        `json:"SKey"`
	SyncKey             *SyncKey      `json:"SyncKey"`
	SystemTime          int64         `json:"SystemTime"`
	User                *User         `json:"User"`
}

WxInitRespond 初始化请求的返回

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL