kboss/b/reseller/get_ipc_logo.dspy
2025-08-04 14:03:03 +08:00

177 lines
12 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

async def get_ipc_logo(ns={}):
"""
获取动态ipc logo
:param ns:
:return:
"""
url_link = ns.get('url_link') or ''
if '#' in url_link:
url_link = url_link[:url_link.index('#')]
reseller_table_id = ns.get('reseller_table_id')
db = DBPools()
async with db.sqlorContext('kboss') as sor:
try:
if reseller_table_id:
rs_info_li = await sor.R('reseller', {'id': reseller_table_id})
if rs_info_li:
rs_dic = {
'id': reseller_table_id,
'domain_name': rs_info_li[0]['domain_name'],
'license_number': rs_info_li[0]['license_number']
}
return {
'status': True,
'msg': '获取信息成功',
'data': rs_dic
}
else:
return {
'status': False,
'msg': '没有查询到域名信息'
}
# 拆分url获取域
# 判断是否是分销商后缀
new_url = url_link.split('//')[1].split('/')[0]
if '/domain/' in url_link:
if url_link.endswith('/'):
domain_url = url_link.split('/')[-2]
else:
domain_url = url_link.split('/')[-1]
else:
if new_url.find('?') > 0:
domain_url = new_url[:new_url.index('?')]
else:
domain_url = new_url
if '?domain_name=' in url_link:
domain_url = url_link.split('?domain_name=')[1]
# 如果是业主机构
if ('ncmatch' in domain_url or '9527' in domain_url or '8889' in domain_url or '8891' in domain_url or domain_url in ['xterm.kaiyuancloud.cn','www.kaiyuancloud.cn', 'dev.kaiyuancloud.cn', 'dev.opencomputing.cn', 'test.kaiyuancloud.cn', 'localhost']) and '/domain/' not in url_link:
yezhu_info = (await sor.R('organization', {'org_type': '0'}))[0]
domain_res = (await sor.R('params', {'pname': '业主机构域名'}))[0]['pvalue']
# yezhu = {
# 'orgname': yezhu_info['orgname'],
# 'address': yezhu_info['address'],
# 'main_business': yezhu_info['main_business'],
# 'logo': '业主机构logo',
# 'license_number': '京ICP备2022001945号-1',
# 'domain_name': domain_res
# }
# [{'name': '地址', 'value': '北京市朝阳区农展馆南路13号瑞辰国际'},{'name': '电话', 'value': '400-6150805 010-65917875'},{'name': '邮箱', 'value': 'Open-computing@kaiyuancloud.cn'},{'name': 'IPC备案号', 'value': '京ICP备2022001945号-2'},{'name': '版权所有', 'value': '@kaiyuanyun 2023'},{'name': '京公网安备', 'value': '11010502054007'},{'name': '经营许可证', 'value': '京B2-20232313'}]
yezhu = json.loads(domain_res.replace("'", '"')) if not isinstance(domain_res, dict) else domain_res
yezhu['domain_name'] = domain_url
if 'ncmatch' in domain_url or '9527' in domain_url or 'opencomputing' in domain_url:
yezhu['logo'] = "https://www.kaiyuancloud.cn/idfile?path=logo_ncmatch.png"
yezhu['additional_msg'] = {
"home": {
"logoImg": "https://www.kaiyuancloud.cn/idfile?path=logo_ncmatch.png",
"bannerTitle": "开元数智",
"adress": "北京市石景山区和平西路60号院1号楼11层1101-30",
"footerTitle": "开元数智(北京)科技有限公司",
'qrCode': 'https://www.kaiyuancloud.cn/idfile?path=firstpagehot/ncmatch_inquiry.jpg',
'footer_info': '京ICP备2022001945号-4 开元数智(北京)科技有限公司 版权所有 @kaiyuanyun 2023',
"copyright": "@kaiyuanyun 2023",
"domain_name": "ncmatch.cn",
"email": "Open-computing@kaiyuancloud.cn",
"license": "2022001945号-4",
"logo": "https://www.kaiyuancloud.cn/idfile?path=logo_ncmatch.png",
"mobile": "400-6150805 010-65917875",
"publicsecurity": "11010502054007",
"businesslicense": "京B2-20232313"
},
"about": {
"title": "开元数智",
"logo": "https://www.kaiyuancloud.cn/idfile?path=logo_ncmatch.png",
"content": [
"开元数智北京科技有限公司以下简称“开元数智”创立于2022年总部位于北京中关村科技园区现已形成以上海、南京、深圳、济南为区域枢纽的全国性服务网络。作为新型数字基础设施建设领域的创新企业公司主营业务涵盖智能算力中心规划建设与运营、算力网络体系构建、企业级AI算力服务及大模型应用整体解决方案。",
"公司自主研发的NCMatch智能算力公共服务平台作为行业领先的一站式人工智能算力服务解决方案已构建云网算数智“五位一体”的服务体系。该平台深度整合算力资源调度系统、智能算法模型库及行业应用矩阵为高等院校、科研院所、政企机构及人工智能开发企业提供专业级算力云服务全面覆盖基础算力供给、大模型训练调优及产业智能化升级等多维度需求。",
"开元数智作为国家算力网络建设的重要参与单位,已获得工信部、教育部等部委直属机构指导,并与中关村数智人工智能产业联盟、国家超级计算中心、南京未来网络研究院等权威机构建立战略合作关系。公司深度参与全国超算互联网及全国一体化算力网国家级重点工程,在算力基础设施建设领域具备成熟的技术积累和项目实施经验。",
"开元数智北京科技有限公司合作的客户有中国联通、中国电信、中国移动、未来网络、中信网络、国家超级计算济南中心、华为、阿里云、百度智能云、腾讯云、火山、智谱·AI、衔远科技、创新工场、竹间智能、深言科技、澜舟科技、商汤科技、MINMAX、云从科技、第四范式、深度求索、百川智能、Moonshot AI、昆仑万维、深蓝等。",
]
}
}
elif 'kaiyuancloud' in domain_url or 'opencomputing' in domain_url or 'localhost' in domain_url:
yezhu['additional_msg'] = {
"home": {
"logoImg": "https://www.kaiyuancloud.cn/idfile?path=logo.png",
"bannerTitle": "开元云",
"adress": "北京市朝阳区东三环中路65号富力中心",
"footerTitle": "开元云(北京)科技有限公司",
'qrCode': 'https://www.kaiyuancloud.cn/idfile?path=firstpagehot/kaiyuancloud_inquiry.png',
'footer_info': '京公网安备11010502054007号 开元云(北京)科技有限公司 版权所有 @kaiyuanyun 2023',
"copyright": "@kaiyuanyun 2023",
"domain_name": "ncmatch.cn",
"email": "Open-computing@kaiyuancloud.cn",
"license": "2022001945号-1",
"logo": "https://www.kaiyuancloud.cn/idfile?path=logo_ncmatch.png",
"mobile": "400-6150805 010-65917875",
"publicsecurity": "11010502054007",
"businesslicense": "京B2-20232313"
},
"about": {
"title": "开元云",
"logo": "https://www.kaiyuancloud.cn/idfile?path=firstpagebg/kaiyuan_about.jpg",
"content": [
'开元云科技Open Computing.ai以"让AI无处不在让智能如此简单"为使命通过融合技术赋能千行百业致力于成为全球领先的人工智能服务运营商。公司聚焦教育科研、金融风控、轨道交通、生物医药、医疗诊断等战略应用场景构建全栈AI解决方案推动产业智能化升级。',
'作为国家级高新技术企业、创新型中小企业和ISO9001/27001双认证单位以"卓越、开放、创新"为核心价值观与北京大学科创园、中关村NCMatch 、浪潮云洲、百度智能云、阿里云等顶尖机构建立深度合作。依托自主研发的OCAI 公共服务平台实现AI模型服务与商业价值的双重突破。',
"开元云提供AI基础设施包括通用云计算、超算、智算服务解决从计算、存储、数据库、网络、模拟、训练、推理等AI需要的整体底层技术架构和系统支持。 在模型服务方面为企业和个人用户提供引领性解决方案为期未来打造核心竞争力提供支撑包括AI+行业垂类模型服务、AI Agent智能体应用服务。",
"开元云将持续深耕垂直领域AI场景化落地通过技术开源与生态共建加速实现战略愿景成为全球领先的人工智能服务运营商。"
]
}
}
return {
'status': True,
'msg': '查找信息成功',
'data': [yezhu]
}
# 查找对应的url
if '.' in domain_url:
reseller_info_li = await sor.R('reseller', {'domain_name': domain_url, 'del_flg': '0'})
domain_name = domain_url
else:
reseller_info_li = await sor.R('reseller', {'orgid': domain_url, 'del_flg': '0'})
domain_name = domain_url
domain_url = new_url
if 'www.kaiyuancloud.cn' in url_link:
domain_url = 'www.kaiyuancloud.cn'
if 'www.kaiyuancloud.cn/dev' in url_link:
domain_url = 'www.kaiyuancloud.cn/dev'
if reseller_info_li:
# 通过 "." 判断是纯域名还是后缀
if '/domain/' in url_link:
domain_url = new_url
reseller_info = reseller_info_li[0]
# 匹配到对应链接 就去机构表中找机构名称和地址
reseller_orgid = reseller_info_li[0]['orgid']
org_info_li = await sor.R('organization', {'id': reseller_orgid})
reseller_info['orgname'] = org_info_li[0]['orgname']
reseller_info['address'] = org_info_li[0]['address']
license_image_url = 'https://' + domain_url + '/idfile?path=' + reseller_info['license']
reseller_info['license'] = license_image_url
logo_image_url = 'https://' + domain_url + '/idfile?path=' + reseller_info['logo']
reseller_info['logo'] = logo_image_url
reseller_info['domain_name'] = domain_name
reseller_info['main_business'] = org_info_li[0]['main_business']
return {
'status': True,
'msg': '查找信息成功',
'data': [reseller_info]
}
else:
return {
'status': False,
'msg': '没有找到对应的域名信息'
}
except Exception as e:
raise e
return {
"status": False,
"message": "域名信息查找失败"
}
ret = await get_ipc_logo(params_kw)
return ret