index.js 407 字节
Newer Older
d-u-a's avatar
d-u-a 已提交
1 2 3 4 5 6 7 8 9
'use strict';

exports.main = async (event, context) => {
  //event为客户端上传的参数
  console.log('event : ', event)

  const secretType = context.secretType
  // secretType 是客户端调用 uniCloud.callFunction 传递的参数 secretType

study夏羽's avatar
study夏羽 已提交
10
  if (secretType !== 'both') {
d-u-a's avatar
d-u-a 已提交
11 12 13 14 15 16
    throw new Error('secretType invalid') // 拒绝返回有效数据
  }

  //返回数据给客户端
  return event
};