云函数 db.serverDate() 插入的数据是 {offset: 0}
发布于 5 年前 作者 fangzhang 1062 次浏览 来自 问答

是 api 的 bug 吗?

exports.main = async(event, context) => {
  try {
    return await db.collection('test').doc(event.itemId).update({
        data: {
          comments: _.push({
            comment: event.content,
            createAt: db.serverDate(),
          })
        }
      })
  } catch (e) {
    console.error(e)
  }
}
2 回复

我插入的数据是正常,客户端的数据是

{offset: 0}

我打印出来是createtime:2018-10-11T02:58:31.219Z”,后台是Thu Oct 11 2018 10:58:31 GMT+0800 (中国标准时间)

回到顶部