计划任务

This commit is contained in:
snltty
2025-03-29 23:51:49 +08:00
parent 4fcb274971
commit 5fb598d59c
7 changed files with 16 additions and 17 deletions

View File

@@ -2,17 +2,17 @@
{ {
public enum PlanMessengerIds : ushort public enum PlanMessengerIds : ushort
{ {
Min = 3000, Min = 3200,
Add = 3001, Add = 3201,
AddForward = 3002, AddForward = 3202,
Remove = 3003, Remove = 3203,
RemoveForward = 3004, RemoveForward = 3204,
Get = 3005, Get = 3205,
GetForward = 3006, GetForward = 3206,
Max = 3099 Max = 3299
} }
} }

View File

@@ -34,6 +34,7 @@ namespace linker.messenger.sforward.client
if (forwardInfo != null) if (forwardInfo != null)
{ {
Start(forwardInfo, flag); Start(forwardInfo, flag);
OnChanged();
} }
} }
public void Stop(long id, string flag = "") public void Stop(long id, string flag = "")
@@ -42,6 +43,7 @@ namespace linker.messenger.sforward.client
if (forwardInfo != null) if (forwardInfo != null)
{ {
Stop(forwardInfo, flag); Stop(forwardInfo, flag);
OnChanged();
} }
} }
private void Start(SForwardInfo forwardInfo, string flag = "") private void Start(SForwardInfo forwardInfo, string flag = "")
@@ -82,15 +84,12 @@ namespace linker.messenger.sforward.client
{ {
sForwardClientStore.Update(forwardInfo.Id, false, string.Empty); sForwardClientStore.Update(forwardInfo.Id, false, string.Empty);
} }
OnChanged();
}); });
} }
catch (Exception ex) catch (Exception ex)
{ {
sForwardClientStore.Update(forwardInfo.Id, false, ex.Message); sForwardClientStore.Update(forwardInfo.Id, false, ex.Message);
LoggerHelper.Instance.Error(ex); LoggerHelper.Instance.Error(ex);
OnChanged();
} }
} }
@@ -109,7 +108,6 @@ namespace linker.messenger.sforward.client
{ {
OnClose(forwardInfo.Id, flag); OnClose(forwardInfo.Id, flag);
sForwardClientStore.Update(forwardInfo.Id, false, string.Empty); sForwardClientStore.Update(forwardInfo.Id, false, string.Empty);
OnChanged();
}); });
} }
catch (Exception ex) catch (Exception ex)
@@ -122,12 +120,14 @@ namespace linker.messenger.sforward.client
public bool Add(SForwardInfo forwardInfo) public bool Add(SForwardInfo forwardInfo)
{ {
sForwardClientStore.Add(forwardInfo); sForwardClientStore.Add(forwardInfo);
OnChanged();
return true; return true;
} }
public bool Remove(int id) public bool Remove(int id)
{ {
Stop(id); Stop(id);
sForwardClientStore.Remove(id); sForwardClientStore.Remove(id);
OnChanged();
return true; return true;
} }

View File

@@ -346,7 +346,7 @@ namespace linker.plugins.sforward.messenger
await sender.SendOnly(new MessageRequestWrap await sender.SendOnly(new MessageRequestWrap
{ {
Connection = cacheTo.Connection, Connection = cacheTo.Connection,
MessengerId = (ushort)SForwardMessengerIds.TestClientForward MessengerId = (ushort)SForwardMessengerIds.TestClient
}).ConfigureAwait(false); }).ConfigureAwait(false);
} }
} }

View File

@@ -171,7 +171,6 @@ export default {
if(regex.test(rule) == false){ if(regex.test(rule) == false){
return; return;
} }
console.log(rule.match(regex));
const [,year,month,day,hour,minute,second] = rule.match(regex); const [,year,month,day,hour,minute,second] = rule.match(regex);
if(minute == '*') state.ruleAt.type = 5; if(minute == '*') state.ruleAt.type = 5;
else if(hour == '*') state.ruleAt.type = 4; else if(hour == '*') state.ruleAt.type = 4;

View File

@@ -36,12 +36,12 @@ export default {
provide('plan',plan); provide('plan',plan);
const _getPlans = () => { const _getPlans = () => {
clearTimeout(plan.value.timer); clearTimeout(plan.value.timer);
console.log(plan.value.machineid,props.category);
getPlans(plan.value.machineid,props.category).then((res) => { getPlans(plan.value.machineid,props.category).then((res) => {
plan.value.list = res.reduce((json,item,index)=>{ plan.value.list = res.reduce((json,item,index)=>{
json[`${item.Key}-${item.Handle}`] = item; json[`${item.Key}-${item.Handle}`] = item;
return json; return json;
},{}); },{});
plan.value.timer = setTimeout(_getPlans,1000); plan.value.timer = setTimeout(_getPlans,1000);
}).catch(()=>{ }).catch(()=>{
plan.value.timer = setTimeout(_getPlans,1000); plan.value.timer = setTimeout(_getPlans,1000);

View File

@@ -1,5 +1,5 @@
v1.7.1 v1.7.1
2025-03-29 23:06:39 2025-03-29 23:51:48
1. 优化数据同步 1. 优化数据同步
2. 优化linux的tun网卡网卡读写分离提高性能 2. 优化linux的tun网卡网卡读写分离提高性能
3. 优化windows网卡的禁用自动启用 3. 优化windows网卡的禁用自动启用