|
@@ -104,7 +104,12 @@ async function main() {
|
|
|
source({ modelId: 59, myfield2: 'jsmz=' + coachId }),
|
|
source({ modelId: 59, myfield2: 'jsmz=' + coachId }),
|
|
|
source({ uid: coachId, nid: 29, myfield2: 'pl=' + coachId, orders: 'B.yysj=DESC', dszt: 30, xiaokejilu: 1 }),
|
|
source({ uid: coachId, nid: 29, myfield2: 'pl=' + coachId, orders: 'B.yysj=DESC', dszt: 30, xiaokejilu: 1 }),
|
|
|
]);
|
|
]);
|
|
|
- const evidence = legacyLessonPayEvidence(lessons, appointments, coachId);
|
|
|
|
|
|
|
+ const allEvidence = legacyLessonPayEvidence(lessons, appointments, coachId);
|
|
|
|
|
+ const requested = opt('--lesson-ids');
|
|
|
|
|
+ const ids = new Set(requested?.split(',') ?? []);
|
|
|
|
|
+ if ([...ids].some(id => !/^[1-9]\d*$/.test(id))) throw Error('课次编号格式无效');
|
|
|
|
|
+ const evidence = requested ? allEvidence.filter(row => ids.has(row.generalId)) : allEvidence;
|
|
|
|
|
+ if (requested && evidence.length !== ids.size) throw Error('有指定课次缺少唯一可核验的旧课酬');
|
|
|
const plan = { company, coachId, evidence };
|
|
const plan = { company, coachId, evidence };
|
|
|
const sha256 = createHash('sha256').update(JSON.stringify(plan)).digest('hex');
|
|
const sha256 = createHash('sha256').update(JSON.stringify(plan)).digest('hex');
|
|
|
await mkdir(out, { recursive: true, mode: 0o700 });
|
|
await mkdir(out, { recursive: true, mode: 0o700 });
|
|
@@ -152,6 +157,7 @@ async function main() {
|
|
|
try {
|
|
try {
|
|
|
id = (await parse('/classes/Function', 'POST', { name, path: name, code, type: 'standalone', enabled: true, params: [], paramList: [], respType: 'json' }, true)).objectId;
|
|
id = (await parse('/classes/Function', 'POST', { name, path: name, code, type: 'standalone', enabled: true, params: [], paramList: [], respType: 'json' }, true)).objectId;
|
|
|
const expected = await invoke({ mode: 'preview' });
|
|
const expected = await invoke({ mode: 'preview' });
|
|
|
|
|
+ if (requested && expected.length !== evidence.length) throw Error('指定课次的线上状态已变化,请重新核对');
|
|
|
await save('before-' + sha256 + '.json', expected);
|
|
await save('before-' + sha256 + '.json', expected);
|
|
|
const changed = await invoke({ mode: 'apply', expected });
|
|
const changed = await invoke({ mode: 'apply', expected });
|
|
|
await save('receipt-' + sha256 + '.json', changed);
|
|
await save('receipt-' + sha256 + '.json', changed);
|