diff --git a/chopperbot-common/src/main/java/org/example/init/InitPluginRegister.java b/chopperbot-common/src/main/java/org/example/init/InitPluginRegister.java index 5a1b12a..6ac7622 100644 --- a/chopperbot-common/src/main/java/org/example/init/InitPluginRegister.java +++ b/chopperbot-common/src/main/java/org/example/init/InitPluginRegister.java @@ -151,12 +151,17 @@ public class InitPluginRegister { throw PluginDependOnException.MissingFatherPlugin(needPlugin,pluginName); } } - if (initMachine.init()) { - registerPluginTable.put(pluginName,initMachine); - initMachine.afterInit(); - return true; - }else{ - return false; + try { + if (initMachine.init()) { + registerPluginTable.put(pluginName,initMachine); + initMachine.afterInit(); + return true; + }else{ + return false; + } + }catch (Exception e){ + ChopperLogFactory.getLogger(LoggerType.System) + .error(String.format("❌ %s plugin start failed ! error:%s", pluginName,e.getMessage())); } }else{ return false; diff --git a/chopperbot-console/src/main/java/org/example/controller/HotController.java b/chopperbot-console/src/main/java/org/example/controller/HotController.java index b552c89..06d868c 100644 --- a/chopperbot-console/src/main/java/org/example/controller/HotController.java +++ b/chopperbot-console/src/main/java/org/example/controller/HotController.java @@ -120,7 +120,7 @@ public class HotController { @RequestParam(required = false) Integer focusBarrage, @RequestParam(required = false) Long checkTime){ hotModuleService.liverFollowApi().changeSetting( - Map.of("focusList",focusLive, + Map.of("focusLive",focusLive, "focusBarrage",focusBarrage, "checkTime",checkTime ) @@ -130,6 +130,14 @@ public class HotController { ); } + @CheckPlugin(needPlugin = {PluginName.HOT_LIVER_FOLLOWER}) + @GetMapping("/liveFollow/setting") + public Result changeLiverFollowSetting(){ + return Result.success( + Map.of("setting",hotModuleService.liverFollowApi().getSetting()) + ); + } + @CheckPlugin(needPlugin = {PluginName.HOT_RECOMMENDATION_PLUGIN}) @GetMapping("/hotRecommendation/list") public Result getFollowDogs(){ diff --git a/chopperbot-hot/src/main/java/org/example/api/LiverFollowApi.java b/chopperbot-hot/src/main/java/org/example/api/LiverFollowApi.java index 2fd161b..4c39102 100644 --- a/chopperbot-hot/src/main/java/org/example/api/LiverFollowApi.java +++ b/chopperbot-hot/src/main/java/org/example/api/LiverFollowApi.java @@ -52,10 +52,10 @@ public class LiverFollowApi { } public void changeSetting(Map settings){ - ConfigFileUtil.changeSetting(settings,HotModuleConfig.getFullFilePath(),"liverFollower"); + ConfigFileUtil.changeSetting(settings,HotModuleConfig.getFullFilePath(),"LiverFollower"); } public Object getSetting(){ - return ConfigFileUtil.getSetting(HotModuleConfig.getFullFilePath(),"liverFollower"); + return ConfigFileUtil.getSetting(HotModuleConfig.getFullFilePath(),"LiverFollower"); } } diff --git a/chopperbot-hot/src/main/java/org/example/core/focus/LiverFollower.java b/chopperbot-hot/src/main/java/org/example/core/focus/LiverFollower.java index 4b4c90d..29f36b2 100644 --- a/chopperbot-hot/src/main/java/org/example/core/focus/LiverFollower.java +++ b/chopperbot-hot/src/main/java/org/example/core/focus/LiverFollower.java @@ -61,7 +61,7 @@ public class LiverFollower extends SpringBootPlugin { FileCache fileCache = plugin.getFileCache(HotModuleConfig.getFullFilePath()); focusLive = (Integer)fileCache.get("LiverFollower", "focusLive")==1; //focusBarrage = (Integer)fileCache.get("LiverFollower", "focusBarrage")==1; - checkTime = (Long)fileCache.get("LiverFollower", "checkTime"); + checkTime = Integer.toUnsignedLong((Integer) fileCache.get("LiverFollower", "checkTime")); focusRecord = (Integer)fileCache.get("LiverFollower", "focusRecord")==1; checkTime = (Integer)fileCache.get("LiverFollower", "checkTime"); focusLivers = service.getFocusLivers(); diff --git a/config/Hot/hotModuleConfig.json b/config/Hot/hotModuleConfig.json index 14859d5..adaf20e 100644 --- a/config/Hot/hotModuleConfig.json +++ b/config/Hot/hotModuleConfig.json @@ -1,14 +1,14 @@ { - "updateTime":"2023-09-11 12:56:40", "data":{ - "LiverFollower":{ - "checkTime":60000, - "focusLive":1, - "focusRecord":1, - "focusBarrage":1 - }, "HotGuard":{ "GuardNum":10 + }, + "LiverFollower":{ + "checkTime":120000, + "focusRecord":1, + "focusLive":1, + "focusBarrage":1 } - } + }, + "updateTime":"2023-10-12 01:51:20" } diff --git a/config/chopperBotConfig.json b/config/chopperBotConfig.json index 01a69ab..2cd6c10 100644 --- a/config/chopperBotConfig.json +++ b/config/chopperBotConfig.json @@ -24,12 +24,12 @@ "HotRecommendation":true, "BarrageScoreCurve":true, "FileCacheManager":true, - "LiverFollower":false, + "LiverFollower":true, "TaskMonitor":true, "HotConfig":true, "TaskCenter":true, "CreeperConfig":true } }, - "updateTime":"2023-10-11 18:15:50" + "updateTime":"2023-10-12 01:50:20" } \ No newline at end of file diff --git a/console-ui/src/api/hot/liveFollowApi.ts b/console-ui/src/api/hot/liveFollowApi.ts index 67b283c..50544ec 100644 --- a/console-ui/src/api/hot/liveFollowApi.ts +++ b/console-ui/src/api/hot/liveFollowApi.ts @@ -30,7 +30,14 @@ export function unFollow(platform:string,liver:string){ }); } -export function changeSetting(checkTime:number,focusLive:string,focusBarrage:string){ +export function getSetting(){ + return request({ + url: '/hot/liveFollow/setting', + method: 'get', + }) +} + +export function changeSetting(checkTime:number,focusLive:number,focusBarrage:number){ return request({ url: '/hot/liveFollow/changeSetting', method: 'get', diff --git a/console-ui/src/utils/request.ts b/console-ui/src/utils/request.ts index 2fa6c48..0015641 100644 --- a/console-ui/src/utils/request.ts +++ b/console-ui/src/utils/request.ts @@ -1,5 +1,7 @@ import axios from "axios"; +import {useSnackbarStore} from "@/stores/snackbarStore"; +const snackbarStore = useSnackbarStore(); const request = axios.create({ baseURL: "/appApi", timeout: 100000, @@ -16,8 +18,13 @@ request.interceptors.request.use(config => { // 可以在接口响应后统一处理结果 request.interceptors.response.use( response => { + if(response.status!=200){ + snackbarStore.showSuccessMessage("服务异常!") + } let res = response.data; - + if(res.code === 114514){ + snackbarStore.showErrorMessage("该插件没有启动,请先启动插件!") + } // 如果是返回的文件 if (response.config.responseType === 'blob') { return res diff --git a/console-ui/src/views/app/hot/hot_guard/pages/HotGuardsPage.vue b/console-ui/src/views/app/hot/hot_guard/pages/HotGuardsPage.vue index 88150f1..f426e0f 100644 --- a/console-ui/src/views/app/hot/hot_guard/pages/HotGuardsPage.vue +++ b/console-ui/src/views/app/hot/hot_guard/pages/HotGuardsPage.vue @@ -56,6 +56,11 @@ onMounted(async()=>{ }) }) +setInterval(()=>{ + getGuards().then(res=>{ + hotGuardStore.guards = res.data['list'] + }) +},30000) diff --git a/console-ui/src/views/app/hot/live_follow/LiveFollowPage.vue b/console-ui/src/views/app/hot/live_follow/LiveFollowPage.vue index 360033e..e377cf8 100644 --- a/console-ui/src/views/app/hot/live_follow/LiveFollowPage.vue +++ b/console-ui/src/views/app/hot/live_follow/LiveFollowPage.vue @@ -1,12 +1,12 @@ + + diff --git a/console-ui/src/views/app/hot/live_follow/component/LiveFollowCard.vue b/console-ui/src/views/app/hot/live_follow/component/LiveFollowCard.vue index 8a6b616..10fccda 100644 --- a/console-ui/src/views/app/hot/live_follow/component/LiveFollowCard.vue +++ b/console-ui/src/views/app/hot/live_follow/component/LiveFollowCard.vue @@ -1,17 +1,14 @@ diff --git a/console-ui/src/views/app/hot/live_follow/focusLiverTypes.ts b/console-ui/src/views/app/hot/live_follow/focusLiverTypes.ts index 15720ca..562b4c2 100644 --- a/console-ui/src/views/app/hot/live_follow/focusLiverTypes.ts +++ b/console-ui/src/views/app/hot/live_follow/focusLiverTypes.ts @@ -1,4 +1,5 @@ export interface FocusLiver{ + id:number; liver: string; roomId: string; platform: string; diff --git a/console-ui/src/views/app/hot/live_follow/liveFollowStore.ts b/console-ui/src/views/app/hot/live_follow/liveFollowStore.ts new file mode 100644 index 0000000..0ff4450 --- /dev/null +++ b/console-ui/src/views/app/hot/live_follow/liveFollowStore.ts @@ -0,0 +1,21 @@ +import { defineStore } from "pinia"; +import {FocusLiver} from "@/views/app/hot/live_follow/focusLiverTypes" + + +export const useLiveFollowStore = defineStore({ + id: "hotRecommend", + state:()=>({ + dialog: ref(false), + addDialog: ref(false), + setting:ref({}), + liveFollowList: ref([]), + }), + + getters:{ + + }, + + actions:{ + + } +})