diff --git a/pages/cloudFunction/cloudFunction.vue b/pages/cloudFunction/cloudFunction.vue index 1b8b9aff4234333da29055a69702e6b414294afe..2b3babdf22dca60db95c6fe14da71d63a958bfc4 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 a9a755499a13873b925cc2b29f7c2a6cd862792a..6dfa02f8084efc6cc4f95e9fe58266a24531afca 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 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)}`