echoapi-cron-scheduler-batch 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -9
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -42,7 +42,6 @@ class CronScheduler {
42
42
  is_cancel INTEGER DEFAULT 0,
43
43
  api_token TEXT,
44
44
  project_id TEXT,
45
- user_uid TEXT, -- 新增:存储用户UID
46
45
  cases TEXT, -- 存储 runners 数组 JSON
47
46
  create_dtime INTEGER
48
47
  )
@@ -166,9 +165,8 @@ class CronScheduler {
166
165
  const finalPayload = {
167
166
  info: {
168
167
  job_id: record.job_info.job_id,
169
- name: record.job_info.name,
168
+ report_name: record.job_info.name,
170
169
  project_id: record.job_info.project_id,
171
- user_uid: record.job_info.user_uid, // 放入最终报文
172
170
  execution_id: executionId,
173
171
  start_at: this.formatTimeToISO(record.job_info.start_time),
174
172
  end_at: this.formatTimeToISO(endTime),
@@ -198,7 +196,7 @@ class CronScheduler {
198
196
  console.log(`[CronScheduler] Batch job finished. ExecutionID: ${executionId}. Aggregating ${record.total} results...`);
199
197
  // console.log(`[CronScheduler] TOKEN ${record.api_token}`);
200
198
 
201
- const response = await axios.post(`${this.apiUrl}/open/automated_testing/report/add`, finalPayload, {
199
+ const response = await axios.post(`${this.apiUrl}/open/hnzycfc/scheduled_task/report/add`, finalPayload, {
202
200
  headers: {
203
201
  'Content-Type': 'application/json',
204
202
  'api-token': record.api_token
@@ -295,22 +293,21 @@ class CronScheduler {
295
293
  * 创建或更新任务
296
294
  */
297
295
  createJob(payload) {
298
- const { job_id, name, frequency, api_token, project_id, user_uid, runners } = payload;
296
+ const { job_id, name, frequency, api_token, project_id, runners } = payload;
299
297
  const casesJson = JSON.stringify(Array.isArray(runners) ? runners : []);
300
298
  const freqJson = JSON.stringify(frequency);
301
299
 
302
300
  const stmt = this.db.prepare(`
303
- INSERT INTO jobs (job_id, name, frequency, api_token, project_id, cases, create_dtime)
301
+ INSERT INTO jobs (job_id, name, frequency, api_token, project_id, cases, create_dtime)
304
302
  VALUES (?, ?, ?, ?, ?, ?, ?)
305
303
  ON CONFLICT(job_id) DO UPDATE SET
306
304
  name=excluded.name,
307
305
  frequency=excluded.frequency,
308
306
  cases=excluded.cases,
309
307
  api_token=excluded.api_token,
310
- user_uid=excluded.user_uid, -- 更新时也同步 UID
311
308
  is_cancel=0
312
309
  `);
313
- stmt.run(job_id, name, freqJson, api_token, project_id, user_uid || '', casesJson, Date.now());
310
+ stmt.run(job_id, name, freqJson, api_token, project_id, casesJson, Date.now());
314
311
 
315
312
  // 使用增量更新,不再 loadJobs()
316
313
  this.upsertTimer(job_id, name, frequency, { is_cancel: 0 });
@@ -395,7 +392,6 @@ class CronScheduler {
395
392
  job_id: job.job_id,
396
393
  name: job.name,
397
394
  project_id: job.project_id,
398
- user_uid: job.user_uid, // 将 UID 存入内存
399
395
  start_time: Date.now()
400
396
  // 如果数据库有创建人字段,也可以存入:creator: job.creator
401
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-cron-scheduler-batch",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {