Documentation ¶
Index ¶
- func CheckLogin(uuid string) (int64, string)
- func DownloadImagIntoDir(url string, dirPath string) error
- func GetAllContact(loginMap *m.LoginMap) (map[string]m.User, error)
- func GetUUIDFromWX() (string, error)
- func InitWX(loginMap *m.LoginMap) error
- func InviteMember(loginMap *m.LoginMap, memberUserName string, chatRoomUserName string) error
- func MapGroupInfo(contactMap map[string]m.User) map[string][]m.User
- func NotifyStatus(loginMap *m.LoginMap) error
- func ProcessLoginInfo(loginInfoStr string) (m.LoginMap, error)
- func SendMsg(loginMap *m.LoginMap, wxSendMsg m.WxSendMsg) error
- func SyncCheck(loginMap *m.LoginMap) (int64, int64, error)
- func WebWxSync(loginMap *m.LoginMap) (m.WxRecvMsges, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadImagIntoDir ¶
下载URL指向的JPG,保存到指定路径下的qrcode.jpg文件
func GetAllContact ¶
*
- 获取所有联系人信息,组装到map中,key为用户的UserName
- 微信API对此URL使用了Cookie验证
- GET:https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxgetcontact?lang=zh_CN&pass_ticket=dfLHy%252Fcgw%252BFM1qGhuARU6%252BDGs%252BGmWAD3jZJk6%252BfWcPs%253D&r=1504587952374&seq=0&skey=@crypt_3aaab8d5_c87634a7c5f8f579095cfdceeb8d842a
func InviteMember ¶
邀请联系人加入群
func NotifyStatus ¶
*
- 通知微信服务器状态变化,只要通知即可,无需处理返回数据
- {"BaseRequest":{"Uin":154158775,"Sid":"/nxZxJ0LclxmOw8v","Skey":"@crypt_3aaab8d5_cdfa952ec95e594b100f44aba942a73c","DeviceID":"e390742104557152"},"Code":3,"FromUserName":"@fc96d593487db4fb92b9a633aec8293b","ToUserName":"@fc96d593487db4fb92b9a633aec8293b","ClientMsgId":1504571331980}
func SyncCheck ¶
*
- 微信心跳检查 -> 根据retcode和selector 逻辑判断是否需要拉取数据
- Get:https://webpush.wx.qq.com/cgi-bin/mmwebwx-bin/synccheck?
- r=1504582260660&
- skey=%40crypt_3aaab8d5_4f38b712dd654bff65bef8406d020771&
- sid=k4FG05I6vi26YyeW&uin=154158775&
- deviceid=e637087162023800&
- synckey=1_696275959%7C2_696276056%7C3_696275995%7C11_696275997%7C13_696160001%7C201_1504582232%7C203_1504580411%7C1000_1504572121%7C1001_1504572152&
- _=1504582198153
- 这里依然要用到Cookies *
- 根据 https://github.com/yaphone/itchat4j/blob/master/src/main/java/cn/zhouyafeng/itchat4j/utils/enums/RetCodeEnum.java
- retcode:
- NORMAL("0", "普通"),
- LOGIN_OUT("1102", "退出"),
- LOGIN_OTHERWHERE("1101", "其它地方登陆"),
- MOBILE_LOGIN_OUT("1102", "移动端退出"),
- UNKOWN("9999", "未知") *
- 自己分析下来
- selector:
- 4:有某位联系人更新了个人信息
- 2:有人发消息了 拉取后,MsgType = 1为文字消息,提取content得到聊天文本
- 每次拉取,需要更新SyncKey,见WebWxSync函数 *
func WebWxSync ¶
func WebWxSync(loginMap *m.LoginMap) (m.WxRecvMsges, error)
*
- 微信同步拉取消息,最主要的消息响应逻辑
- POST:https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsync?
- sid=u6j1MoqYJgbI66kO&
- skey=@crypt_3aaab8d5_1f2b5690081714b78fc9b70ee3e4538c&
- pass_ticket=M3%252BbNp65pZ53GJwvd7aq%252FQuS5Rd7lctHU0qilHs7Fjw%253D
- BODY:{
- "BaseRequest":{"Uin":154158775,"Sid":"u6j1MoqYJgbI66kO","Skey":"@crypt_3aaab8d5_1f2b5690081714b78fc9b70ee3e4538c","DeviceID":"e215003169713295"},
- "SyncKey":{"Count":8,"List":[{"Key":1,"Val":696275959},{"Key":2,"Val":696276275},{"Key":3,"Val":696276260},{"Key":11,"Val":696275997},{"Key":13,"Val":696160001},{"Key":201,"Val":1504604303},{"Key":1000,"Val":1504603672},{"Key":1001,"Val":1504572152}]},
- "rr":-1365833882
- }
- @param {[type]} loginMap m.LoginMap [description]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.