update_server_record增加更新plan_price字段
This commit is contained in:
parent
55f70cbf08
commit
6b9ac72cee
@ -1327,6 +1327,19 @@ def update_server_record(instance_ids):
|
||||
server.disk_size = resource_spec.get('disk_size')
|
||||
server.bandwidth = resource_spec.get('bandwidth')
|
||||
|
||||
# 更新套餐价格信息
|
||||
plan_id = instance_info.get('plan_id')
|
||||
if plan_id:
|
||||
# 获取套餐信息来计算价格
|
||||
plans_result = get_aliyun_plans(region_id)
|
||||
if plans_result and plans_result.get('success') and plans_result.get('data', {}).get('plans'):
|
||||
for plan in plans_result['data']['plans']:
|
||||
if plan.get('plan_id') == plan_id:
|
||||
# 使用调整后的价格(已经包含20%利润)
|
||||
if 'origin_price' in plan and plan['origin_price'] is not None:
|
||||
server.plan_price = float(plan['origin_price'])
|
||||
break
|
||||
|
||||
# 保存更新
|
||||
server.save(ignore_permissions=True)
|
||||
jingrow.db.commit()
|
||||
@ -1339,7 +1352,8 @@ def update_server_record(instance_ids):
|
||||
"end_date": server.end_date,
|
||||
"status": server.status,
|
||||
"system": server.system,
|
||||
"os_type": server.os_type
|
||||
"os_type": server.os_type,
|
||||
"plan_price": server.plan_price
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user