From 269ad8cedbb07ca207a6f33af23085894dab4aa6 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期日, 23 四月 2023 14:36:13 +0800 Subject: [PATCH] 修身目录刷新,优化公网下远程IP端口的获取 --- src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java b/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java index 79ca77b..77d83ee 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/WVPTimerTask.java @@ -1,7 +1,10 @@ package com.genersoft.iot.vmp.conf; +import com.alibaba.fastjson2.JSONObject; +import com.genersoft.iot.vmp.service.IMediaServerService; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -12,13 +15,19 @@ private IRedisCatchStorage redisCatchStorage; @Autowired - private SipConfig sipConfig; + private IMediaServerService mediaServerService; + + @Value("${server.port}") + private int serverPort; @Autowired - private MediaConfig mediaConfig; + private SipConfig sipConfig; - @Scheduled(cron="0/2 * * * * ? ") //姣�3绉掓墽琛屼竴娆� + @Scheduled(fixedRate = 2 * 1000) //姣�3绉掓墽琛屼竴娆� public void execute(){ -// redisCatchStorage.updateWVPInfo(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("ip", sipConfig.getIp()); + jsonObject.put("port", serverPort); + redisCatchStorage.updateWVPInfo(jsonObject, 3); } } -- Gitblit v1.8.0