'use strict';
const {
	getUserId
} = require('user-common')
exports.main = async (event, context) => {
	//event为客户端上传的参数
	const user_id = await getUserId(event.token)
	const collection = uniCloud.database().collection("user_watermark").field({
		'_id': false
	})
	let res = await collection.where({
		user_id: user_id,
		system_id: event.system_id
	}).get()
	if (!res.data || res.data.length <= 0) { // 用户没有 获取模板
		res = await collection.where({
			system_id: event.system_id
		}).get()
	}
	return res.data[0]
};
