index.js 348 B

1234567891011121314151617
  1. const cloud = require('wx-server-sdk');
  2. cloud.init({
  3. env: cloud.DYNAMIC_CURRENT_ENV
  4. });
  5. // 获取openId云函数入口函数
  6. exports.main = async (event, context) => {
  7. // 获取基础信息
  8. const wxContext = cloud.getWXContext();
  9. return {
  10. openid: wxContext.OPENID,
  11. appid: wxContext.APPID,
  12. unionid: wxContext.UNIONID,
  13. };
  14. };