收藏
回答

请问云开发调用数据库苹果端报错,安卓可行是什么问题?

代码如下:

onPullDownRefresh: function () {
    const that = this
    db.collection('settings').doc('deadline').get().then(res => {
      let { hours, minutes } = res.data
      this.setData({ hours, minutes })
    })
    db.collection('users').doc(app.globalData.userInfo.id).get().then(res => {
      console.log(res)
      app.globalData.userInfo = res.data.userInfo
      app.globalData.userInfo.id = res.data._id
      that.setData({
        checked: app.globalData.userInfo.last_checkin_at.toDateString() === new Date().toDateString(),
        userInfo: res.data.userInfo
      })


      if (app.globalData.userInfo.type === '副院长') {
        db.collection('classes').doc('class_set').get().then(res => {
          let allClasses = []
          for (let major of res.data.major[app.globalData.userInfo.department]) {
            allClasses.push(...res.data.class_[major])
          }
          this.setData({ allClasses: allClasses.sort() })
        })
      }
    }).catch(err => {
      // 用户不存在
    }).finally(res => {
      wx.stopPullDownRefresh()
    })
  }

报错信息:

回答关注问题邀请回答
收藏
登录 后发表内容
问题标签