forked from lxh/go-wxhelper
🐛 Fix a bug.
This commit is contained in:
parent
f39f46bfbf
commit
de278f25e9
@ -38,7 +38,7 @@ func ClearGroupUser() {
|
|||||||
memberMap[member.Nickname] = member.LastActive.Format("2006-01-02 15:04:05")
|
memberMap[member.Nickname] = member.LastActive.Format("2006-01-02 15:04:05")
|
||||||
}
|
}
|
||||||
// 调用接口
|
// 调用接口
|
||||||
utils.DeleteGroupMember(group.Wxid, strings.Join(deleteIds, ","), 0)
|
utils.DeleteGroupMember(group.Wxid, strings.Join(deleteIds, ","), 0, false)
|
||||||
// 发送通知到群里
|
// 发送通知到群里
|
||||||
ms := make([]string, 0)
|
ms := make([]string, 0)
|
||||||
for k, v := range memberMap {
|
for k, v := range memberMap {
|
||||||
|
@ -126,7 +126,9 @@ func SendEmotion(toId, emotionHash string, retryCount int) {
|
|||||||
// @description: 删除群成员
|
// @description: 删除群成员
|
||||||
// @param chatRoomId 群Id
|
// @param chatRoomId 群Id
|
||||||
// @param memberIds 成员id,用','分隔
|
// @param memberIds 成员id,用','分隔
|
||||||
func DeleteGroupMember(chatRoomId, memberIds string, retryCount int) {
|
// @param retryCount 重试次数
|
||||||
|
// @param isSure 是否确认删除
|
||||||
|
func DeleteGroupMember(chatRoomId, memberIds string, retryCount int, isSure bool) {
|
||||||
if retryCount > 5 {
|
if retryCount > 5 {
|
||||||
log.Printf("重试五次失败,停止发送")
|
log.Printf("重试五次失败,停止发送")
|
||||||
return
|
return
|
||||||
@ -148,9 +150,11 @@ func DeleteGroupMember(chatRoomId, memberIds string, retryCount int) {
|
|||||||
log.Printf("删除群成员失败: %s", err.Error())
|
log.Printf("删除群成员失败: %s", err.Error())
|
||||||
// 休眠五秒后重新发送
|
// 休眠五秒后重新发送
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
DeleteGroupMember(chatRoomId, memberIds, retryCount+1)
|
DeleteGroupMember(chatRoomId, memberIds, retryCount+1, isSure)
|
||||||
}
|
}
|
||||||
log.Printf("删除群成员结果: %s", resp.String())
|
log.Printf("[%s]删除群成员结果: %s", chatRoomId, resp.String())
|
||||||
// 这个逼接口要调用两次,第一次调用成功,第二次调用才会真正删除
|
// 这个逼接口要调用两次,第一次调用成功,第二次调用才会真正删除
|
||||||
DeleteGroupMember(chatRoomId, memberIds, 5)
|
if !isSure {
|
||||||
|
DeleteGroupMember(chatRoomId, memberIds, 5, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user