OpenIMApiClient 替换
This commit is contained in:
@@ -18,7 +18,7 @@ import com.tailbet.model.entity.RedPacketRecv;
|
||||
import com.tailbet.model.entity.SysConfig;
|
||||
import com.tailbet.model.entity.PendingTask;
|
||||
import com.tailbet.model.PendingTaskInfo;
|
||||
import com.tailbet.openim.OpenIMClient;
|
||||
import com.tailbet.openim.OpenIMApiClient;
|
||||
import com.tailbet.service.IGameService;
|
||||
import com.tailbet.service.IRedPacketService;
|
||||
import com.tailbet.service.IFakeUserService;
|
||||
@@ -54,7 +54,8 @@ public class GameJob {
|
||||
private final IGameService gameService;
|
||||
private final IRedPacketService redPacketService;
|
||||
private final IFakeUserService fakeUserService;
|
||||
private final OpenIMClient openIMClient;
|
||||
private final OpenIMApiClient openIMApiClient;
|
||||
private final com.tailbet.config.OpenIMProperties openIMProperties;
|
||||
|
||||
// 局状态监控(使用内存缓存,实际生产应使用Redis)
|
||||
private final Map<Long, RoundTask> roundTasks = new ConcurrentHashMap<>();
|
||||
@@ -534,8 +535,13 @@ public class GameJob {
|
||||
User user = userMapper.selectById(white.getUserId());
|
||||
if (user != null) {
|
||||
// 通过OpenIM发送通知
|
||||
openIMClient.sendUserMessage(String.valueOf(user.getId()),
|
||||
"尾数试算完成,请前往修改尾数。期号: " + round.getRoundNo());
|
||||
openIMApiClient.sendMsg(
|
||||
openIMProperties.getAdminUserId(),
|
||||
String.valueOf(user.getId()),
|
||||
1, // sessionType 1=单聊
|
||||
101, // contentType 101=文本
|
||||
java.util.Map.of("content", "尾数试算完成,请前往修改尾数。期号: " + round.getRoundNo())
|
||||
);
|
||||
log.info("通知白名单用户尾数试算完成: userId={}, roundId={}", user.getId(), roundId);
|
||||
}
|
||||
}
|
||||
@@ -546,24 +552,39 @@ public class GameJob {
|
||||
*/
|
||||
private void broadcastStartBet(Long groupId, String roundNo) {
|
||||
// 注意: 实际生产中需要通过Group表映射获取OpenIM群ID
|
||||
openIMClient.sendGroupMessage(String.valueOf(groupId),
|
||||
roundNo + "期开始下注");
|
||||
openIMApiClient.sendMsg(
|
||||
openIMProperties.getAdminUserId(),
|
||||
String.valueOf(groupId),
|
||||
3, // sessionType 3=群聊
|
||||
101, // contentType 101=文本
|
||||
java.util.Map.of("content", roundNo + "期开始下注")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 广播结束下注
|
||||
*/
|
||||
private void broadcastEndBet(Long groupId, String roundNo) {
|
||||
openIMClient.sendGroupMessage(String.valueOf(groupId),
|
||||
roundNo + "期结束下注");
|
||||
openIMApiClient.sendMsg(
|
||||
openIMProperties.getAdminUserId(),
|
||||
String.valueOf(groupId),
|
||||
3, // sessionType 3=群聊
|
||||
101, // contentType 101=文本
|
||||
java.util.Map.of("content", roundNo + "期结束下注")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 广播开始发红包
|
||||
*/
|
||||
private void broadcastStartRp(Long groupId, String roundNo) {
|
||||
openIMClient.sendGroupMessage(String.valueOf(groupId),
|
||||
roundNo + "期开始发红包");
|
||||
openIMApiClient.sendMsg(
|
||||
openIMProperties.getAdminUserId(),
|
||||
String.valueOf(groupId),
|
||||
3, // sessionType 3=群聊
|
||||
101, // contentType 101=文本
|
||||
java.util.Map.of("content", roundNo + "期开始发红包")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -581,7 +602,13 @@ public class GameJob {
|
||||
message += "\n\n近30期:\n" + history;
|
||||
}
|
||||
|
||||
openIMClient.sendGroupMessage(String.valueOf(groupId), message);
|
||||
openIMApiClient.sendMsg(
|
||||
openIMProperties.getAdminUserId(),
|
||||
String.valueOf(groupId),
|
||||
3, // sessionType 3=群聊
|
||||
101, // contentType 101=文本
|
||||
java.util.Map.of("content", message)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user