Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amazon_reports
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
common
amazon_reports
Commits
92b3eed8
Commit
92b3eed8
authored
Jul 25, 2025
by
邱阿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(vc): 重构广告费用和产品销售数据处理
-优化广告费用处理逻辑,统一处理不同国家的数据格式 - 改进产品销售数据抓取,增加对日本站点的特殊处理 - 添加国家代码到产品销售数据,提高数据准确性
parent
e8a92103
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
advert_cost.py
app/vc/advert_cost.py
+3
-2
product_sales.py
app/vc/product_sales.py
+14
-2
No files found.
app/vc/advert_cost.py
View file @
92b3eed8
...
...
@@ -123,12 +123,13 @@ class AdvertCost(AutoInterface):
elif
self
.
country
==
"JP"
:
asin
=
item_row
.
get
(
'商品'
,
''
)
.
split
(
"-"
)[
0
]
spend
=
item_row
.
get
(
'花费(JPY)'
,
0.00
),
# 金额
if
isinstance
(
spend
,
tuple
):
spend
=
float
(
spend
[
0
])
else
:
asin
=
''
spend
=
0.00
if
isinstance
(
spend
,
tuple
):
spend
=
float
(
spend
[
0
])
push_data
=
{
'asin'
:
asin
,
# ASIN
'spend'
:
spend
,
# 金额
...
...
app/vc/product_sales.py
View file @
92b3eed8
...
...
@@ -8,7 +8,7 @@ from app.logger.logger import Logger
from
app.vc.interface
import
AutoInterface
from
DrissionPage
import
ChromiumPage
as
Page
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
class
ProductSales
(
AutoInterface
):
...
...
@@ -28,7 +28,18 @@ class ProductSales(AutoInterface):
self
.
page
.
get
(
full_url
,
timeout
=
5
)
def
run
(
self
,
file_name
:
str
):
self
.
__page_get
(
"retail-analytics/dashboard/sales?submit=true&time-period=daily"
)
# 获取当天日期
today
=
datetime
.
now
()
.
date
()
# 计算前3天的日期
daily_day
=
today
-
timedelta
(
days
=
3
)
# 默认为美国
url
=
"retail-analytics/dashboard/sales?submit=true&time-period=daily"
if
self
.
country
==
"JP"
:
url
=
f
"retail-analytics/dashboard/sales?daily-day={daily_day}&submit=true&time-period=daily"
self
.
__page_get
(
url
)
self
.
page
.
ele
(
"#raw_xlsx_btn"
)
.
click
()
self
.
logger
.
debug
(
"点击导出等待下载任务提交..."
)
self
.
page
.
wait
(
3
)
...
...
@@ -64,6 +75,7 @@ class ProductSales(AutoInterface):
'asin'
:
item_row
.
get
(
'ASIN'
,
''
),
'ordered_revenue'
:
item_row
.
get
(
'Ordered Revenue'
,
''
),
# 订单金额
'ordered_units'
:
item_row
.
get
(
'Ordered Units'
,
''
),
# 订单数量
'country'
:
self
.
country
,
}
# 推送数据
rabbit
.
send_message
(
push_data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment