accounting/wwwroot/api/currency_update.dspy

13 lines
445 B
Plaintext

# 币种更新
ns = {}
for k in ('name', 'symbol', 'decimal_places', 'is_base', 'status'):
v = params_kw.get(k)
if v is not None:
ns[k] = v
ns['id'] = params_kw.get('id', '')
if not ns['id']:
return json.dumps({'success': False, 'message': 'id required'})
async with get_sor_context(request._run_ns, 'accounting') as sor:
await sor.U('currency', ns)
return json.dumps({'success': True, 'message': '币种已更新'})