This commit is contained in:
Leo
2025-12-02 17:39:35 +08:00
parent 33d70cf266
commit 316cc7ea48
4 changed files with 18 additions and 2 deletions

View File

@@ -93,7 +93,9 @@ public class WxSendUtil {
touser.forEach(t ->
touserStringBuilder.append(t).append("|")
);
touserStr = touserStringBuilder.substring(0, touser.size() - 1);
// 修复bug: 应该使用 touserStringBuilder.length() - 1而不是 touser.size() - 1
// 因为要删除最后一个 "|" 字符,应该基于字符串长度而不是列表大小
touserStr = touserStringBuilder.substring(0, touserStringBuilder.length() - 1);
} else {
touserStr = touserStringBuilder.append(touser.get(0)).toString();
}
@@ -169,7 +171,9 @@ public class WxSendUtil {
touser.forEach(t ->
touserStringBuilder.append(t).append("|")
);
touserStr = touserStringBuilder.substring(0, touser.size() - 1);
// 修复bug: 应该使用 touserStringBuilder.length() - 1而不是 touser.size() - 1
// 因为要删除最后一个 "|" 字符,应该基于字符串长度而不是列表大小
touserStr = touserStringBuilder.substring(0, touserStringBuilder.length() - 1);
} else {
touserStr = touserStringBuilder.append(touser.get(0)).toString();
}