accounting/wwwroot/api/exchange_rate_update.dspy

14 lines
514 B
Plaintext

# 汇率更新
ns = {}
for k in ('from_currency', 'to_currency', 'buy_rate', 'sell_rate', 'mid_rate', 'effective_date'):
v = params_kw.get(k)
if v is not None:
ns[k] = v
ns['id'] = params_kw.get('id', '')
ns['updated_at'] = timestampstr()
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('exchange_rate', ns)
return json.dumps({'success': True, 'message': '汇率已更新'})