This commit is contained in:
张成
2025-12-24 21:27:37 +08:00
parent c0bedfa4aa
commit 83d4b6b536

View File

@@ -374,6 +374,7 @@ module.exports = {
const body = ctx.getBody();
const { sn_code, deliver_config } = body;
if (!sn_code) {
return ctx.fail('请提供设备SN码');
}
@@ -399,9 +400,14 @@ module.exports = {
}
// 更新 pla_account 表的 deliver_config 和 auto_deliver 字段
// 查出来合并原来的字段,如何没传就不覆盖
const original_deliver_config = user.deliver_config || {};
const new_deliver_config = { ...original_deliver_config, ...deliver_config };
await pla_account.update(
{
deliver_config: deliver_config,
deliver_config: new_deliver_config,
auto_deliver: deliver_config.auto_delivery ? 1 : 0
},
{ where: { id: user.id } }