This commit is contained in:
wells
2026-08-05 15:43:04 +08:00
parent 50005dd439
commit ce7a619791
8 changed files with 283 additions and 35 deletions
@@ -139,10 +139,23 @@ public class OpenIMCallbackController {
*/
private void handleStatCommand(String groupId) {
try {
// TODO: 返回统计信息
sendGroupMessage(groupId, "统计功能开发中...");
Long bizGroupId = getBizGroupId(groupId);
if (bizGroupId == null) {
sendGroupMessage(groupId, "群未配置");
return;
}
var stat = gameService.getGroupStat(bizGroupId);
String message = String.format(
"【本群统计】\n总局数: %d\n进行中: %d\n总下注人次: %d\n总下注金额: %d\n总派奖金额: %d\n庄家利润: %d",
stat.getTotalRounds(), stat.getOngoingRounds(),
stat.getTotalBetCount(), stat.getTotalBetAmount(),
stat.getTotalAwardAmount(), stat.getTotalProfit()
);
sendGroupMessage(groupId, message);
} catch (Exception e) {
log.error("处理统计指令失败: {}", e.getMessage());
sendGroupMessage(groupId, "统计查询失败");
}
}
@@ -183,7 +196,8 @@ public class OpenIMCallbackController {
* 将OpenIM群ID转换为业务群ID
*/
private Long getBizGroupId(String openimGroupId) {
// TODO: 通过映射表查询
return 1L;
// 通过GroupService查询映射
var group = groupService.getByOpenimGroupId(openimGroupId);
return group != null ? group.getId() : null;
}
}