This commit is contained in:
dute7liang
2024-01-14 17:29:03 +08:00
parent f035172f00
commit 7f195c02be
2 changed files with 16 additions and 2 deletions

View File

@@ -113,7 +113,7 @@ public class ChatManager {
}else{ }else{
roomId = room.getRoomId(); roomId = room.getRoomId();
} }
String wsSocketUrlFormat = systemConfigManager.getSystemConfig(SystemConfigEnum.WS_SOCKET_URL); String wsSocketUrlFormat = systemConfigManager.getWebSocketUrl();
String token = setWsToken(roomId, fromUser.getId(), toUser.getId(),userId); String token = setWsToken(roomId, fromUser.getId(), toUser.getId(),userId);
String weSocketUrl = String.format(wsSocketUrlFormat,token,roomId); String weSocketUrl = String.format(wsSocketUrlFormat,token,roomId);
Long guardPrice = systemConfigManager.getSystemConfigOfLong(SystemConfigEnum.GUARD_PRICE); Long guardPrice = systemConfigManager.getSystemConfigOfLong(SystemConfigEnum.GUARD_PRICE);
@@ -155,7 +155,7 @@ public class ChatManager {
User fromUser = userMap.get(userCall.getFromUid()); User fromUser = userMap.get(userCall.getFromUid());
User toUser = userMap.get(userCall.getToUid()); User toUser = userMap.get(userCall.getToUid());
Anchor anchor = anchorService.getByUserId(toUser.getId()); Anchor anchor = anchorService.getByUserId(toUser.getId());
String wsSocketUrlFormat = systemConfigManager.getSystemConfig(SystemConfigEnum.WS_SOCKET_URL); String wsSocketUrlFormat = systemConfigManager.getWebSocketUrl();
String token = setWsToken(userCall.getId(), fromUser.getId(), toUser.getId(), userId); String token = setWsToken(userCall.getId(), fromUser.getId(), toUser.getId(), userId);
String weSocketUrl = String.format(wsSocketUrlFormat,token,roomId); String weSocketUrl = String.format(wsSocketUrlFormat,token,roomId);
GetRoomResp getRoomResp = new GetRoomResp(); GetRoomResp getRoomResp = new GetRoomResp();

View File

@@ -5,6 +5,8 @@ import com.ruoyi.cai.enums.SystemConfigEnum;
import com.ruoyi.common.core.service.SensitiveService; import com.ruoyi.common.core.service.SensitiveService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.availability.AvailabilityChangeEvent;
import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -30,12 +32,24 @@ public class SystemConfigManager {
@Autowired @Autowired
private SensitiveService sensitiveService; private SensitiveService sensitiveService;
@Value("${spring.profiles.active:'dev'}")
private String active;
private final static String DEV_ACTIVE = "dev";
@PostConstruct @PostConstruct
public void initSensitive(){ public void initSensitive(){
boolean config = getSystemConfigOfBool(SystemConfigEnum.SENSITIVE_ENABLE); boolean config = getSystemConfigOfBool(SystemConfigEnum.SENSITIVE_ENABLE);
sensitiveService.setSensitive(config); sensitiveService.setSensitive(config);
} }
public String getWebSocketUrl(){
if(DEV_ACTIVE.equals(active)){
return SystemConfigEnum.WS_SOCKET_URL.getDefaultValue();
}
return getSystemConfig(SystemConfigEnum.WS_SOCKET_URL);
}
/** /**
* 获取配置信息返回boolean * 获取配置信息返回boolean
* @param systemConfig * @param systemConfig