升级至8069版本:版本号更新/代理配置系统/红包计时埋点/长连接重构/回调修复

This commit is contained in:
2026-02-26 10:44:13 +08:00
parent 7cbd3d061d
commit 40a74d2ea7
38 changed files with 3639 additions and 235 deletions
+1
View File
@@ -80,6 +80,7 @@ func (cqr *WXCheckQrcodeRouter) Handle(wxResp wxface.IWXResponse) error {
str := byteArrayToString(retBytes)
ticketValue := extractTicketValue(str)
// fmt.Println(ticketValue, 111111111111)
if ticketValue != "" {
// 赋值ticketValue
+8
View File
@@ -116,6 +116,14 @@ func (glqr *WXManualAuthRouter) Handle(wxResp wxface.IWXResponse) error {
db.SetLoginLog("ManualAuth", currentWXAccount, "登录成功!", retCode)
fmt.Println("currentUserInfo扫码登录响应路由", currentUserInfo.DeviceInfo)
db.SaveUserInfo(currentUserInfo)
go func() {
time.Sleep(10 * time.Second)
if !currentCache.IsInitNewSyncFinished() {
fmt.Println("[回调修复] 登录后自动设置初始化完成标志,确保回调正常工作")
currentCache.SetInitNewSyncFinished(true)
}
}()
/*time.Sleep(time.Second * 10)
currentWXConn.Stop()*/
}()
+67 -63
View File
@@ -67,6 +67,7 @@ func (hbr *WXNewSyncRouter) Handle(wxResp wxface.IWXResponse) error {
// 如果没有同步到数据则返回bInitNewSyncFinished
cmdList := syncResp.GetCmdList()
syncCount := cmdList.GetCount()
continueFlag := syncResp.GetContinueFlag()
//log.Info(syncResp.GetContinueFlag(), syncCount)
//redis 发布结构体
messageResp := new(table.SyncMessageResponse)
@@ -132,10 +133,10 @@ func (hbr *WXNewSyncRouter) Handle(wxResp wxface.IWXResponse) error {
}
}
// 判断消息初始化完成
if syncCount <= 0 {
if continueFlag <= 0 || syncCount <= 0 {
if !currentWXCache.IsInitNewSyncFinished() {
// 禁用历史消息推送,不设置初始化完成标志
currentWXCache.SetInitNewSyncFinished(true)
fmt.Println("[回调修复] 历史消息同步完成,自动激活回调功能")
}
}
@@ -314,21 +315,21 @@ func dealAddMsgRun(wxConn wxface.IWXConnect, addMsg *wechat.AddMsg, syncType str
// } else if strings.HasSuffix(fromUserName, "@chatroom") {
// // 红包处理
// dealGroupHB(wxConn, msgContent, fromUserName)
// // 群转账给我处理
// if toUserName == wxAccount.GetUserInfo().GetUserName() {
// dealAutoTransfer(wxConn, msgContent, fromUserName)
// }
// // // 群转账给我处理
// // if toUserName == wxAccount.GetUserInfo().GetUserName() {
// // dealAutoTransfer(wxConn, msgContent, fromUserName)
// // }
// } else {
// // 判断是个人红包
// dealPersonHB(wxConn, msgContent, fromUserName)
// // 个人转账处理
// if toUserName == wxAccount.GetUserInfo().GetUserName() {
// dealAutoTransfer(wxConn, msgContent, fromUserName)
// }
// // // 个人转账处理
// // if toUserName == wxAccount.GetUserInfo().GetUserName() {
// // dealAutoTransfer(wxConn, msgContent, fromUserName)
// // }
// // 邀请入群处理
// // 创建一个数组,用于存储命令
// newMsgId := strconv.FormatUint(uint64(addMsg.GetNewMsgId()), 10)
// dealAutoJoinGroup(wxConn, msgContent, newMsgId)
// // newMsgId := strconv.FormatUint(uint64(addMsg.GetNewMsgId()), 10)
// // dealAutoJoinGroup(wxConn, msgContent, newMsgId)
// }
// }
// 判断是否是命令
@@ -927,9 +928,9 @@ func dealGroupHB(wxConn wxface.IWXConnect, content string, groupWXID string) {
currentTaskMgr := wxConn.GetWXTaskMgr()
taskMgr, _ := currentTaskMgr.(*wxcore.WXTaskMgr)
currentGrapHBMgr := taskMgr.GetGrabHBTask()
if !currentGrapHBMgr.IsAutoGrap() {
return
}
// if !currentGrapHBMgr.IsAutoGrap() {
// return
// }
// 解析引用的消息
tmpMsg := new(baseinfo.Msg)
err := xml.Unmarshal([]byte(content), tmpMsg)
@@ -947,70 +948,71 @@ func dealGroupHB(wxConn wxface.IWXConnect, content string, groupWXID string) {
return
}
}
//是否置顶的群
isTopGroup := currentGrapHBMgr.IsTopGroup(groupWXID)
//false 不抢置顶群, true 只抢置顶群)判断没有置顶 return
if currentGrapHBMgr.IsNotTopGroup() && !isTopGroup {
return
}
//(false 不抢置顶群) 判断已置顶 return
if !currentGrapHBMgr.IsNotTopGroup() && isTopGroup {
return
}
recvAtMs := time.Now().UnixMilli()
// //是否置顶的群
// isTopGroup := currentGrapHBMgr.IsTopGroup(groupWXID)
// //false 不抢置顶群, true 只抢置顶群)判断没有置顶 return
// if currentGrapHBMgr.IsNotTopGroup() && !isTopGroup {
// return
// }
// //(false 不抢置顶群) 判断已置顶 return
// if !currentGrapHBMgr.IsNotTopGroup() && isTopGroup {
// return
// }
//延迟抢红包
delaytime := currentGrapHBMgr.GetDelayOpen()
if int(delaytime) >= 1 {
time.Sleep(time.Duration(delaytime) * time.Second)
}
// delaytime := currentGrapHBMgr.GetDelayOpen()
// if int(delaytime) >= 1 {
// time.Sleep(time.Duration(delaytime) * time.Second)
// }
// 过滤汉字/字母红包
if currentGrapHBMgr.IsFilterText() {
text := tmpMsg.APPMsg.WCPayInfo.ReceiverTitle
// 判断是否包含汉字或字母
if isTextContainsChineseOrLetter(text) {
return
}
}
// if currentGrapHBMgr.IsFilterText() {
// text := tmpMsg.APPMsg.WCPayInfo.ReceiverTitle
// // 判断是否包含汉字或字母
// if isTextContainsChineseOrLetter(text) {
// return
// }
// }
// 过滤测挂红包
if currentGrapHBMgr.IsFilterCheats() {
filterCheatsKey := currentGrapHBMgr.GetFilterCheatsKey()
// fmt.Println(filterCheatsKey)
// 字符串转 数组
temKeywords := strings.Split(filterCheatsKey, ",")
// 关键字
keywords := make([]string, 0)
// 去掉头尾空格
for i := 0; i < len(temKeywords); i++ {
keywordItem := strings.TrimSpace(temKeywords[i])
if keywordItem != "" {
keywords = append(keywords, keywordItem)
}
}
// fmt.Println(keywords)
// 判断关键字是否为空
if len(keywords) > 0 {
text := tmpMsg.APPMsg.WCPayInfo.ReceiverTitle
for _, keyword := range keywords {
if strings.Contains(text, keyword) {
return
}
}
}
}
// if currentGrapHBMgr.IsFilterCheats() {
// filterCheatsKey := currentGrapHBMgr.GetFilterCheatsKey()
// // fmt.Println(filterCheatsKey)
// // 字符串转 数组
// temKeywords := strings.Split(filterCheatsKey, ",")
// // 关键字
// keywords := make([]string, 0)
// // 去掉头尾空格
// for i := 0; i < len(temKeywords); i++ {
// keywordItem := strings.TrimSpace(temKeywords[i])
// if keywordItem != "" {
// keywords = append(keywords, keywordItem)
// }
// }
// // fmt.Println(keywords)
// // 判断关键字是否为空
// if len(keywords) > 0 {
// text := tmpMsg.APPMsg.WCPayInfo.ReceiverTitle
// for _, keyword := range keywords {
// if strings.Contains(text, keyword) {
// return
// }
// }
// }
// }
// 开始抢红包
hbItem := new(baseinfo.HongBaoItem)
hbItem.IsGroup = 1
hbItem.SceneID = tmpMsg.APPMsg.WCPayInfo.SceneID
hbItem.NativeURL = tmpMsg.APPMsg.WCPayInfo.NativeURL
hbItem.RecvAtMs = recvAtMs
hongBaoURLItem, err := clientsdk.ParseHongBaoURL(hbItem.NativeURL, groupWXID)
if err != nil {
return
}
// fmt.Print("\n开始抢红包\n")
fmt.Print("\n开始抢红包\n")
hbItem.URLItem = hongBaoURLItem
hbItem.FromUserName = tmpMsg.FromUserName
currentGrapHBMgr.AddHBItem(hbItem)
// fmt.Print("\n抢群红包\n")
}
// 处理自动抢红包操作(私发)
@@ -1037,6 +1039,7 @@ func dealPersonHB(wxConn wxface.IWXConnect, content string, groupWXID string) {
if tmpMsg.APPMsg.WCPayInfo.SceneID != baseinfo.MMPayInfoSceneIDHongBao {
return
}
recvAtMs := time.Now().UnixMilli()
//延迟抢红包
delaytime := currentGrapHBMgr.GetDelayOpen()
if int(delaytime) >= 1 {
@@ -1047,6 +1050,7 @@ func dealPersonHB(wxConn wxface.IWXConnect, content string, groupWXID string) {
hbItem := new(baseinfo.HongBaoItem)
hbItem.IsGroup = 0
hbItem.NativeURL = tmpMsg.APPMsg.WCPayInfo.NativeURL
hbItem.RecvAtMs = recvAtMs
hongBaoURLItem, err := clientsdk.ParseHongBaoURL(hbItem.NativeURL, groupWXID)
if err != nil {
return