feat: 消息转发接口receive_id支持逗号分割
This commit is contained in:
parent
686fa2429d
commit
6e8dd75697
@ -10,10 +10,10 @@ const validateMessageReq = (body: MsgProxy.Body) => {
|
||||
if (!body.api_key) {
|
||||
return netTool.badRequest("api_key is required")
|
||||
}
|
||||
if (!body.group_id && !body.receive_id && !body.receive_id_list) {
|
||||
if (!body.group_id && !body.receive_id) {
|
||||
return netTool.badRequest("group_id or receive_id is required")
|
||||
}
|
||||
if ((body.receive_id || body.receive_id_list) && !body.receive_id_type) {
|
||||
if (body.receive_id && !body.receive_id_type) {
|
||||
return netTool.badRequest("receive_id_type is required")
|
||||
}
|
||||
if (!body.msg_type) {
|
||||
@ -109,15 +109,9 @@ export const manageMessageReq = async (req: Request) => {
|
||||
if (email) email.map(makeSendFunc("email"))
|
||||
}
|
||||
|
||||
// 如果指定了receive_id,则也放进receive_id_list
|
||||
if (body.receive_id) {
|
||||
if (!body.receive_id_list) body.receive_id_list = []
|
||||
body.receive_id_list.push(body.receive_id)
|
||||
}
|
||||
|
||||
// 如果有receive_id_list,则发送给所有receive_id_list中的人
|
||||
if (body.receive_id_list.length && body.receive_id_type) {
|
||||
body.receive_id_list.forEach((receive_id) => {
|
||||
// 如果有receive_id,则发送给所有receive_id中的人
|
||||
if (body.receive_id && body.receive_id_type) {
|
||||
body.receive_id.split(",").forEach((receive_id) => {
|
||||
sendList.push(
|
||||
service.lark.message
|
||||
.send(appName)(
|
||||
|
@ -11,7 +11,6 @@ export namespace MsgProxy {
|
||||
}
|
||||
export interface NormalBody extends BaseBody {
|
||||
receive_id: string
|
||||
receive_id_list: string[]
|
||||
receive_id_type: LarkServer.ReceiveIDType
|
||||
}
|
||||
export type Body = GroupBody & NormalBody
|
||||
|
Loading…
x
Reference in New Issue
Block a user