From a186291253e06e68d1535ede9efbba036ab7ce6e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 24 Dec 2025 17:23:40 +0800 Subject: [PATCH] bugfix --- wwwroot/pricing_item/update_pricing_item.dspy | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wwwroot/pricing_item/update_pricing_item.dspy b/wwwroot/pricing_item/update_pricing_item.dspy index a9d5c41..4399d93 100644 --- a/wwwroot/pricing_item/update_pricing_item.dspy +++ b/wwwroot/pricing_item/update_pricing_item.dspy @@ -10,9 +10,18 @@ for k,v in ns.items(): db = DBPools() dbname = get_module_dbname('pricing') async with db.sqlorContext(dbname) as sor: - - r = await sor.U('pricing_item', ns) - debug('update success'); + ori = await sor.R('pricing_item', {'id': ns.id}) + ori_sv = {} + if ori.spec_value: + ori_sv = json.loads(ori.spec_value) + fs = await sor_get_spec_fields(sor, ns.id) + if len(fs): + new_sv = {k:ns[k] for k in fs} + if new_sv: + ori_sv.update(new_sv) + ns.spec_value = json.dumps(ori_sv, indent=4) + r = await sor.U('pricing_item', ns.copy()) + debug('update success, {ns=}'); return { "widgettype":"Message", "options":{ @@ -33,4 +42,4 @@ return { "timeout":3, "message":"failed" } -} \ No newline at end of file +}