WxApp/cloud/pay_success/index.js

25 lines
680 B
JavaScript
Raw 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.

// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
// 云函数入口函数
exports.main = async (event, context) => {
const returnCode = event.returnCode
const openid = event.userInfo.openid
const orderid = event.outTradeNo
const db = cloud.database();
if (returnCode == 'SUCCESS') {
//支付成功的处理逻辑
// await db.collection("orders").where({
// _id: orderid,
// _openid: openid,
// }).update({
// data: {
// pay_status: true
// }
// })
const res = { errCode: 0, errmag: "6666666办款完毕" }
return res
}
}