Files
t/uniCloud-alipay/cloudfunctions/uni-cms-categories/index.obj.js
T
2025-03-12 20:11:03 +08:00

31 lines
506 B
JavaScript

const db = uniCloud.database();
module.exports = {
_before: function () { // 通用预处理器
},
async getTags() {
try {
const res = await db.collection("uni-cms-categories").get();
// console.log();
let tags = [];
for (let i = 0 ; i < res.data.length; i++ ) {
tags.push({
text: res.data[i].name,
value: res.data[i]._id
});
}
return {
"code": "200",
"tags": tags
};
} catch(e) {
return {
"code": '500',
"msg": e.message
}
}
}
}