main #2

Merged
jingrow merged 250 commits from main into v1 2026-01-13 22:45:50 +08:00
2 changed files with 19 additions and 16 deletions
Showing only changes of commit 25579862a2 - Show all commits

View File

@ -46,7 +46,7 @@ export default {
fieldname: 'status',
options: [
{ label: '', value: '' },
{ label: '待处理', value: 'Pending' },
{ label: '准备中', value: 'Pending' },
{ label: '启动中', value: 'Starting' },
{ label: '运行中', value: 'Running' },
{ label: '停止中', value: 'Stopping' },
@ -111,7 +111,7 @@ export default {
width: 0.8,
format(value) {
const statusMap = {
'Pending': '待处理',
'Pending': '准备中',
'Starting': '启动中',
'Running': '运行中',
'Stopping': '停止中',
@ -204,7 +204,7 @@ export default {
statusBadge({ documentResource: jsiteServer }) {
const status = jsiteServer.pg?.status;
const statusMap = {
'Pending': '待处理',
'Pending': '准备中',
'Starting': '启动中',
'Running': '运行中',
'Stopping': '停止中',

View File

@ -903,7 +903,7 @@ def create_server_order(**kwargs):
"pagetype": "Order",
"order_id": order_id,
"order_type": "新建服务器",
"team": team.name,
"team": team,
"status": "待支付",
"total_amount": total_amount,
"title": f"{region_id}",
@ -1262,7 +1262,7 @@ def create_aliyun_server(order_name):
"pagetype": "Jsite Server",
"team": order.team,
"order_id": order.order_id,
"status": "Running",
"status": "Pending",
"instance_id": instance_id,
"region": region_id,
"image_id": image_id,
@ -1380,22 +1380,25 @@ def update_server_record(instance_ids):
instance_info = instances[0] # 取第一个实例
# 获取公网IP最多重试30次
public_ip = instance_info.get('public_ip_address')
if not public_ip:
# 获取公网IP必需实例状态为Running且最多重试30次
if not instance_info.get('public_ip_address') or instance_info.get('status') != 'Running':
for retry in range(30):
time.sleep(10)
retry_details = get_aliyun_instance_details(instance_ids, region_id)
if retry_details and retry_details.get('success'):
retry_instances = retry_details.get('data', {}).get('instances', [])
if retry_instances and retry_instances[0].get('public_ip_address'):
public_ip = retry_instances[0].get('public_ip_address')
break
if retry_instances:
current_status = retry_instances[0].get('status', '')
current_public_ip = retry_instances[0].get('public_ip_address')
if current_status == 'Running' and current_public_ip:
# 条件满足后,重新获取完整的实例信息
instance_info = retry_instances[0]
break
else:
jingrow.log_error(f"获取公网IP失败-{instance_id}", f"实例 {instance_id} 在30次重试后仍未获取到公网IP")
return {"success": False, "message": f"实例 {instance_id} 在30次重试后仍未获取到公网IP"}
jingrow.log_error(f"获取实例信息失败-{instance_id}", f"实例 {instance_id} 在30次重试后仍未变为Running状态或获取到公网IP")
return {"success": False, "message": f"实例 {instance_id} 在30次重试后仍未变为Running状态或获取到公网IP"}
server.public_ip = public_ip
server.public_ip = instance_info.get('public_ip_address')
# 更新end_date从expired_time转换
expired_time = instance_info.get('expired_time')
@ -1451,9 +1454,9 @@ def update_server_record(instance_ids):
"success": True,
"message": "服务器信息更新成功",
"updated_fields": {
"public_ip": public_ip,
"public_ip": instance_info.get('public_ip_address'),
"end_date": server.end_date,
"status": server.status,
"status": instance_info.get('status'),
"system": server.system,
"os_type": server.os_type,
"plan_price": server.plan_price,