ns = params_kw.copy() for k,v in list(ns.items()): if v == 'NaN' or v == 'null' or v == '' or v is None: if k != 'id': del ns[k] else: ns[k] = None if v in ('NaN', 'null') else v db = DBPools() dbname = get_module_dbname('pipeline_bidding') async with db.sqlorContext(dbname) as sor: tblfields = json.loads('[{"name": "id", "title": "主键ID", "type": "str", "length": 32, "nullable": "no"}, {"name": "project_id", "title": "项目ID", "type": "str", "length": 32, "nullable": "no"}, {"name": "qual_name", "title": "资质名称", "type": "str", "length": 255, "nullable": "no"}, {"name": "requirement", "title": "资质要求原文", "type": "text"}, {"name": "is_mandatory", "title": "是否必需", "type": "str", "length": 1, "nullable": "no", "default": "1"}, {"name": "owner", "title": "提供方", "type": "str", "length": 16, "nullable": "no", "default": "kb"}, {"name": "kb_doc_id", "title": "知识库文档ID", "type": "str", "length": 32}, {"name": "match_status", "title": "匹配状态", "type": "str", "length": 16, "nullable": "no", "default": "pending"}, {"name": "file_path", "title": "文档路径", "type": "str", "length": 500}, {"name": "note", "title": "说明", "type": "str", "length": 500}, {"name": "human_task_id", "title": "人类任务ID", "type": "str", "length": 32}, {"name": "created_at", "title": "创建时间", "type": "timestamp", "nullable": "no"}, {"name": "updated_at", "title": "更新时间", "type": "timestamp"}]') tblfname = [ f['name'] for f in tblfields ] other_keys = [ k for k in ns.keys() if k in tblfname and k != 'id' ] if len(other_keys) > 0: r = await sor.U('bid_qualifications', ns) debug('update success'); return { "widgettype":"Message", "options":{ "title":"Update Success", "cwidth":16, "cheight":9, "timeout":3, "message":"ok" } } return { "widgettype":"Error", "options":{ "title":"Update Error", "cwidth":16, "cheight":9, "timeout":3, "message":"failed" } }