Files
2025-10-22 07:50:31 +08:00

26 lines
812 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
const vkPay = require("vk-uni-pay");
module.exports = {
/**
* 获取微信openid公众号版本
* @url pay/code2SessionWeixinH5 前端调用的url参数地址
* data 请求参数 说明
* @param {String} code 微信登录返回的code
* res 返回参数说明
* @param {Number} code 错误码0表示成功
* @param {String} msg 详细信息
* @param {String} openid 用户openid
* @param {String} unionid 用户unionid可以取到此值时返回
*/
main: async (event) => {
let { data = {} } = event;
let res = await vkPay.code2SessionWeixinH5(data);
if (res.code === 0) {
delete res.sessionKey; // 删除明文sessionKey
delete res.accessToken; // 删除明文accessToken
delete res.refreshToken; // 删除明文refreshToken
}
return res;
}
}