|
|
@ -102,12 +102,13 @@ public class UserController {
|
|
|
|
@ApiOperation("获取本机IP地址,用来给websocket使用")
|
|
|
|
@ApiOperation("获取本机IP地址,用来给websocket使用")
|
|
|
|
@GetMapping("queryWebSocketUrl")
|
|
|
|
@GetMapping("queryWebSocketUrl")
|
|
|
|
public String queryWebSocketUrl() {
|
|
|
|
public String queryWebSocketUrl() {
|
|
|
|
String template = "wss://{}:{}/virtual-patient-websocket/";
|
|
|
|
|
|
|
|
// 如果是本地开发环境,则获取本机IP地址
|
|
|
|
// 如果是本地开发环境,则获取本机IP地址
|
|
|
|
if ("local".equals(active)) {
|
|
|
|
if ("local".equals(active)) {
|
|
|
|
|
|
|
|
String template = "ws://{}:{}/virtual-patient/";
|
|
|
|
String localhostStr = NetUtil.getLocalhostStr();
|
|
|
|
String localhostStr = NetUtil.getLocalhostStr();
|
|
|
|
return StrUtil.format(template, localhostStr, port);
|
|
|
|
return StrUtil.format(template, localhostStr, port);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
String template = "wss://{}:{}/virtual-patient-websocket/";
|
|
|
|
if (StrUtil.isNotBlank(wsIp) && StrUtil.isNotBlank(wsPort)) {
|
|
|
|
if (StrUtil.isNotBlank(wsIp) && StrUtil.isNotBlank(wsPort)) {
|
|
|
|
return StrUtil.format(template, wsIp, wsPort);
|
|
|
|
return StrUtil.format(template, wsIp, wsPort);
|
|
|
|
}
|
|
|
|
}
|
|
|
|