// 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() const db = cloud.database() // 云函数入口函数 exports.main = async (event, context) => { const { OPENID } = cloud.getWXContext() const follow_check = await db.collection('follow') .where({ user_id: OPENID, pub_id: event.pub_id || '' }) .get() if (follow_check.data.length === 0) { return { errMsg: '社团组织不存在', status: 'ERR' } } const follow = await db.collection('follow') .where({ user_id: OPENID, pub_id: event.pub_id }) .remove() return { removed: follow.removed, status: 'OK' } }