|
@@ -10,6 +10,7 @@ import com.zanxiang.game.module.sdk.constant.RedisKeyConstant;
|
|
import com.zanxiang.game.module.sdk.enums.DataTypeEnum;
|
|
import com.zanxiang.game.module.sdk.enums.DataTypeEnum;
|
|
import com.zanxiang.game.module.sdk.enums.KafkaEventTrackEnum;
|
|
import com.zanxiang.game.module.sdk.enums.KafkaEventTrackEnum;
|
|
import com.zanxiang.game.module.sdk.enums.LoginTypeEnum;
|
|
import com.zanxiang.game.module.sdk.enums.LoginTypeEnum;
|
|
|
|
+import com.zanxiang.game.module.sdk.listener.GameRoleCreateEvent;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameRoleActiveCallParam;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameRoleActiveCallParam;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameUserRoleSubmitParam;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameUserRoleSubmitParam;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameUserRoleUpdateParam;
|
|
import com.zanxiang.game.module.sdk.pojo.param.GameUserRoleUpdateParam;
|
|
@@ -22,6 +23,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.logging.log4j.util.Strings;
|
|
import org.apache.logging.log4j.util.Strings;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
@@ -72,6 +75,10 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
@Autowired
|
|
@Autowired
|
|
private IGameExtService gameExtService;
|
|
private IGameExtService gameExtService;
|
|
|
|
|
|
|
|
+ @Lazy
|
|
|
|
+ @Autowired
|
|
|
|
+ private ApplicationContext applicationContext;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Boolean updateUserGameRole(GameUserRoleSubmitParam param) {
|
|
public Boolean updateUserGameRole(GameUserRoleSubmitParam param) {
|
|
//查询游戏信息
|
|
//查询游戏信息
|
|
@@ -265,6 +272,13 @@ public class GameUserRoleServiceImpl extends ServiceImpl<GameUserRoleMapper, Gam
|
|
kafkaService.eventTrack(KafkaEventTrackEnum.KAFKA_EVENT_TRACK_ROLE_CREATE, JsonUtil.toString(userRole));
|
|
kafkaService.eventTrack(KafkaEventTrackEnum.KAFKA_EVENT_TRACK_ROLE_CREATE, JsonUtil.toString(userRole));
|
|
//创建角色通知监听服务
|
|
//创建角色通知监听服务
|
|
this.callListenIn(param, userData);
|
|
this.callListenIn(param, userData);
|
|
|
|
+ //发布创角事件
|
|
|
|
+ try {
|
|
|
|
+ GameRoleCreateEvent gameRoleCreateEvent = new GameRoleCreateEvent(this, userRole);
|
|
|
|
+ applicationContext.publishEvent(gameRoleCreateEvent);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("创角事件发布异常, gameId : {}, role : {}", userRole.getGameId(), userRole.getRoleId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
private GameUserRole transform(GameUserRoleUpdateParam param, UserData userData, GameUser gameUser, User user) {
|
|
private GameUserRole transform(GameUserRoleUpdateParam param, UserData userData, GameUser gameUser, User user) {
|