修复付款成功后创建云服务器失败的问题

This commit is contained in:
jingrow 2025-07-27 23:30:51 +08:00
parent e9f327af93
commit 27060bfe67
3 changed files with 7 additions and 7 deletions

View File

@ -471,10 +471,12 @@ def create_server_async(order_name):
if not result or not result.get('success'):
raise Exception(f"阿里云创建失败: {result.get('message', '未知错误')}")
instance_id = result['data']['instance_id']
# 阿里云API返回的是instance_ids数组取第一个实例ID
instance_id = result['data']['instance_ids'][0]
# 更新服务器记录状态
server.status = "Active"
server.running_status = "运行中"
server.instance_id = instance_id
server.save(ignore_permissions=True)

View File

@ -117,7 +117,6 @@
"read_only": 1
},
{
"collapsible": 1,
"fieldname": "server_section",
"fieldtype": "Section Break",
"label": "服务器信息"
@ -158,9 +157,10 @@
{
"fetch_from": "virtual_machine.public_ip_address",
"fieldname": "running_status",
"fieldtype": "Data",
"fieldtype": "Select",
"in_list_view": 1,
"label": "运行状态",
"options": "\n运行中\n已停机",
"read_only": 1
},
{
@ -172,21 +172,19 @@
{
"fieldname": "planid",
"fieldtype": "Data",
"hidden": 1,
"label": "套餐ID",
"read_only": 1
},
{
"fieldname": "period",
"fieldtype": "Int",
"hidden": 1,
"label": "购买时长(月)",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2025-07-27 22:04:39.820405",
"modified": "2025-07-27 23:19:16.648233",
"modified_by": "Administrator",
"module": "Jcloud",
"name": "Jsite Server",

View File

@ -26,7 +26,7 @@ class JsiteServer(Document):
planid: DF.Data | None
region: DF.Data | None
root_public_key: DF.Code | None
running_status: DF.Data | None
running_status: DF.Literal["", "\u8fd0\u884c\u4e2d", "\u5df2\u505c\u673a"]
ssh_port: DF.Int
ssh_user: DF.Data | None
status: DF.Literal["Pending", "Installing", "Active", "Broken", "Archived"]