From 40967ea9e9c7bb796205f0e750b8ec7609e5a927 Mon Sep 17 00:00:00 2001 From: jingrow Date: Wed, 30 Jul 2025 22:07:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E5=AE=9E=E4=BE=8B=E5=8F=AF=E5=8D=87=E7=BA=A7=E7=9A=84?= =?UTF-8?q?=E5=A5=97=E9=A4=90=E5=88=97=E8=A1=A8=E7=9A=84api=E7=AB=AF?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jcloud/api/aliyun_server_light.py | 21 +++++++++++++++++++ .../pagetype/jsite_server/jsite_server.json | 9 ++++++-- .../pagetype/jsite_server/jsite_server.py | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/jcloud/api/aliyun_server_light.py b/jcloud/api/aliyun_server_light.py index 1bf7fac..f62ddaa 100644 --- a/jcloud/api/aliyun_server_light.py +++ b/jcloud/api/aliyun_server_light.py @@ -399,6 +399,21 @@ class AliyunLightServerManager: jingrow.log_error("获取实例详细信息失败", f"获取实例详细信息时发生错误: {str(e)}") return {'success': False, 'error': str(e), 'message': '获取实例详细信息失败'} + def get_instance_upgrade_plans(self, instance_id, region_id='cn-shanghai'): + """获取指定实例可升级的套餐列表""" + client = self._get_client(region_id) + try: + request = swas__open20200601_models.ListInstancePlansModificationRequest( + region_id=region_id, + instance_id=instance_id + ) + runtime = util_models.RuntimeOptions() + response = client.list_instance_plans_modification_with_options(request, runtime) + return {'success': True, 'data': self._convert_response_to_dict(response.body), 'message': '获取可升级套餐列表成功'} + except Exception as e: + jingrow.log_error("获取可升级套餐列表失败", f"获取实例 {instance_id} 可升级套餐时发生错误: {str(e)}") + return {'success': False, 'error': str(e), 'message': '获取可升级套餐列表失败'} + # 全局管理器实例 _aliyun_manager = None @@ -734,6 +749,12 @@ def get_aliyun_instance_details(instance_ids, region_id='cn-shanghai'): manager = _get_manager() return manager.get_instance_details(instance_ids, region_id) +@jingrow.whitelist() +def get_aliyun_instance_upgrade_plans(instance_id, region_id='cn-shanghai'): + """获取指定实例可升级的套餐列表""" + manager = _get_manager() + return manager.get_instance_upgrade_plans(instance_id, region_id) + # 服务器订单和创建相关 diff --git a/jcloud/jcloud/pagetype/jsite_server/jsite_server.json b/jcloud/jcloud/pagetype/jsite_server/jsite_server.json index a652aa6..09d4da6 100644 --- a/jcloud/jcloud/pagetype/jsite_server/jsite_server.json +++ b/jcloud/jcloud/pagetype/jsite_server/jsite_server.json @@ -25,6 +25,7 @@ "bandwidth", "public_ip", "image_id", + "support_platform", "ssh_section", "ssh_user", "ssh_port", @@ -185,7 +186,6 @@ "read_only": 1 }, { - "default": "22", "fieldname": "password", "fieldtype": "Password", "label": "服务器密码" @@ -199,11 +199,16 @@ "fieldname": "plan_price", "fieldtype": "Int", "label": "套餐价格(元/月)" + }, + { + "fieldname": "support_platform", + "fieldtype": "Data", + "label": "支持平台" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2025-07-29 18:37:36.194789", + "modified": "2025-07-30 22:05:00.093363", "modified_by": "Administrator", "module": "Jcloud", "name": "Jsite Server", diff --git a/jcloud/jcloud/pagetype/jsite_server/jsite_server.py b/jcloud/jcloud/pagetype/jsite_server/jsite_server.py index bd2f01b..3543cc0 100644 --- a/jcloud/jcloud/pagetype/jsite_server/jsite_server.py +++ b/jcloud/jcloud/pagetype/jsite_server/jsite_server.py @@ -33,6 +33,7 @@ class JsiteServer(Document): ssh_port: DF.Int ssh_user: DF.Data | None status: DF.Literal["Pending", "Starting", "Running", "Stopping", "Stopped", "Resetting", "Upgrading", "Disabled"] + support_platform: DF.Data | None system: DF.Data | None team: DF.Link | None title: DF.Data | None