schema-name-adapter.js 482 B

12345678910111213141516171819
  1. // 引入uniCloud的数据库操作
  2. const db = uniCloud.database()
  3. module.exports = async function () {
  4. try {
  5. // 查询批量短信模板的文档数
  6. const count = await db.collection('batch-sms-template').count()
  7. // 如果文档数大于0,则设置表名
  8. if (count.total > 0) {
  9. this.tableNames = {
  10. template: 'batch-sms-template', // 模板表名
  11. task: 'batch-sms-task', // 任务表名
  12. log: 'batch-sms-result' // 日志表名
  13. }
  14. }
  15. } catch (e) {}
  16. }