index.js 429 B

12345678910111213
  1. 'use strict';
  2. exports.main = async (event, context) => {
  3. const secretType = context.secretType
  4. // secretType 是客户端调用 uniCloud.callFunction 传递的参数 secretType
  5. if (secretType !== 'both') {
  6. const error = new Error('客户端指定的secretType不为both,拒绝此次请求')
  7. error.code = 'INVALID_SECRET_TYPE'
  8. throw error // 拒绝本次请求
  9. }
  10. return {
  11. returnBy: 'encyption'
  12. }
  13. };