Commit 0dcdc879 by fangxingjun

Merge branch 'developer' of 47.106.101.75:abel_cjy/Amazon-Selection-Data into developer

parents 82198c1e bbef8e47
......@@ -1191,6 +1191,12 @@ class EsUtils(object):
"type": "float"
}
}
},
"tracking_since": {
"type": "date"
},
"tracking_since_type": {
"type": "short"
}
}
}
......
......@@ -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):
......
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