This commit is contained in:
yumoqing 2025-12-23 17:16:53 +08:00
parent d386373abb
commit d407b312cf

View File

@ -1,3 +1,4 @@
import json
from ahserver.serverenv import ServerEnv
from sqlor.dbpools import DBPools
from appPublic.log import debug, exception
@ -104,13 +105,13 @@ async def pricing_program_charging(sor, pricing_program_id, data):
for item in pp_items:
charge = item.copy()
spec = await get_specs(sor, charge.psid)
if spec.pricing_spec_mode == 'spec_name':
d = data.get(spec.spec_name)
if d == item.spec_value:
change[spec.count_name] = cnt
charge.amount = item.pricing_amount * cnt
charges.append(charge)
elif spec.pricing_spec_mode == 'spec_amount':
if spec.pricing_spec_mode == 'spec_amount':
if item.spec_value:
d = json.loads(item.spec_value)
for k,v in d.items():
if v != item['k']:
continue
cnt = data.get(spec.count_name, 1)
if charge.pricing_unit is None or charge.pricing_unit < 1:
charge.pricing_unit = 1