小程序云数据库新增商品不规则性的偶尔失败?
发布于 6 年前 作者 tanjun 1595 次浏览 来自 问答

addShops: function (e) {

const params = e.detail.value

//校验表单

if (!this.WxValidate.checkForm(params)) {

const error = this.WxValidate.errorList[0]

this.showModal(error)

return false

}

wx.showLoading({

title: ‘正在添加…’,

})

var cname = e.detail.value.cname

//插入数据

const db = wx.cloud.database();

const cont = db.collection(‘buhshops’);

cont.add({

data: {

cname: cname,

},

})

wx.hideLoading()

this.vailgps()

setTimeout(function () {

//返回上个页面

wx.redirectTo({

url: ‘/pages/bindex/bindex’,

})

},1500)

}

},

其中有其它字段我删掉了,大概就是这么一个简单的添加,问题无法重现,名称、价格、等其它表单在填写均一致的情况下,偶尔就出现某一个添加并未成功,就直接跳转到添加成功的页面了,数据库也查了并没有新增的那条数据,说明没有插入成功,请问这是怎么回事?问题无法重现,毫无规律性

3 回复

VM7512:1 [数据库] [新增记录] 失败: Error: errCode: -502001 database request fail | errMsg: [FailedOperation.Insert] multiple write errors: [{write 

errors: [{Can’t extract geo keys: 

{xxxx}

 can’t project geometry into spherical CRS: { latitude: 22.26666, longitude: 113.54342 

}}]}, {<nil>}]

追踪到了报错问题

地理位置字段结构有问题,贴出来看看?

1500太短。

回到顶部