QQ小程序如何调用微信小程序云开发数据库?
QQ小程序的代码(备注:本人使用的是web sdk。云开发资源是在微信小程序开发工具里面开通的,但是腾讯云cloudbase里面可以进行查看和配置):
import cloudbase from "./utils/outer/cloudbase.full.1.4.1.js";
import adapter from './utils/outer/cloudbase-adapter-qq_mp.js';
App({
//已经参考https://docs.cloudbase.net/api-reference/webv2/adapter.html#di-2-bu-pei-zhi-an-quan-ying-yong-lai-yuan
onLaunch: function () {
cloudbase.useAdapters(adapter);
cloudbase.init({
env: 'envid',
appSign: 'appSign',
appSecret: {
appAccessKeyId: '1',
appAccessKey: '666fd52'
}
})
const db = cloudbase.database();
db.collection("articles").where(
{_id:"articleID"}
).get().then(res=>{
console.log(res)
});
}
})
最后报错:{code: “DATABASE_PERMISSION_DENIED”, message: “Permission denied”, requestId: “13128a9ea14d1”}
1 回复
可以用了,我没有设置数据库的权限为自定义安全规则。参考:https://developers.weixin.qq.com/community/develop/doc/00024e62b500800e348ae1a9357800?_at=1615517801762