41 lines
1.2 KiB
Plaintext
41 lines
1.2 KiB
Plaintext
async def update_user_inquiry(ns={}):
|
|
db = DBPools()
|
|
async with db.sqlorContext('kboss') as sor:
|
|
ids = ns.get('ids') or ns.get('id')
|
|
if not ids:
|
|
return {
|
|
'status': False,
|
|
'msg': '请传递id'
|
|
}
|
|
if isinstance(ids, str):
|
|
if ids.startswith('['):
|
|
ids = json.loads(ids)
|
|
elif ',' in ids:
|
|
ids = ids.replace('"', '').replace("'", '').split(',')
|
|
else:
|
|
ids = [ids]
|
|
|
|
update_count = 0
|
|
for inquiry_id in ids:
|
|
if not inquiry_id:
|
|
continue
|
|
ns_c = {
|
|
'id': inquiry_id
|
|
}
|
|
if 'feedback' in ns:
|
|
ns_c['feedback'] = ns.get('feedback')
|
|
if 'remark' in ns:
|
|
ns_c['remark'] = ns.get('remark')
|
|
await sor.U('product_inquiry', ns_c)
|
|
update_count += 1
|
|
|
|
return {
|
|
'status': True,
|
|
'msg': 'update success',
|
|
'data': {
|
|
'update_count': update_count
|
|
}
|
|
}
|
|
|
|
ret = await update_user_inquiry(params_kw)
|
|
return ret |