|
@@ -15,10 +15,13 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.security.MessageDigest;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -39,6 +42,9 @@ public class CpServerApiService {
|
|
|
@Autowired
|
|
|
private IListenCallService listenCallService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
public boolean chatMsgSubmit(ChatSubmitParam param) {
|
|
|
GameSupper gameSupper = gameSupperService.getById(param.getGameId());
|
|
|
if (gameSupper == null) {
|
|
@@ -46,8 +52,25 @@ public class CpServerApiService {
|
|
|
}
|
|
|
this.signCheck(gameSupper.getCpServerKey(), param.getGameId(), param.getServerId(),
|
|
|
param.getSignTime(), param.getSign());
|
|
|
- log.error("接收到推送的聊天消息, param : {}", JsonUtil.toString(param));
|
|
|
- //调武哥接口发送过去
|
|
|
+ //查询区服信息
|
|
|
+ GameServer gameServer = gameServerService.getOne(new LambdaQueryWrapper<GameServer>()
|
|
|
+ .eq(GameServer::getGameId, param.getGameId())
|
|
|
+ .eq(GameServer::getServerId, param.getServerId())
|
|
|
+ .last("limit 1"));
|
|
|
+ //组装聊天参数
|
|
|
+ Map<String, Object> chatContentMap = param.getChatContentMap();
|
|
|
+ chatContentMap.put("game_name", gameSupper.getName());
|
|
|
+ if (gameServer != null) {
|
|
|
+ chatContentMap.put("server_name", gameServer.getServerName());
|
|
|
+ }
|
|
|
+ Map<String, Object> paramMap = new HashMap<>(1);
|
|
|
+ paramMap.put("data", chatContentMap);
|
|
|
+ //调武哥接口通知消息
|
|
|
+ try {
|
|
|
+ restTemplate.postForObject("http://47.99.157.216:9000/game/roleChat", paramMap, Object.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("调武哥接口通知消息异常, chatContentMap : {}, e : {}", JsonUtil.toString(paramMap), e.getMessage());
|
|
|
+ }
|
|
|
return Boolean.TRUE;
|
|
|
}
|
|
|
|