|
@@ -0,0 +1,22 @@
|
|
|
+const cloud = require('wx-server-sdk')
|
|
|
+
|
|
|
+cloud.init({
|
|
|
+ env: cloud.DYNAMIC_CURRENT_ENV
|
|
|
+})
|
|
|
+const db = cloud.database();
|
|
|
+async function init() {
|
|
|
+ try {
|
|
|
+ await db.createCollection('questionBank')
|
|
|
+ await db.createCollection('questionRecord')
|
|
|
+ await db.createCollection('user')
|
|
|
+ } catch (err) {
|
|
|
+ console.log('------>', err)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+module.exports = {
|
|
|
+ cloud,
|
|
|
+ db,
|
|
|
+ init
|
|
|
+}
|