错误 $ProfilePictureUrl 没有替换我的数据库中的图片 ID,即 Firebase 实时数据库
Error $ProfilePictureUrl is not replacing the pic id from My Database i.e Firebase realtime database
我正在用#js 开发 Google 助手,当用户点击我的 link http://host/$Profile 时,它需要显示个人资料图片,但是 $profile 在我的数据库, $profile 应该被替换为我数据库中的 423466934206595086.jpg 。这是我的代码
"buttonUrl: 'http://armws.sste.saiveeetha.com/Content/ProfilePicture/$ProfilePictureUrl' "----->当我点击 url 即 $ProfilePictureUrl 没有替换 Pic Id 时......我不知道不知道该怎么做.........请帮助我....!!!
const EmpId = agent.parameters.EmpId;
var ref3 = admin.database().ref().child("Table/");
var query3 = ref3.orderByChild("EmpId").equalTo(EmpId);
return query3.once("value",function(snapshot) {
snapshot.forEach(function(child) {
agent.add(`The Faculty name is ` + child.val().FirstName);
agent.add(new Card({
title: ` Name:${child.val().FirstName}
Employee Id: ${child.val().EmpId}
Address:: ${child.val().Address}
Email : ${child.val().EmailId}
DOB : ${child.val().DateOfBirth}
Department: ${child.val().DepartmentName}`,
imageUrl: 'https://eencrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7lF8oXwLpXitlwizIdXVM-cGRTGqi79X3I4t5oBlNfhGe8mKN3Dg',
text: `Thanks for using Saveetha Google Assistant \n DR ${child.val().FirstName} `,
buttonText: 'View Profile Picture',
buttonUrl: 'http://........./Content/ProfilePicture/$ProfilePictureUrl'
您正在使用JavaScripttemplate literals!方法不对。
为了让这个 buttonUrl: 'http://........./Content/ProfilePicture/$ProfilePictureUrl'
被 js 解析,你需要将它重写为
buttonUrl: `http://........./Content/ProfilePicture/${ProfilePictureUrl}`
这样JS会用它的值替换你的变量ProfilePictureUrl
。
JS 模板文字必须以反引号开头
var ProfilePictureUrl = 'World';
console.log(`Hello ${ProfilePictureUrl}`);
这将在控制台打印出 Hello World
我正在用#js 开发 Google 助手,当用户点击我的 link http://host/$Profile 时,它需要显示个人资料图片,但是 $profile 在我的数据库, $profile 应该被替换为我数据库中的 423466934206595086.jpg 。这是我的代码 "buttonUrl: 'http://armws.sste.saiveeetha.com/Content/ProfilePicture/$ProfilePictureUrl' "----->当我点击 url 即 $ProfilePictureUrl 没有替换 Pic Id 时......我不知道不知道该怎么做.........请帮助我....!!!
const EmpId = agent.parameters.EmpId;
var ref3 = admin.database().ref().child("Table/");
var query3 = ref3.orderByChild("EmpId").equalTo(EmpId);
return query3.once("value",function(snapshot) {
snapshot.forEach(function(child) {
agent.add(`The Faculty name is ` + child.val().FirstName);
agent.add(new Card({
title: ` Name:${child.val().FirstName}
Employee Id: ${child.val().EmpId}
Address:: ${child.val().Address}
Email : ${child.val().EmailId}
DOB : ${child.val().DateOfBirth}
Department: ${child.val().DepartmentName}`,
imageUrl: 'https://eencrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7lF8oXwLpXitlwizIdXVM-cGRTGqi79X3I4t5oBlNfhGe8mKN3Dg',
text: `Thanks for using Saveetha Google Assistant \n DR ${child.val().FirstName} `,
buttonText: 'View Profile Picture',
buttonUrl: 'http://........./Content/ProfilePicture/$ProfilePictureUrl'
您正在使用JavaScripttemplate literals!方法不对。
为了让这个 buttonUrl: 'http://........./Content/ProfilePicture/$ProfilePictureUrl'
被 js 解析,你需要将它重写为
buttonUrl: `http://........./Content/ProfilePicture/${ProfilePictureUrl}`
这样JS会用它的值替换你的变量ProfilePictureUrl
。
JS 模板文字必须以反引号开头
var ProfilePictureUrl = 'World';
console.log(`Hello ${ProfilePictureUrl}`);
这将在控制台打印出 Hello World