forked from leancloud/ticket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotify.js
More file actions
39 lines (35 loc) · 1.08 KB
/
notify.js
File metadata and controls
39 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const mail = require('./mail')
const bearychat = require('./bearychat')
const wechat = require('./wechat')
exports.newTicket = (ticket, author, assignee) => {
return Promise.all([
mail.newTicket(ticket, author, assignee),
bearychat.newTicket(ticket, author, assignee),
wechat.newTicket(ticket, author, assignee),
])
}
exports.replyTicket = (ticket, reply, replyAuthor) => {
const to = reply.get('isCustomerService') ? ticket.get('author') : ticket.get('assignee')
const data = {
ticket,
reply,
from: replyAuthor,
to,
isCustomerServiceReply: reply.get('isCustomerService'),
}
return Promise.all([
mail.replyTicket(data),
bearychat.replyTicket(data),
wechat.replyTicket(data),
])
}
exports.changeAssignee = (ticket, operator, assignee) => {
return Promise.all([
mail.changeAssignee(ticket, operator, assignee),
bearychat.changeAssignee(ticket, operator, assignee),
wechat.changeAssignee(ticket, operator, assignee),
])
}
exports.ticketEvaluation = (ticket, author, to) => {
return bearychat.ticketEvaluation(ticket, author, to)
}