Unverified Commit 4480f8e1 authored by barnettZQG's avatar barnettZQG Committed by GitHub
Browse files

Merge pull request #42 from 27-1/V5.0

[FIX] fix upgrade domain bug
parents a82d3079 c3dffd83
No related merge requests found
Showing with 29 additions and 22 deletions
+29 -22
......@@ -388,19 +388,23 @@ class HttpStrategyView(RegionTenantHeaderView):
domain = domain_repo.get_service_domain_by_http_rule_id(http_rule_id)
if domain:
bean = domain.to_dict()
service = service_repo.get_service_by_service_id(domain.service_id)
service_alias = service.service_cname if service else ''
group_name = ''
g_id = 0
if service:
gsr = group_service_relation_repo.get_group_by_service_id(service.service_id)
if gsr:
group = group_repo.get_group_by_id(int(gsr.group_id))
group_name = group.group_name if group else ''
g_id = int(gsr.group_id)
if domain.certificate_id:
certificate_info = domain_repo.get_certificate_by_pk(int(domain.certificate_id))
service = service_repo.get_service_by_service_id(domain.service_id)
service_alias = service.service_cname if service else ''
group_name = ''
if service:
gsr = group_service_relation_repo.get_group_by_service_id(service.service_id)
if gsr:
group = group_repo.get_group_by_id(int(gsr.group_id))
group_name = group.group_name if group else ''
bean.update({"certificate_name": certificate_info.alias})
bean.update({"service_alias": service_alias})
bean.update({"group_name": group_name})
bean.update({"service_alias": service_alias})
bean.update({"group_name": group_name})
bean.update({"g_id": g_id})
else:
bean = dict()
result = general_message(200, "success", "查询成功", bean=bean)
......@@ -851,13 +855,16 @@ class ServiceTcpDomainView(RegionTenantHeaderView):
service = service_repo.get_service_by_service_id(tcpdomain.service_id)
service_alias = service.service_cname if service else ''
group_name = ''
g_id = 0
if service:
gsr = group_service_relation_repo.get_group_by_service_id(service.service_id)
if gsr:
group = group_repo.get_group_by_id(int(gsr.group_id))
group_name = group.group_name if group else ''
g_id = int(gsr.group_id)
bean.update({"service_alias": service_alias})
bean.update({"group_name": group_name})
bean.update({"g_id": g_id})
result = general_message(200, "success", "查询成功", bean=bean)
else:
bean = dict()
......
......@@ -180,9 +180,9 @@ class GroupServiceView(RegionTenantHeaderView):
team_id = self.team.tenant_id
group_count = group_repo.get_group_count_by_team_id_and_group_id(team_id=team_id, group_id=group_id)
if group_count == 0:
code = 400
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!")
return Response(result, status=502)
code = 202
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!", bean={})
return Response(result, status=200)
group_service_list = service_repo.get_group_service_by_group_id(group_id=group_id,
region_name=self.response_region,
team_id=self.team.tenant_id,
......
......@@ -74,9 +74,9 @@ class ServiceShareRecordView(RegionTenantHeaderView):
team_id = self.team.tenant_id
group_count = group_repo.get_group_count_by_team_id_and_group_id(team_id=team_id, group_id=group_id)
if group_count == 0:
code = 400
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!")
return Response(result, status=code)
code = 202
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!", bean={})
return Response(result, status=200)
# 判断是否满足分享条件
data = share_service.check_service_source(
team=self.team,
......
......@@ -102,9 +102,9 @@ class TopologicalGraphView(ToplogicalBaseView):
team_id = self.team.tenant_id
group_count = group_repo.get_group_count_by_team_id_and_group_id(team_id=team_id, group_id=group_id)
if group_count == 0:
code = 400
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!")
return Response(result, status=502)
code = 202
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!", bean={})
return Response(result, status=200)
topological_info = topological_service.get_group_topological_graph(group_id=group_id,
region=self.response_region,
team_name=self.team_name,
......@@ -183,9 +183,9 @@ class TopologicalInternetView(ToplogicalBaseView):
team_id = self.team.tenant_id
group_count = group_repo.get_group_count_by_team_id_and_group_id(team_id=team_id, group_id=group_id)
if group_count == 0:
code = 400
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!")
return Response(result, status=502)
code = 202
result = general_message(code, "group is not yours!", "当前组已删除或您无权限查看!", bean={"json_svg": {}, "json_data": {}})
return Response(result, status=200)
else:
data = topological_service.get_internet_topological_graph(group_id=group_id, team_name=team_name)
result = general_message(code, "Obtain topology internet success.", "获取拓扑图Internet成功", bean=data)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment