Skip to content

Commit

Permalink
新增 自定义列
Browse files Browse the repository at this point in the history
  • Loading branch information
mouday committed Jul 22, 2023
1 parent a9537d3 commit 4eeed32
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
1 change: 1 addition & 0 deletions domain_admin/router/api_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
'/api/getDomainInfoGroupFilter': domain_info_api.get_domain_info_group_filter,
'/api/getSubDomainCert': domain_info_api.get_sub_domain_cert,
'/api/updateDomainICPOfUser': domain_info_api.update_all_domain_icp_of_user,
'/api/updateDomainRowICP': domain_info_api.update_domain_row_icp,

# prometheus
'/metrics': prometheus_api.metrics,
Expand Down
41 changes: 26 additions & 15 deletions domain_admin/service/domain_info_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,39 @@ def update_all_domain_icp_of_user(user_id):
)

for row in rows:
update_domain_row_icp(row)

res = None

try:
res = icp_util.get_icp(row.domain)
except Exception as e:
logger.debug(traceback.format_exc())
def update_domain_row_icp(row):
"""
更新icp信息
:param row:
:return:
"""
res = None

if not res:
continue
try:
res = icp_util.get_icp(row.domain)
except Exception as e:
logger.debug(traceback.format_exc())

data = {}
if not res:
return

if not row.icp_company:
data['icp_company'] = res.get('name')
data = {}

if not row.icp_licence:
data['icp_licence'] = res.get('icp')
if not row.icp_company:
data['icp_company'] = res.get('name')

DomainInfoModel.update(data).where(
DomainInfoModel.id == row.id
).execute()
if not row.icp_licence:
data['icp_licence'] = res.get('icp')

if len(data) == 0:
return

DomainInfoModel.update(data).where(
DomainInfoModel.id == row.id
).execute()


def update_all_domain_info():
Expand Down

0 comments on commit 4eeed32

Please sign in to comment.