云对象代码:
const {
success,
fail
} = require('../../common.js')
module.exports = async function() {
// 获取JQL database引用,此处需要传入云对象的clientInfo,getCount需要额外的数据库api
const dbJQL = uniCloud.databaseForJQL({
clientInfo: this.getClientInfo()
})
const collection = dbJQL.collection('news')
const uid = this.body.id
const result1 = await collection.doc(uid).get()
if (result1 && result1.data.length === 0) {
fail('未找到该条数据')
}
try {
const res = await collection.doc(uid).update({
title: this.body.title,
content: this.body.content,
cover_id: this.body.cover_id,
type_id: this.body.type_id,
published: this.body.published,
update_date: new Date().getTime()
})
return success(res)
} catch (e) {
throw fail('服务器数据错误')
}
}
l***@163.com (作者)
是的,但是没有地方跨域啊,这里的图片是从网络上copy过来的图片数据,并没有url
2023-05-16 10:17
piaoyi_UI
回复 l***@163.com: 400可能是请求体太大了,看能不能设置后端那个限制大一点
2023-05-16 10:21
l***@163.com (作者)
回复 piaoyi_UI: 我用的uniCloud 自带的数据库。在哪里能设置大小呢?
2023-05-16 10:27
piaoyi_UI
回复 l***@163.com: 不是数据库问题
2023-05-16 10:29
l***@163.com (作者)
回复 piaoyi_UI: 应该是请求体太大了,我们以前做过的项目,也是这样做的,但是后端不知道咋弄的,就没有问题。uniCloud就限制死了
2023-05-16 10:53