diff --git a/cloud-function/node-sdk/access-token.md b/cloud-function/node-sdk/access-token.md index 44f720cf..fc97ee21 100644 --- a/cloud-function/node-sdk/access-token.md +++ b/cloud-function/node-sdk/access-token.md @@ -12,19 +12,20 @@ ```javascript { - access_token: '2222', - expires_in: 111 + access_token: '13_9cUD6KTQb4qtASzoL_k1uDCWqjOGRfHieF3-aHBahJ5XGjsDAhaoQLf8DWk1lpfm3J76F0LI3E820dMSAkWwnzlq264qxca8M5xBXU7y4e1Ka5IrUMu8zzvei9BFzE4QmXL1yVxwmsp45VhtXTOfABATPK', + expires_in: 5400 } ``` ## 示例代码 ```javascript -exports.main = function (e, cb) { - BaaS.wxAccessToken(e.signkey).then(res => { +exports.main = function (event, callback) { + BaaS.wxAccessToken(event.signkey).then(res => { console.log(res) - cb(null, res) + callback(null, res) }).catch(e => { console.log(e) + callback(e) }) } ``` \ No newline at end of file diff --git a/cloud-function/node-sdk/censor.md b/cloud-function/node-sdk/censor.md index 1672b968..27708337 100644 --- a/cloud-function/node-sdk/censor.md +++ b/cloud-function/node-sdk/censor.md @@ -26,8 +26,8 @@ ### 示例代码 ```javascript -exports.main = async function (e, cb) { - cb(null, await BaaS.wxCensorImage('5b71568674f0e509bb5ecc30')) +exports.main = async function (event, callback) { + callback(null, await BaaS.wxCensorImage('5b71568674f0e509bb5ecc30')) } ``` {% endblock censorImageCode %} @@ -44,8 +44,8 @@ exports.main = async function (e, cb) { {% block censorTextCode %} ```javascript -exports.main = async function (e, cb) { - cb(null, await BaaS.wxCensorText('123')) +exports.main = async function (event, callback) { + callback(null, await BaaS.wxCensorText('123')) } ``` diff --git a/cloud-function/node-sdk/schema/query.md b/cloud-function/node-sdk/schema/query.md index 100b5c39..23128e37 100755 --- a/cloud-function/node-sdk/schema/query.md +++ b/cloud-function/node-sdk/schema/query.md @@ -329,6 +329,7 @@ let query = new BaaS.Query() Product.setQuery(query).count().then(num => { // success + console.log(num) // 10 }, err => { // err }) diff --git a/cloud-function/node-sdk/super-group.md b/cloud-function/node-sdk/super-group.md index 6c5f109f..ca6ebdc2 100644 --- a/cloud-function/node-sdk/super-group.md +++ b/cloud-function/node-sdk/super-group.md @@ -14,9 +14,9 @@ **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserSuperGroup() - cb(null, await g.create({name: 'aa2', children: [8]})) +exports.main = async function (event, callback) { + let userSuperGroup = new BaaS.UserSuperGroup() + callback(null, await userSuperGroup.create({name: 'aa2', children: [8]})) } ``` @@ -32,11 +32,16 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserSuperGroup() - cb(null, await g.get(11)) +exports.main = async function (event, callback) { + let userSuperGroup = new BaaS.UserSuperGroup() + callback(null, await userSuperGroup.get(11)) } ``` +**返回示例** + +```json +{"children": 1, "id": 16, "name": "a2222", "user_group": [{"id": 17, "name": "vvv"}]} +``` ## 修改组集 `userSuperGroup.get(superGroupID)` @@ -54,9 +59,9 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserSuperGroup() - cb(null, await g.update(16, {name: 'a2222', children: [17]})) +exports.main = async function (event, callback) { + let userSuperGroup = new BaaS.UserSuperGroup() + callback(null, await userSuperGroup.update(16, {name: 'a2222', children: [17]})) } ``` @@ -66,11 +71,16 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserSuperGroup() - cb(null, await g.getUserSuperGroupList()) +exports.main = async function (event, callback) { + let userSuperGroup = new BaaS.UserSuperGroup() + callback(null, await userSuperGroup.getUserSuperGroupList()) } ``` +**返回示例** + +```json +{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 2}, "objects": [{"children": 1, "id": 16, "name": "a2222", "user_group": [{"id": 17, "name": "vvv"}]}, {"children": 3, "id": 11, "name": "sup", "user_group": [{"id": 9, "name": "产品经理"}, {"id": 10, "name": "总经理"}, {"id": 13, "name": "测试"}]}]} +``` ## 删除组集 `userSuperGroup.delete([id,...])` @@ -84,8 +94,8 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserSuperGroup() - cb(null, await g.delete([15, 16])) +exports.main = async function (event, callback) { + let userSuperGroup = new BaaS.UserSuperGroup() + callback(null, await userSuperGroup.delete([15, 16])) } ``` \ No newline at end of file diff --git a/cloud-function/node-sdk/user-group.md b/cloud-function/node-sdk/user-group.md index c6d56ca5..872b3fa2 100644 --- a/cloud-function/node-sdk/user-group.md +++ b/cloud-function/node-sdk/user-group.md @@ -11,9 +11,9 @@ **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - cb(null, await g.get(123)) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + callback(null, await userGroup.get(123)) } ``` @@ -44,12 +44,16 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - cb(null, await g.offset(10).limit(20).getUserGroupList({parentID: '11'})) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + callback(null, await userGroup.offset(10).limit(20).getUserGroupList({parentID: '11'})) } ``` +**返回示例** +```json +{"meta": {"limit": 20, "next": null, "offset": 0, "previous": null, "total_count": 5}, "objects": [{"id": 17, "members": 0, "name": "vvv", "parent_id": 16, "super_group": {"id": 16, "name": "a2222"}}, {"id": 13, "members": 0, "name": "测试", "parent_id": 11, "super_group": {"id": 11, "name": "sup"}}, {"id": 10, "members": 19, "name": "总经理", "parent_id": 11, "super_group": {"id": 11, "name": "sup"}}, {"id": 9, "members": 2, "name": "产品经理", "parent_id": 11, "super_group": {"id": 11, "name": "sup"}}, {"id": 8, "members": 6, "name": "程序员", "parent_id": null, "super_group": {"id": null, "name": null}}]} +``` ## 创建用户组 `userGroup.create({name,parent})` @@ -63,10 +67,10 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - console.log(await g.create({name: '测试',parent:'11'})) - cb(null) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + console.log(await userGroup.create({name: '测试',parent:'11'})) + callback(null) } ``` @@ -82,10 +86,10 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - await g.update(12, {name: '888'}) - cb(null) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + await userGroup.update(12, {name: '888'}) + callback(null) } ``` @@ -100,10 +104,10 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - await g.delete([12, 13]) - cb(null) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + await userGroup.delete([12, 13]) + callback(null) } ``` @@ -119,10 +123,10 @@ exports.main = async function (e, cb) { **示例代码** ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - await g.addUserIntoGroup([1092612, 1092601], [8, 9]) - cb(null) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + await userGroup.addUserIntoGroup([1092612, 1092601], [8, 9]) + callback(null) } ``` @@ -137,9 +141,9 @@ exports.main = async function (e, cb) { | groups | integer Array | Y | 用户组 ID 数组| ```javascript -exports.main = async function (e, cb) { - let g = new BaaS.UserGroup() - await g.removeUserFromGroup([1092612], [8, 9]) - cb(null) +exports.main = async function (event, callback) { + let userGroup = new BaaS.UserGroup() + await userGroup.removeUserFromGroup([1092612], [8, 9]) + callback(null) } ``` \ No newline at end of file