'use strict';
const cloudbase = require("@cloudbase/node-sdk");
const rp = require('request-promise')
const app = cloudbase.init({
env: 'xxxxxx'
});
const db = app.database();
exports.main = async (event, context) => {
let access_token = await db
.collection('access_token')
.get()
const cat =
'https://api.weixin.qq.com/shop/cat/get?access_token=' + access_token.data[0].access_token
let catinfo = await rp({
url: cat,
method: 'POST',
body: {},
json:true
})
let expires_time = parseInt(Date.now() / 1000)
return catinfo
}
存数据库里,然后自己分页查询