|
@@ -109,28 +109,27 @@ class PatentearlyService extends CrudService {
|
|
// 判断是否是三个月的区间
|
|
// 判断是否是三个月的区间
|
|
const r = moment().isBetween(start, end, null, '[]');
|
|
const r = moment().isBetween(start, end, null, '[]');
|
|
// 判断是否在一个月的区间
|
|
// 判断是否在一个月的区间
|
|
- const one_section = moment().isBetween(start_thr, end, null, '[]');
|
|
|
|
if (r) {
|
|
if (r) {
|
|
// 三个月内的第一天||两个月内第一天||一个月内的每天 发送消息
|
|
// 三个月内的第一天||两个月内第一天||一个月内的每天 发送消息
|
|
// 是否发送的变量
|
|
// 是否发送的变量
|
|
let dr = false;
|
|
let dr = false;
|
|
const toDay = moment().format('YYYY-MM-DD');
|
|
const toDay = moment().format('YYYY-MM-DD');
|
|
- if (toDay === start || toDay === start_two || one_section) {
|
|
|
|
|
|
+ if (toDay === start || toDay === start_two || toDay === start_thr) {
|
|
dr = true;
|
|
dr = true;
|
|
}
|
|
}
|
|
// 不发就继续
|
|
// 不发就继续
|
|
if (!dr) continue;
|
|
if (!dr) continue;
|
|
const { user_id } = i;
|
|
const { user_id } = i;
|
|
- // 2021-11-04 修改,因为inventor修改为发明人[Object],所以发明人需要处理成字符串
|
|
|
|
const users = user_id.map(i => i.user_id);
|
|
const users = user_id.map(i => i.user_id);
|
|
- // // const inventorNameString = inventor.map(i => i.name).join(';');
|
|
|
|
- // // const content = `发明人 【${inventorNameString}】 的已授权专利 【${name}】 即将失效,避免专利失效过期,请用户及时查看消息并处理! `;
|
|
|
|
|
|
+ // 判断预警次数
|
|
|
|
+ const early_num = toDay === start ? 1 : toDay === start_two ? 2 : toDay === start_thr ? 3 : '';
|
|
const content = '您可能需缴年费了,具体以缴费通知书为准 ';
|
|
const content = '您可能需缴年费了,具体以缴费通知书为准 ';
|
|
const nobj = {
|
|
const nobj = {
|
|
..._.omit(i, [ '_id', 'id', 'users' ]),
|
|
..._.omit(i, [ '_id', 'id', 'users' ]),
|
|
content,
|
|
content,
|
|
parent_id: i._id,
|
|
parent_id: i._id,
|
|
user_id: users,
|
|
user_id: users,
|
|
|
|
+ early_num,
|
|
};
|
|
};
|
|
this.model.create(nobj);
|
|
this.model.create(nobj);
|
|
// 2021-11-04添加 向 patentexamine 表中添加数据
|
|
// 2021-11-04添加 向 patentexamine 表中添加数据
|