diff --git a/pages/cloudFunction/cloudFunction.vue b/pages/cloudFunction/cloudFunction.vue index 9e53a994295af41fb0dd37742f8474fd3d29df5c..f927c6f97bb3f83a615bd6245dc93549efdbbc7d 100644 --- a/pages/cloudFunction/cloudFunction.vue +++ b/pages/cloudFunction/cloudFunction.vue @@ -37,9 +37,8 @@ uniCloud.callFunction({ name: 'add', data: { - name: 'DCloud', - subType: 'uniCloud', - createTime: Date.now() + product: 'uniCloud', + create_time: Date.now() } }).then((res) => { uni.hideLoading() @@ -86,9 +85,8 @@ 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 b766a9d8526b7dbb8b16bd682864051c46205018..1e9458668ea827cdaa6a91d91e63ff13761f5253 100644 --- a/pages/cloudObject/cloudObject.vue +++ b/pages/cloudObject/cloudObject.vue @@ -50,9 +50,8 @@ title: '处理中...' }) cloudObjectDemo.add({ - name: 'DCloud', - subType: 'uniCloud', - createTime: Date.now() + product: 'uniCloud', + create_time: Date.now() }).then((res) => { console.log(res) uni.hideLoading() @@ -94,9 +93,8 @@ title: '处理中...' }) 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 420fee5addc9039413333f5595926c484c0c35a9..92ae480cd62de09aa890450977d56f4a8b30aa22 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)}`