reallife_asset/wwwroot/api/rl_org_group_update.dspy

21 lines
823 B
Plaintext

id = params_kw.get('id', '')
if not id:
return {"widgettype":"Error","options":{"title":"更新失败","message":"id required","cwidth":16,"cheight":9,"timeout":3}}
db = DBPools()
dbname = get_module_dbname('reallife_asset')
async with db.sqlorContext(dbname) as sor:
recs = await sor.R("rl_org_group", {"id": id})
if not recs:
return {"widgettype":"Error","options":{"title":"更新失败","message":"Not found","cwidth":16,"cheight":9,"timeout":3}}
upd = {}
for k in ['status', 'vendor_group_id', 'local_group_id', 'vendor']:
if params_kw.get(k):
upd[k] = params_kw.get(k)
async with db.sqlorContext(dbname) as sor:
await sor.U("rl_org_group", {**upd, "id": id})
return {"widgettype":"Message","options":{"title":"更新成功","message":"ok","cwidth":16,"cheight":9,"timeout":3}}