1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| const cloud = require('wx-server-sdk') const BASE62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' const base62 = require('base-x')(BASE62)
cloud.init()
exports.main = async (event, context) => { const wxContext = cloud.getWXContext()
const { args } = event
try { result = await cloud.openapi.wxacode.getUnlimited({ scene: args, page: 'pages/album/byuser' }) console.log(result)
const cloudPath = base62.encode(Buffer.from(args, 'utf8')) console.log(args, cloudPath)
let fileId = await cloud.uploadFile({ cloudPath: cloudPath, fileContent: result.buffer, })
result.fileId = fileId return result } catch (err) { console.log(err) return err } }
|