Commit 9dc40213 authored by 邱阿朋's avatar 邱阿朋

feat(vc): 支持日本站广告成本分析

- 添加日本站广告域名切换逻辑
- 更新域名切换函数以支持广告页面
- 解除日本站的注释- 更新测试用例和SPA计算示例
parent 92a406c2
...@@ -22,6 +22,12 @@ def switch_domain(country): ...@@ -22,6 +22,12 @@ def switch_domain(country):
return domain return domain
def switch_ad_domain(country):
domain = "https://advertising.amazon.com/"
if country == "JP":
domain = "https://advertising.amazon.co.jp/"
return domain
def domain_page(logger,page, country): def domain_page(logger,page, country):
url = switch_domain(country) url = switch_domain(country)
......
...@@ -75,7 +75,9 @@ class AdvertCost(AutoInterface): ...@@ -75,7 +75,9 @@ class AdvertCost(AutoInterface):
self.logger.debug(f"开始处理小组:{name}") self.logger.debug(f"开始处理小组:{name}")
entity_id = info['id'][1:] entity_id = info['id'][1:]
self.page.get(f"https://advertising.amazon.com/cm/products?entityId=ENTITY{entity_id}")
host = domain.switch_ad_domain(self.country)
self.page.get(f"{host}cm/products?entityId=ENTITY{entity_id}")
# 判断是否正常 # 判断是否正常
target_text = "There’s an issue with your payment method and your campaigns have stopped delivering." target_text = "There’s an issue with your payment method and your campaigns have stopped delivering."
......
...@@ -83,7 +83,7 @@ class VCManagerGUI(ttk.Window): ...@@ -83,7 +83,7 @@ class VCManagerGUI(ttk.Window):
countries = [ countries = [
("美国", "US"), ("美国", "US"),
# ("英国", "UK"), # ("英国", "UK"),
# ("日本", "JP"), ("日本", "JP"),
# ("法国", "FR"), # ("法国", "FR"),
# ("德国", "DE"), # ("德国", "DE"),
# ("加拿大", "CA"), # ("加拿大", "CA"),
......
...@@ -70,15 +70,15 @@ def calculate_totals(file_path): ...@@ -70,15 +70,15 @@ def calculate_totals(file_path):
def calculate_spa(): def calculate_spa():
# 使用示例 # 使用示例
file_path = '2025-06-13-16-52_US_spa.xlsx' # 替换为你的Excel文件路径 file_path = '2025-07-23-14-41_US_spa.xlsx' # 替换为你的Excel文件路径
total_amount, total_rows = calculate_totals(file_path) total_amount, total_rows = calculate_totals(file_path)
def sap(): def sap():
logger = ConsoleLog() logger = ConsoleLog()
page = ChromiumPage() page = ChromiumPage()
spa = Spa(logger, page, "US", "VECELO") spa = Spa(logger, page, "UK", "UK-VC")
spa.result_file_name = "2025-06-13-16-52_US_spa.xlsx" spa.result_file_name = "2025-07-21-15-29_UK_spa.xlsx"
spa.push_data_queue() spa.push_data_queue()
sap() calculate_spa()
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment