up_comment.js 609 字节
Newer Older
study夏羽's avatar
study夏羽 已提交
1 2
// 开发文档:https://uniapp.dcloud.io/uniCloud/clientdb?id=action
const db = uniCloud.database()
3
const commentDb = db.collection('opendb-notice-comment')
study夏羽's avatar
study夏羽 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
module.exports = {
	before: async (state, event) => {
		if(state.auth.role.includes('USER')){
			let commentId = state.command.getParam({name:"doc",index:0})[0];
			let res = await commentDb.doc(commentId).update({state:0})
			console.log('action执行了更新当前编辑记录的state',res);
		}else{
			// console.log('是审核员');
		}
	},
	after: async (state, event, error, result) => {
		if (error) {
			throw error
		}
		return result
	}
}