From 6f2b7af41829629d335be281d7630753ea541cbb Mon Sep 17 00:00:00 2001 From: linju Date: Mon, 23 Oct 2023 16:24:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20unicloud-test=E8=A1=A8?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=93=8D=E4=BD=9C=E7=9A=84=E8=A1=A8=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/cloudFunction/cloudFunction.vue | 10 ++++------ pages/cloudObject/cloudObject.vue | 10 ++++------ .../cloudfunctions/cloud-object-demo/index.obj.js | 10 +++++----- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/pages/cloudFunction/cloudFunction.vue b/pages/cloudFunction/cloudFunction.vue index 1b8b9af..2b3babd 100644 --- a/pages/cloudFunction/cloudFunction.vue +++ b/pages/cloudFunction/cloudFunction.vue @@ -31,9 +31,8 @@ return await uniCloud.callFunction({ name: 'add', data: { - name: 'DCloud', - subType: 'uniCloud', - createTime: Date.now() + product: 'uniCloud', + create_time: Date.now() } }).then((res) => { uni.hideLoading() @@ -84,9 +83,8 @@ return await uniCloud.callFunction({ name: 'update', data: { - name: 'DCloud', - subType: 'html 5+', - createTime: Date.now() + product: 'uni-app', + create_time: Date.now() } }).then((res) => { uni.hideLoading() diff --git a/pages/cloudObject/cloudObject.vue b/pages/cloudObject/cloudObject.vue index a9a7554..6dfa02f 100644 --- a/pages/cloudObject/cloudObject.vue +++ b/pages/cloudObject/cloudObject.vue @@ -44,9 +44,8 @@ title: '处理中...' }) return await cloudObjectDemo.add({ - name: 'DCloud', - subType: 'uniCloud', - createTime: Date.now() + product: 'uniCloud', + create_time: Date.now() }).then((res) => { console.log(res) uni.hideLoading() @@ -92,9 +91,8 @@ title: '处理中...' }) return await cloudObjectDemo.update({ - name: 'DCloud', - subType: 'html 5+', - createTime: Date.now() + product: 'uni-app', + create_time: Date.now() }).then((res) => { uni.hideLoading() uni.showModal({ diff --git a/uniCloud-aliyun/cloudfunctions/cloud-object-demo/index.obj.js b/uniCloud-aliyun/cloudfunctions/cloud-object-demo/index.obj.js index 420fee5..92ae480 100644 --- a/uniCloud-aliyun/cloudfunctions/cloud-object-demo/index.obj.js +++ b/uniCloud-aliyun/cloudfunctions/cloud-object-demo/index.obj.js @@ -1,8 +1,8 @@ const db = uniCloud.database(); const testCollection = db.collection('unicloud-test') module.exports = { - async add({ name, subType, createTime }) { - let res = await testCollection.add({ name, subType, createTime }) + async add({product, create_time }) { + let res = await testCollection.add({product, create_time }) return res }, async remove() { @@ -26,7 +26,7 @@ module.exports = { } } }, - async update({name,subType,createTime}) { + async update({product,create_time}) { const docList = await testCollection.limit(1).get(); if (!docList.data || docList.data.length === 0) { return { @@ -34,11 +34,11 @@ module.exports = { msg: '集合unicloud-test内没有数据' } } - const res = await testCollection.doc(docList.data[0]._id).update({name,subType,createTime}); + const res = await testCollection.doc(docList.data[0]._id).update({product,create_time}); if (res.updated === 1) { let result = Object.assign({}, { _id: docList.data[0]._id - }, {name,subType,createTime}) + }, {product,create_time}) return { status: 0, msg: `集合第一条数据由${JSON.stringify(docList.data[0])}修改为${JSON.stringify(result)}` -- GitLab