1
This commit is contained in:
@@ -374,6 +374,7 @@ module.exports = {
|
|||||||
const body = ctx.getBody();
|
const body = ctx.getBody();
|
||||||
const { sn_code, deliver_config } = body;
|
const { sn_code, deliver_config } = body;
|
||||||
|
|
||||||
|
|
||||||
if (!sn_code) {
|
if (!sn_code) {
|
||||||
return ctx.fail('请提供设备SN码');
|
return ctx.fail('请提供设备SN码');
|
||||||
}
|
}
|
||||||
@@ -399,9 +400,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 更新 pla_account 表的 deliver_config 和 auto_deliver 字段
|
// 更新 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(
|
await pla_account.update(
|
||||||
{
|
{
|
||||||
deliver_config: deliver_config,
|
deliver_config: new_deliver_config,
|
||||||
auto_deliver: deliver_config.auto_delivery ? 1 : 0
|
auto_deliver: deliver_config.auto_delivery ? 1 : 0
|
||||||
},
|
},
|
||||||
{ where: { id: user.id } }
|
{ where: { id: user.id } }
|
||||||
|
|||||||
Reference in New Issue
Block a user