feat: 报名逻辑
This commit is contained in:
6
cloudfunctions/getOpenid/config.json
Normal file
6
cloudfunctions/getOpenid/config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"permissions": {
|
||||
"openapi": [
|
||||
]
|
||||
}
|
||||
}
|
||||
18
cloudfunctions/getOpenid/index.js
Normal file
18
cloudfunctions/getOpenid/index.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// 云函数入口文件
|
||||
const cloud = require("wx-server-sdk");
|
||||
|
||||
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }); // 使用当前云环境
|
||||
|
||||
// 云函数入口函数
|
||||
exports.main = async (event, context) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const wxContext = cloud.getWXContext();
|
||||
|
||||
resolve({
|
||||
event,
|
||||
openid: wxContext.OPENID,
|
||||
appid: wxContext.APPID,
|
||||
unionid: wxContext.UNIONID,
|
||||
});
|
||||
});
|
||||
};
|
||||
14
cloudfunctions/getOpenid/package.json
Normal file
14
cloudfunctions/getOpenid/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "getOpenid",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wx-server-sdk": "~2.6.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user