收藏
回答

web端监控幸运开发数据变动无效问题

appid:wx4422a57daf8d90a7
cloud_env:hx-system-8gzbvt8c688c8e49
basename:hx_order_voice
where({
uid:1385,
model:manage_shop
})


export const orderList = () => {
  const db = cloudinit.database()
  let uid = storageSession.getItem('info').data.id
  return new Promise((resolve, reject) => {
    orderonline = db
      .collection('hx_order_voice')
      .orderBy('time', 'desc')
      .limit(5)
      .where({
        uid: uid,
        model: storageSession.getItem('App') == 30 ? 'manage' : 'manage_shop'
      })
      .watch({
        onChange: function (data) {
          console.log(data, '订单列表刷新', uid, new Date())
          if (!data.docChanges.length) return
          let contMsg = data.docChanges[0]
          if (contMsg.dataType == 'init') return console.log('init')
          if (contMsg.dataType == 'add') {
            resolve('刷新')
          }
        },
        onError: function (err) {
          console.error('the watch closed because of error', err)
        }
      })
  })
}


回答关注问题邀请回答
收藏

1 个回答

  • super-liang
    super-liang
    2022-11-09

    谁给回复下

    2022-11-09
    有用
    回复
登录 后发表内容