34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
async def update_kyy_supply(ns={}):
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
try:
|
|
ns_dic = {
|
|
'id': ns['id'],
|
|
'basic_info': json.dumps(ns.get('basic_info')) if not isinstance(ns.get('basic_info'),
|
|
str) else ns.get('basic_info'),
|
|
'remark': ns.get('remark')
|
|
}
|
|
update_sql = """
|
|
update kyy_supply set basic_info = '%s', remark = '%s' where id = '%s';
|
|
""" % (ns_dic['basic_info'], ns_dic['remark'], ns_dic['id'])
|
|
await sor.sqlExe(update_sql, {})
|
|
rc_sql = """ SELECT ROW_COUNT() as rc; """
|
|
rc_res = await sor.sqlExe(rc_sql, {})
|
|
if rc_res[0]['rc'] > 0:
|
|
msg = "数据库有更新"
|
|
else:
|
|
msg = '但是数据库没有更新'
|
|
return {
|
|
'status': True,
|
|
'msg': '更新命令执行成功, %s, id: %s' % (msg, ns_dic)
|
|
}
|
|
except Exception as e:
|
|
await sor.rollback()
|
|
return {
|
|
'status': False,
|
|
'msg': '文档更新失败, %s' % str(e)
|
|
}
|
|
|
|
|
|
ret = await update_kyy_supply(params_kw)
|
|
return ret |