|
@@ -15,7 +15,7 @@ class ShenpiAgain extends Subscription {
|
|
|
static get schedule() {
|
|
|
return {
|
|
|
interval: '1m',
|
|
|
- type: 'all',
|
|
|
+ type: 'worker',
|
|
|
};
|
|
|
}
|
|
|
|
|
@@ -38,6 +38,7 @@ class ShenpiAgain extends Subscription {
|
|
|
const tenderInfoList = await ctx.service.tenderInfo.getAllDataByCondition({ columns: ['id', 'tid', 'deal_info'], where: { tid: tidList } });
|
|
|
const updateData = [];
|
|
|
const deleteData = [];
|
|
|
+ const sendData = [];
|
|
|
for (const i of list) {
|
|
|
if (i.times > 10) continue;// 发超过10次就不发了吧
|
|
|
const uinfo = ctx.helper._.find(usersNoticeSetting, { id: i.uid });
|
|
@@ -78,16 +79,31 @@ class ShenpiAgain extends Subscription {
|
|
|
data: t,
|
|
|
info: newTenderInfo,
|
|
|
};
|
|
|
- await ctx.helper.sendWechat(i.uid, i.sms_type, smsTypeConst.judge.approval.toString(), i.template, JSON.parse(i.wx_data), tender, { protocol: i.origin_url.protocol, host: i.origin_url.host });
|
|
|
+ // 可能会重复发送,未知原因
|
|
|
+ // await ctx.helper.sendWechat(i.uid, i.sms_type, smsTypeConst.judge.approval.toString(), i.template, JSON.parse(i.wx_data), tender, { protocol: i.origin_url.protocol, host: i.origin_url.host });
|
|
|
updateData.push({
|
|
|
id: i.id,
|
|
|
times: i.times + 1,
|
|
|
last_time: ctx.helper.dateTran(new Date(), 'YYYY-MM-DD HH:mm'),
|
|
|
});
|
|
|
+ sendData.push({
|
|
|
+ uid: i.uid,
|
|
|
+ sms_type: i.sms_type,
|
|
|
+ sp_type: smsTypeConst.judge.approval.toString(),
|
|
|
+ template: i.template,
|
|
|
+ wx_data: JSON.parse(i.wx_data),
|
|
|
+ tender,
|
|
|
+ origin_url: i.origin_url,
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
if (updateData.length > 0) await ctx.service.noticeAgain.defaultUpdateRows(updateData);
|
|
|
if (deleteData.length > 0) await ctx.service.noticeAgain.deleteById(deleteData);
|
|
|
+ if (sendData.length > 0) {
|
|
|
+ for (const s of sendData) {
|
|
|
+ await ctx.helper.sendWechat(s.uid, s.sms_type, s.sp_type, s.template, s.wx_data, s.tender, { protocol: s.origin_url.protocol, host: s.origin_url.host });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|