kboss/b/invoice/update_user_invoice.dspy
2025-07-16 14:27:17 +08:00

36 lines
1.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async def update_user_invoice(ns={}):
"""
保存用户发票信息
:param ns:
:return:
"""
data = {}
try:
data['id'] = ns['id']
data['orgid'] = ns['orgid']
data['user_id'] = ns['user_id']
data['client_id'] = ns['client_id']
# `title_type` int(1) DEFAULT NULL COMMENT '抬头类型1个人2公司3组织',
data['title_type'] = ns['title_type']
data['contract_number'] = ns['contract_number']
if data['title_type'] != 1:
ns.pop('invoice_type')
ns.pop('invoice_title')
ns.pop('tax_no')
ns['del_flg'] = 0
except Exception as e:
return {"status": False, "msg": f"get key error, please check key:{str(e)}"}
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
await sor.U('invoice_info', ns)
return {"status": True, "msg": "ok"}
except Exception as e:
info(f"update_user_invoice sql error:{e}")
return {"status": False, "msg": "sql error"}
ret = await update_user_invoice(params_kw)
return ret