def put(self, request, *args, **kwargs): """ 修改组件所在组 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 组件别名 required: true type: string paramType: path - name: group_id description: 组ID required: true type: integer paramType: form """ try: group_id = request.data.get("group_id", None) if group_id is None: return Response(general_message(400, "param error", "请指定修改的组"), status=400) group_id = int(group_id) if group_id == -1: group_service.delete_service_group_relation_by_service_id( self.service.service_id) else: code, msg, group = group_service.get_group_by_id( self.tenant, self.service.service_region, group_id) if code != 200: return Response( general_message(code, "group not found", "未找到需要修改的组信息")) group_service.update_or_create_service_group_relation( self.tenant, self.service, group_id) result = general_message(200, "success", "修改成功") except Exception as e: logger.exception(e) result = error_message(e.message) return Response(result, status=result["code"])
def put(self, request, *args, **kwargs): """ 修改组件所在组 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 组件别名 required: true type: string paramType: path - name: group_id description: 组ID required: true type: integer paramType: form """ # target app id group_id = request.data.get("group_id", None) if group_id is None: return Response(general_message(400, "param error", "请指定修改的组"), status=400) group_id = int(group_id) if group_id == -1: group_service.delete_service_group_relation_by_service_id( self.service.service_id) else: # check target app exists or not group_service.get_group_by_id(self.tenant, self.service.service_region, group_id) # update service relation group_service.update_or_create_service_group_relation( self.tenant, self.service, group_id) result = general_message(200, "success", "修改成功") return Response(result, status=result["code"])