db.collection(‘yhxx’).where({
_openid: that.data.openid
}).count({
success: function (res) {
that.setData({
yhs: res.total
})
}
})
var jls = that.data.yhs;
if (jls > 0) {
db.collection(‘yhxx’)
.where({
_openid: that.data.openid
})
.get({
success: function (res) {
that.setData({
showview: res.data[0].rz
})
}
});
}
else {
db.collection(‘yhxx’).add({
data: {
xm: that.data.srxm,
rz: false
},
success: function (res) {
that.setData({
showview: false
})
}
});
}