This commit is contained in:
张成
2025-12-17 15:14:25 +08:00
parent 36433060f2
commit 9701c87241

View File

@@ -55,27 +55,21 @@ module.exports = {
return ctx.fail('配置键不能为空');
}
// 临时写死测试数据
const mockData = {
wx_num: 'test_wechat_123',
wx_img: '/uploads/wechat_qrcode.png'
};
// 如果只有一个配置键,返回单个配置值
if (keys.length === 1) {
const key = keys[0];
return ctx.success({
[key]: mockData[key] || ''
});
}
// 多个配置键,返回对象
const result = {};
keys.forEach(key => {
result[key] = mockData[key] || '';
const result = await sys_parameter.findAll({
where: {
key: {
[op.in]: keys
}
}
});
return ctx.success(result);
const tempData = {};
result.forEach(item => {
tempData[item.key] = item.value;
});
return ctx.success(tempData);
} catch (error) {
console.error('获取配置失败:', error);
return ctx.fail('获取配置失败: ' + error.message);