更新实例搜索功能,添加gp2存储价格的计算逻辑,以确保在gp3价格为0时正确计算磁盘月度价格。
This commit is contained in:
parent
a4e6da603e
commit
d9c7da8ef9
@ -96,6 +96,7 @@ async def search_instances_v2(
|
|||||||
for row in results:
|
for row in results:
|
||||||
hourly_price = float(row['price'])
|
hourly_price = float(row['price'])
|
||||||
gp3_price = float(row['gp3'])
|
gp3_price = float(row['gp3'])
|
||||||
|
gp2_price = float(row['gp2'])
|
||||||
monthly_price = hourly_price * 730 # 730小时/月
|
monthly_price = hourly_price * 730 # 730小时/月
|
||||||
|
|
||||||
# 计算存储价格
|
# 计算存储价格
|
||||||
@ -109,7 +110,7 @@ async def search_instances_v2(
|
|||||||
break
|
break
|
||||||
|
|
||||||
# disk_monthly_price = await calculate_ebs_price(region_code, disk_gb) if region_code else 0
|
# disk_monthly_price = await calculate_ebs_price(region_code, disk_gb) if region_code else 0
|
||||||
disk_monthly_price = gp3_price * disk_gb
|
disk_monthly_price = gp3_price * disk_gb if gp3_price > 0 else gp2_price * disk_gb
|
||||||
|
|
||||||
# 计算总价格
|
# 计算总价格
|
||||||
total_monthly_price = monthly_price + disk_monthly_price
|
total_monthly_price = monthly_price + disk_monthly_price
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user