mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 01:39:52 +08:00
Return committed trigger IDs and add CLI wait and trigger-specific logs while preserving API, CLI, transaction, deduplication and unknown-result semantics. Move scheduling, lifecycle, settlement, queries and legacy adapters into back/cron; remove obsolete internal import paths and circular dependencies. Apply project formatting across the repository, cover CJS/MJS in formatting hooks, add prettier:check and require formatting checks in AGENTS.md. Validation: backend build; 1398 backend/frontend tests passed (17 platform skips); 327 CLI tests passed (6 platform skips); 670 files pass format checks.
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
/**
|
|
* 任务名称
|
|
* name: script name
|
|
* 定时规则
|
|
* cron: 1 9 * * *
|
|
*/
|
|
console.log('test scripts');
|
|
QLAPI.notify('test scripts', 'test desc');
|
|
QLAPI.getEnvs({ searchValue: 'dddd' }).then((x) => {
|
|
console.log('getEnvs', x);
|
|
});
|
|
QLAPI.systemNotify({ title: '123', content: '231' }).then((x) => {
|
|
console.log('systemNotify', x);
|
|
});
|
|
|
|
// 查询定时任务 (Query cron tasks)
|
|
QLAPI.getCrons({ searchValue: 'test' }).then((x) => {
|
|
console.log('getCrons', x);
|
|
});
|
|
|
|
// 通过ID查询定时任务 (Get cron by ID)
|
|
QLAPI.getCronById({ id: 1 })
|
|
.then((x) => {
|
|
console.log('getCronById', x);
|
|
})
|
|
.catch((err) => {
|
|
console.log('getCronById error', err);
|
|
});
|
|
|
|
// 启用定时任务 (Enable cron tasks)
|
|
QLAPI.enableCrons({ ids: [1, 2] }).then((x) => {
|
|
console.log('enableCrons', x);
|
|
});
|
|
|
|
// 禁用定时任务 (Disable cron tasks)
|
|
QLAPI.disableCrons({ ids: [1, 2] }).then((x) => {
|
|
console.log('disableCrons', x);
|
|
});
|
|
|
|
// 手动执行定时任务 (Run cron tasks manually)
|
|
QLAPI.runCrons({ ids: [1] }).then((x) => {
|
|
console.log('runCrons', x);
|
|
});
|
|
|
|
console.log('test desc');
|