Skip to content

案例

定义一个字典,判断是否存在KEY,返回值

javascript
// 获取第一个内容项目
const item = $input.first().json
const msgBody = item.body.msgBody
const msg = JSON.parse(msgBody)
const dic = {
  "瓦力AI": "62575488938894",
  "企微智能机器人": "267590753420547"
};
let chatId = ''
if (msg.content && dic.hasOwnProperty(msg.content)) {
  chatId= dic[msg.content]; // 如果存在,返回对应的值
}
return {
  result: !!chatId && item.body.chatType==0,
  chatId
}

上次更新时间:

最近更新