【发布时间】:2021-01-15 02:06:27
【问题描述】:
你好,我是云功能的新手,我想问一下为什么在一个 if 语句中获得多个主题 这是我的云功能:
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
const fcm = admin.messaging();
export const sendToTopic = functions.firestore
.document("Doctor2019/{documentId}")
.onCreate(async snapshot => {
const payload: admin.messaging.MessagingPayload = {
notification: {
title: 'NEW POST!',
body: `Click here to see New Post`,
icon: 'your-icon-url',
click_action: 'FLUTTER_NOTIFICATION_CLICK'
}
};
return fcm.sendToTopic('Doctor2019', payload);
});
问题是我有不止一个主题我想做的是检查其他集合上文档的创建并基于此发送通知,我真的不知道该怎么做,有什么帮助吗?
【问题讨论】:
-
那么,您是在问
if是如何工作的? developer.mozilla.org/de/docs/Web/JavaScript/Reference/… -
不,我的问题是算法将如何,因为我似乎无法弄清楚
标签: firebase flutter google-cloud-firestore google-cloud-functions firebase-cloud-messaging