-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
重新梳理一下业务和架构,准备新加入redis
- Loading branch information
Showing
4 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package wechatBot | ||
|
||
import ( | ||
log "github.com/cihub/seelog" | ||
"github.com/eatmoreapple/openwechat" | ||
) | ||
|
||
func HandleMsg(msg *openwechat.Message) { | ||
var ( | ||
contentText = "" | ||
sender *openwechat.User | ||
err error | ||
) | ||
sender, err = msg.Sender() | ||
if err != nil { | ||
log.Errorf("获取发送人消息失败") | ||
msg.ReplyText(err.Error()) | ||
return | ||
} | ||
// 如果是新申请的好友 | ||
if msg.IsFriendAdd() { | ||
SolveNewFriend(msg) | ||
} else if msg.IsText() { | ||
contentText = msg.Content | ||
SolveTextMessage(contentText, sender.ID()) | ||
} | ||
// 最后一定点一个已读 | ||
msg.AsRead() | ||
} | ||
|
||
func SolveTextMessage(text, userid string) { | ||
|
||
} | ||
|
||
func SolveNewFriend(msg *openwechat.Message) { | ||
friend, err := msg.Agree() | ||
if err != nil { | ||
log.Errorf("error agreeing friend: %v", err) | ||
} | ||
_, err = friend.SendText("你好,我是你的小助手,你可以通过发送'-h'来获取帮助信息") | ||
if err != nil { | ||
log.Errorf("error send tips: %v", err) | ||
return | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"Jar":{"PsList":null,"Entries":{"qq.com":{"qq.com;/;webwx_data_ticket":{"Name":"webwx_data_ticket","Value":"gSdKxUIO0dTyCDYjwg77FXbN","Domain":"qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"qq.com;/;wxuin":{"Name":"wxuin","Value":"3794672827","Domain":"qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;mm_lang":{"Name":"mm_lang","Value":"zh_CN","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;webwx_auth_ticket":{"Name":"webwx_auth_ticket","Value":"CIsBEI642dUJGoABZ9+ZofzNiTquNX51uNrK0Ei7PzuUeuXvnFnFXDrHkPINMMl+VUi4TEZzpBfiqDiLbtvdK1qaMGoS3qAb+xmLMVUMb1tnplVzWghdZJKqkxAf3kjGdBo7xX8FSBRxsymfVGdr15/WWmBQc6Pwrrx+6/eU6MCybilYgSv7nxQo1iU=","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2033-10-08T09:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;webwxuvid":{"Name":"webwxuvid","Value":"d144e7a594f3c878ceb7c5e13bc1755d1d37af0b4c94038176187fd18d80b781f486073f930f9bd7044efeb705325de4","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2033-10-08T09:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;wxloadtime":{"Name":"wxloadtime","Value":"1697017243","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;wxsid":{"Name":"wxsid","Value":"r1JNbhKHjW/3DxlR","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"},"wx2.qq.com;/;wxuin":{"Name":"wxuin","Value":"3794672827","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-11T21:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-11T17:40:49.5090329+08:00"}}},"NextSeqNum":8},"BaseRequest":{"Uin":3794672827,"Sid":"r1JNbhKHjW/3DxlR","Skey":"@crypt_805c01b_4eab6b373199c8bf45aca5f7fadcad87","DeviceID":"e365776303142017"},"LoginInfo":{"Ret":0,"WxUin":3794672827,"IsGrayScale":1,"Message":"","SKey":"@crypt_805c01b_4eab6b373199c8bf45aca5f7fadcad87","WxSid":"r1JNbhKHjW/3DxlR","PassTicket":"m6erBvH8UIHGGIHf7gwEeQHtdBDL6kRRbhhgztex0H4WDBqDtFYSTA1rn5sXJfIBLbsoidXEdWUDasXrj%2BCWGg%3D%3D"},"WechatDomain":"wx2.qq.com","SyncKey":{"Count":4,"List":[{"Key":1,"Val":705877226},{"Key":2,"Val":705877786},{"Key":3,"Val":705877783},{"Key":1000,"Val":1697009460}]},"UUID":"4ekCh4nvtA=="} | ||
{"Jar":{"PsList":null,"Entries":{"qq.com":{"qq.com;/;webwx_data_ticket":{"Name":"webwx_data_ticket","Value":"gSeuzS4Muivf0eAuanx2Juk6","Domain":"qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"qq.com;/;wxuin":{"Name":"wxuin","Value":"3794672827","Domain":"qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;mm_lang":{"Name":"mm_lang","Value":"zh_CN","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;webwx_auth_ticket":{"Name":"webwx_auth_ticket","Value":"CIsBEP+xubYDGoAB4L+GTe6nKokBYb0aPAoNuUi7PzuUeuXvnFnFXDrHkPINMMl+VUi4TEZzpBfiqDiLbtvdK1qaMGoS3qAb+xmLMVUMb1tnplVzWghdZJKqkxAf3kjGdBo7xX8FSBRxsymfVGdr15/WWmBQc6Pwrrx+6/eU6MCybilYgSv7nxQo1iU=","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2033-10-09T01:43:11Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;webwxuvid":{"Name":"webwxuvid","Value":"d144e7a594f3c878ceb7c5e13bc1755d1d37af0b4c94038176187fd18d80b781f486073f930f9bd7044efeb705325de4","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2033-10-08T09:40:43Z","Creation":"2023-10-11T17:40:49.5072528+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;wxloadtime":{"Name":"wxloadtime","Value":"1697074991","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;wxsid":{"Name":"wxsid","Value":"pXxKp60Mh2a701m4","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"},"wx2.qq.com;/;wxuin":{"Name":"wxuin","Value":"3794672827","Domain":"wx2.qq.com","Path":"/","SameSite":"","Secure":true,"HttpOnly":false,"Persistent":true,"HostOnly":false,"Expires":"2023-10-12T13:43:11Z","Creation":"2023-10-12T09:43:18.9468213+08:00","LastAccess":"2023-10-12T09:47:37.9628525+08:00"}}},"NextSeqNum":14},"BaseRequest":{"Uin":3794672827,"Sid":"pXxKp60Mh2a701m4","Skey":"@crypt_805c01b_cc7801ddb1e491c296a89f361834362f","DeviceID":"e714775005257463"},"LoginInfo":{"Ret":0,"WxUin":3794672827,"IsGrayScale":1,"Message":"","SKey":"@crypt_805c01b_cc7801ddb1e491c296a89f361834362f","WxSid":"pXxKp60Mh2a701m4","PassTicket":"pvAH1M4xH920NOfIXblc76z8U2o47RGaHl5yYSzmrp0CvzXs2lp3qzbETi%2FAqy40mrpVVUqQ43mi%2BI%2Fc3GOm1Q%3D%3D"},"WechatDomain":"wx2.qq.com","SyncKey":{"Count":4,"List":[{"Key":1,"Val":705877226},{"Key":2,"Val":705877786},{"Key":3,"Val":705877783},{"Key":1000,"Val":1697009460}]},"UUID":"ofClkYZbEg=="} |