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
3a615c1f
Commit
3a615c1f
authored
Apr 16, 2026
by
chenyuanjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流量选品-卖家解析方式迭代
parent
41c62ac6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
21 deletions
+15
-21
common_udf.py
Pyspark_job/yswg_utils/common_udf.py
+15
-21
No files found.
Pyspark_job/yswg_utils/common_udf.py
View file @
3a615c1f
...
...
@@ -846,28 +846,22 @@ def udf_parse_seller_json(seller_json):
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
()):
return
2
,
sold_by
,
seller_id
# FBA
# 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
# ship_from 与 fulfilled_by 同义,任意一个为 amazon 即视为 amazon 发货
from_is_amazon
=
bool
(
(
ship_from
and
ship_from
.
lower
()
.
strip
()
.
startswith
(
"amazon"
))
or
(
fulfilled_by
and
fulfilled_by
.
lower
()
.
strip
()
.
startswith
(
"amazon"
))
)
from_field
=
ship_from
or
fulfilled_by
# 仅用于判断发货字段是否存在
sold_is_amazon
=
bool
(
sold_by
and
sold_by
.
lower
()
.
strip
()
.
startswith
(
"amazon"
))
if
from_is_amazon
and
sold_is_amazon
:
return
1
,
sold_by
,
seller_id
# 亚马逊自营:发货方和销售方均为 amazon
if
from_is_amazon
and
sold_by
:
return
2
,
sold_by
,
seller_id
# FBA:amazon 发货,第三方销售
if
from_field
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