北斗应用技术培训报名系统

This commit is contained in:
2026-03-27 17:53:28 +08:00
commit e8e23fb003
58 changed files with 2091 additions and 0 deletions

30
app/schedule/auditTask.js Normal file
View File

@@ -0,0 +1,30 @@
module.exports = {
schedule: {
interval: '1h', // 1 小时间隔
type: 'all', // 指定所有的 worker 都需要执行
},
async task(ctx) {
const AuditResult = await ctx.model.Audit.findAll({ where: { status: 0 } });
if (AuditResult.length != 0) {
AuditResult.forEach(async element => {
const { identity_card, user_name } = element.dataValues;
const check = await ctx.app.redis.get('db3').get(identity_card);
if (check == null) {
await ctx.curl('http://127.0.0.1:' + 8011 + '/CNTEV', {
dataType: 'json',
contentType: 'application/x-www-form-urlencoded',
method: 'POST',
timeout: 3000,
data: {
idCard: identity_card,
name: user_name
},
});
} else {
await ctx.service.user.updateCNTEV(identity_card, user_name, JSON.parse(check).real_check);
await ctx.app.redis.get('db3').del(identity_card);
}
});
};
},
};