ludo-重构匹配逻辑
This commit is contained in:
@@ -21,15 +21,12 @@ public interface MqConstant {
|
||||
String YI_DUN_TEXT_ANTI_CONSUME_GROUP = "yidun_text_anti_consume_group";
|
||||
|
||||
String CHANGE_TOPIC = "charge_topic";
|
||||
|
||||
String CHARGE_CONSUME_GROUP = "charge_consume_group";
|
||||
|
||||
String ACT_USER_TASK_TOPIC = "act_user_task_topic";
|
||||
|
||||
String ACT_USER_TASK_CONSUME_GROUP = "act_user_task_consume_group";
|
||||
|
||||
String ACT_TASK_REWARD_TOPIC = "act_task_reward_topic";
|
||||
|
||||
String ACT_TASK_REWARD_CONSUME_GROUP = "act_task_reward_consume_group";
|
||||
|
||||
String LUCKY_24_TOPIC = "lucky_24_topic";
|
||||
@@ -41,4 +38,7 @@ public interface MqConstant {
|
||||
String BRAVO_TOPIC = "bravo_topic";
|
||||
String BRAVO_CONSUME_GROUP = "bravo_consume_group";
|
||||
|
||||
String MINI_GAME_MATCH_ROUND_TOPIC = "mini_game_match_round_topic";
|
||||
String MINI_GAME_MATCH_ROUND_CONSUME_GROUP = "mini_game_match_round_consume_group";
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,46 @@
|
||||
package com.accompany.mq.consumer;
|
||||
|
||||
import com.accompany.business.dto.miniGame.MiniGameMatchRoundDto;
|
||||
import com.accompany.business.message.MiniGameMatchRoundMessage;
|
||||
import com.accompany.business.model.miniGame.MiniGameMatchRound;
|
||||
import com.accompany.business.service.SendSysMsgService;
|
||||
import com.accompany.business.service.chat.ChatRoomManageService;
|
||||
import com.accompany.business.service.miniGame.MiniGameForNavService;
|
||||
import com.accompany.business.vo.chat.ChatRoomVo;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.mq.constant.MqConstant;
|
||||
import com.accompany.mq.listener.AbstractMessageListener;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ConditionalOnProperty(name = "spring.application.name", havingValue = "web")
|
||||
@RocketMQMessageListener(topic = MqConstant.MINI_GAME_MATCH_ROUND_TOPIC, consumerGroup = MqConstant.MINI_GAME_MATCH_ROUND_CONSUME_GROUP)
|
||||
public class MiniGameMatchRoundMessageConsumer extends AbstractMessageListener<MiniGameMatchRoundMessage> {
|
||||
|
||||
@Autowired
|
||||
private MiniGameForNavService navService;
|
||||
@Autowired
|
||||
private ChatRoomManageService chatRoomManageService;
|
||||
@Autowired
|
||||
private SendSysMsgService sendSysMsgService;
|
||||
|
||||
@Override
|
||||
protected void onMessage(MiniGameMatchRoundMessage message) {
|
||||
log.info("onMessage miniGameMatchRoundMessage: {}", message.toString());
|
||||
MiniGameMatchRound round = message.getRound();
|
||||
if (navService.matchForSuccess(round.getId())){
|
||||
return;
|
||||
}
|
||||
navService.matchForEqualize(round.getId());
|
||||
|
||||
//聊天室
|
||||
ChatRoomVo chatRoomVo = chatRoomManageService.getByRoomId(round.getRoomId());
|
||||
//匹配失败
|
||||
sendSysMsgService.sendSingleRoomMessage(round.getRoomId(), chatRoomVo.getChatRoomId().toString(), Constant.DefMsgType.MINI_GAME_MATCH, Constant.DefMsgType.MINI_GAME_MATCH_FOR_FAIL, new MiniGameMatchRoundDto());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user