let { openid } = this.data
var collectList = []
let {collectList0 } = this.data
let id = 'collect' + openid
let i = false
try{
wx.cloud.callFunction({
name: 'collection_get',
data: {
database: 'shici_collection',
page: 1,
num: 1,
condition: {
_id: id
}
},
}).then((res) => {
console.log("hhere")
console.log(res.result)
collectList = res.result.data[0].collectList,
this.setData({
collectList0: collectList
})
console.log(collectList0)
wx.hideLoading()
})
if(collectList0.length==0){
i = true
}
let ts = {
name: this.data.detail.name,
dynasty: this.data.detail.dynasty,
poet: this.data.detail.poet,
id: this.data.detail._id,
content: this.data.detail.content,
}
console.log(collectList)
collectList.unshift(ts)
wx.cloud.callFunction({
name: 'feihua_history_update',
data: {
database: 'shici_collection',
id: id,
data: {
collectList
},
},
success: function (res) {
console.log('我在这里代言')
console.log(res)
},
fail: console.error
})
}
catch(err){
console.log('error')
}