async def enterprise_audit_info_add(ns={}): db = DBPools() async with db.sqlorContext('kboss') as sor: # 检查orgid是否存在 if ns.get('userid'): userid = ns.get('userid') else: userid = await get_user() user_list = await sor.R('users', {'id': userid}) if not user_list: return { 'status': False, 'msg': 'user not found' } orgid = user_list[0]['orgid'] ns_dic = { 'id': uuid(), 'orgid': orgid, 'account_type': ns.get('account_type'), 'company_name': ns.get('company_name'), 'license_number': ns.get('license_number'), 'license_original_img': ns.get('license_original_img'), 'license_copy_img': ns.get('license_copy_img'), 'office_address': ns.get('office_address'), 'registered_address': ns.get('registered_address'), 'contact_name': ns.get('contact_name'), 'telephone': ns.get('telephone'), 'mobile_phone': ns.get('mobile_phone'), 'email': ns.get('email'), 'audit_status': 'pending', # 默认待审 } try: await sor.C('enterprise_audit_info', ns_dic) return { 'status': True, 'msg': 'enterprise audit info created successfully' } except Exception as e: return { 'status': False, 'msg': 'Failed to create enterprise audit info, %s' % str(e) } ret = await enterprise_audit_info_add(params_kw) return ret