config = getConfig('.') DBPools(config.databases) dbname = get_module_dbname('cms') async with db.sqlorContext(dbname) as sor: data = {'id': params_kw.get('id', '')} if not data['id']: return {'widgettype': 'Message', 'options': {'text': '缺少ID', 'messagetype': 'error'}} for field in ['org_id', 'source', 'name', 'company', 'phone', 'email', 'industry', 'region', 'interest_products', 'message', 'status', 'assigned_to', 'notes']: v = params_kw.get(field, None) if v is not None: data[field] = v await sor.U('cms_leads', data) return {'widgettype': 'Message', 'options': {'text': '更新成功', 'messagetype': 'success'}}