Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
Amazon-Selection-Data
Overview
Overview
Details
Activity
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
abel_cjy
Amazon-Selection-Data
Commits
49f49ef3
Commit
49f49ef3
authored
Feb 25, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改卖家解析规则
parent
281b9289
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
common_udf.py
Pyspark_job/yswg_utils/common_udf.py
+22
-9
No files found.
Pyspark_job/yswg_utils/common_udf.py
View file @
49f49ef3
...
...
@@ -835,27 +835,40 @@ def udf_parse_seller_json(seller_json):
:return: buy_box_seller_type: 1.amazon,2.fba,3.fbm,4.默认值(无类型)
:return: 类型、店铺名称、店铺id
"""
# if not seller_json:
# if not seller_json or seller_json.strip() in ("", "null", "None"):
# return 0, None, None
if
'seller_id'
not
in
str
(
seller_json
):
if
not
seller_json
or
'seller_id'
not
in
str
(
seller_json
):
return
0
,
None
,
None
else
:
try
:
seller_info_parsed
=
json
.
loads
(
seller_json
)
except
json
.
JSONDecodeError
:
return
0
,
None
,
None
ship_from
=
seller_info_parsed
.
get
(
"ship_from"
,
None
)
sold_by
=
seller_info_parsed
.
get
(
"sold_by"
,
None
)
fulfilled_by
=
seller_info_parsed
.
get
(
"fulfilled_by"
,
None
)
seller_id
=
seller_info_parsed
.
get
(
"seller_id"
,
None
)
# 如果sold_by是amazon,优先归为1类
if
sold_by
and
sold_by
.
lower
()
.
strip
()
.
startswith
(
"amazon"
):
return
1
,
sold_by
,
seller_id
# Amazon
# 判断是否为Amazon相关(FBA情况)
if
(
ship_from
and
ship_from
.
lower
()
.
strip
()
.
startswith
(
"amazon"
))
or
(
fulfilled_by
and
'amazon'
in
fulfilled_by
.
lower
()):
if
sold_by
and
not
sold_by
.
lower
()
.
strip
()
.
startswith
(
"amazon"
):
return
2
,
sold_by
,
seller_id
# FBA
elif
sold_by
and
sold_by
.
lower
()
.
strip
()
.
startswith
(
"amazon"
):
return
1
,
sold_by
,
seller_id
# Amazon
elif
(
ship_from
or
fulfilled_by
)
and
sold_by
:
# FBM情况:有发货地或配送方信息,且有销售方
if
(
ship_from
or
fulfilled_by
)
and
sold_by
:
return
3
,
sold_by
,
seller_id
# FBM
# 其他情况
return
4
,
sold_by
,
seller_id
# Other
# if (ship_from and ship_from.lower().strip().startswith("amazon")) or (
# fulfilled_by and 'amazon' in fulfilled_by.lower()):
# if sold_by and not sold_by.lower().strip().startswith("amazon"):
# return 2, sold_by, seller_id # FBA
# elif sold_by and sold_by.lower().strip().startswith("amazon"):
# return 1, sold_by, seller_id # Amazon
# elif (ship_from or fulfilled_by) and sold_by:
# return 3, sold_by, seller_id # FBM
# return 4, sold_by, seller_id # Other
def
udf_parse_amazon_orders
(
asin_amazon_orders_str
):
"""
...
...
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