1
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user