评论管理

This commit is contained in:
ChenXinXin committed 2024-05-21 13:40:42 +08:00
1 parent 1f99dcd134
commit 6aadef58bf
6 files changed
+293 -11

No files matched your search

+30
View File
@@ -599,6 +599,36 @@ class TaskService extends Service {
throw new Error("审批信息已更新,请重新刷新页面!")
}
}
async updateComment() {
const { jianghuKnex } = this.app;
const { userId, username } = this.ctx.userInfo;
const { actionData, where } = this.ctx.request.body.appData;
const { taskCommentList, taskInitUser, taskEditUserList } = actionData;
const noticeInsertData = []
var noticeUser = taskEditUserList && taskEditUserList.split(',') || []
// 如果是审批单申请人添加的备注,就只给当前审批人发送(已经通过审批人的不会收到提醒);
// 如果是已经审批了的审批人添加的备注,就给其他当前节点未审批的审批人和申请人发送消息提醒。
if (userId !== taskInitUser) {
noticeUser.push(taskInitUser)
}
noticeInsertData.push({
noticeId: await idGenerateUtil.uuid(),
noticeName: "通知-审批-" + where.taskId,
noticeContent: _.uniq(noticeUser).join(','),
pushContent: '{}',
pushStatus: "success",
pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss")
})
await jianghuKnex.transaction(async trx => {
await trx("task", this.ctx).where(where).jhUpdate({ taskCommentList: JSON.stringify(taskCommentList) });
if (noticeInsertData.length > 0) await trx("notice_push", this.ctx).jhInsert(noticeInsertData);
})
}
}
module.exports = TaskService;