-
Created by noptovius.halimawan@shopee.com, last modified by Junyao Long on 2025-04-17
由 noptovius.halimawan@shopee.com 创建,最后由 Long Junyao 修改于 2025-04-17
Epic 史诗 |
SPPT-110551 - Jira issue doesn't exist or you don't have permission to view it.
| Product Manager 产品经理 | |
---|---|---|---|
Developer(s) 开发人员 | QA Engineer(s) 测试工程师 | ||
Development Reviewer(s) 开发审核员 | Planned Release Date 计划发布日期 |
| |
Project Manager 项目经理 | Status 状态 | FINALIZED |
ChangeLog
Version 版本 | Date 日期 | Change Log 更改日志 | PIC | Color 颜色 |
---|---|---|---|---|
Version 版本 | Date 日期 | Change Log 变更日志 | PIC | Color 颜色 |
v0 |
| Draft the TD 起草 TD | Default 默认 | |
v1 |
| Details added after 1st External TD review 在第一次外部 TD 审查后添加了详细信息 | Blue 蓝色 | |
v2 |
| Added internal TD details 添加了内部 TD 细节 | Default 默认 | |
v3 |
| Updates after Internal TD Review:
| Purple 紫色 | |
v4 |
|
| Orange 橙色 | |
v5 |
|
| Green 绿色 | |
v6 |
| Post dev updates: 发布开发更新:
| Maroon 深红色 |
Background 背景
To support the Price Standardization long term project, we should enable the (previously called) price.central
service to support more scenarios such as the Buyer-Default scenario.
为了支持价格标准化长期项目,我们应该启用(以前称为) price.central
服务以支持更多场景,例如买家默认场景。
This aligns with some new client requirements from Video Chat & Shop Chat team which is defined in the project PRD.
这与视频聊天和店铺聊天团队定义的一些新客户需求一致,这些需求在项目 PRD 中定义。
In addition to supporting these requirements, we should also take another step to achieve our long term price architecture through this project.
除了支持这些要求外,我们还应通过这个项目再迈出一步,以实现我们的长期价格架构。
Abbreviations: 缩写:
- PBI: Promotion Bass Item (price team's service)
PBI:促销基础项目(价格团队的服务) - IIB: Item Info Bass (service, team)
IIB:项目信息基础(服务,团队) - PBS: Price Business (service)
PBS:价格业务(服务) - PCS: Price Central Service (price team's service)
PCS:价格中央服务(价格团队的服务) - IPB: Item Promotion Business (price team's proposed service)
IPB:商品促销业务(价格团队提议的服务) - IAS: Item Aggregation Service (listing team's service)
IAS:商品聚合服务(列表团队的服务) - LAS: Listing Aggregation Service (listing team's service)
LAS:商品聚合服务(商品团队的服务) - ITS: Item Tag Service (listing tag team's service)
ITS:商品标签服务(商品标签团队的服务)
Related Documents: 相关文档:
- [PRD][Price] Support AI & Shop chat bot to get Final Price Info Based on Model ID
[PRD][价格] 支持 AI 和店铺聊天机器人根据模型 ID 获取最终价格信息 - [PRD] Price Standardization 2.0
[PRD] 价格标准化 2.0 - [HLS] Price Standardization 2.0
[HLS] 价格标准化 2.0 - Voucher TD: Voucher Backend - 2024-12-06 - Price Standardisation 2.0
优惠券 TD:优惠券后端 - 2024-12-06 - 价格标准化 2.0 - (Price)(TD) Price Standardization 1.0 - https://confluence.shopee.io/pages/viewpage.action?spaceKey=SPPT&title=%5BTD%5D%5BSPPT-101112%5D+Price+Standardization+-+Phase+1+-+Support+SPU+real+time+calculation
(价格)(TD) 价格标准化 1.0 - https://confluence.shopee.io/pages/viewpage.action?spaceKey=SPPT&title=%5BTD%5D%5BSPPT-101112%5D+价格标准化+-+第一阶段+-+支持 SPU 实时计算 - (Price)(TD) Streaming Price Revamp - https://confluence.shopee.io/display/SPPT/%5BTD%5D%5BPBI%2C+PBS%2C+PCP%5D+Streaming+Price+Revamp
(价格)(TD) 流价改版 - https://confluence.shopee.io/display/SPPT/%5BTD%5D%5BPBI%2C+PBS%2C+PCP%5D+Streaming+Price+Revamp - (Price)(TD) Price Support Live Streaming Whitelist - https://confluence.shopee.io/display/SPPT/%5BTD%5D+Price+Support+Live+Streaming+Whitelist#heading-2112TheLSRoomEntryFlow
(价格)(TD) 价格支持直播白名单 - https://confluence.shopee.io/display/SPPT/%5BTD%5D+Price+Support+Live+Streaming+Whitelist#heading-2112TheLSRoomEntryFlow - (Price)(TD) Take Over Upcoming PSP Banner Display Logic from LS - https://confluence.shopee.io/display/SPPT/%5BTD%5D+Takeover+Upcoming+PSP+Banner+Display+Logic+from+LS
(价格)(TD) 从 LS 接管即将到来的 PSP 横幅显示逻辑 - https://confluence.shopee.io/display/SPPT/%5BTD%5D+Takeover+Upcoming+PSP+Banner+Display+Logic+from+LS - (Price)(TD) Support ROI 3.0 Advertising Smart Voucher - [SPPT-108545] [Price/ItemCard] Support ROI3.0 Advertising Smart Voucher
(价格)(TD) 支持 ROI 3.0 广告智能券 - [SPPT-108545] [价格/商品卡] 支持 ROI3.0 广告智能券 - (Repo) WSA Common - http://git.garena.com/shopee/mall-server/wsa-common
(代码库) WSA 通用 - http://git.garena.com/shopee/mall-server/wsa-common
Product Requirements: 产品需求:
TBC: 待确认:
- Pending requirement clarifications in the PRD:
PRD 中待明确的需求澄清:- MPI requested for Best / Lowest Price, what's the definition here?
MPI 请求最佳/最低价格,这里的定义是什么?
- MPI requested for Best / Lowest Price, what's the definition here?
- Provide Buyer-Default scenario for clients
为客户提供买家默认场景 - Provide Buyer-NonLogin scenario for clients
为客户提供买家未登录场景
Technical Requirements: 技术要求:
- Determine a new name for
price.central
service
确定新名称为price.central
服务- TBC:
item_promotion_business
待定:item_promotion_business
- TBC:
- item_promotion_business 商品促销业务
- Setup 设置
- Repo 仓库
- CMDB
- Packaging 包装
- Decide on a standardized package management for the service
确定服务的标准化包管理方案
- Decide on a standardized package management for the service
- Provide Buyer-default flow
提供买家默认流程- EP Calculation EP 计算
- WP Calculation WP 计算
- LS Calculation LS 计算
- Parallelize the API calls (consider using concurrency library)
并行化 API 调用(考虑使用并发库)
- Provide Buyer-nonlogin flow
提供买家未登录流程 - Scenario Management 场景管理
- API Proto change API 协议变更
- Split by client and scenario (define the scope)
按客户和场景进行拆分(定义范围)
- Configs 配置
- Move applicable configs from PBS to IPB
将适用的配置从 PBS 移动到 IPB
- Move applicable configs from PBS to IPB
Caching 缓存Cache data in PCS to reduce API calls to PBS
在 PCS 中缓存数据以减少对 PBS 的 API 调用
- Nice to have(s): 其他建议:
- Add remaining scenarios supported by Price Central Service
添加 Price Central Service 支持的其他场景 - Monitoring 监控
- Add a new grafana board for IPB
为 IPB 添加一个新的 Grafana 看板 - Add feature-related metrics
添加与功能相关的指标
- Add a new grafana board for IPB
- API Verification API 验证
- Create API verification SDU for IPB
为 IPB 创建 API 验证 SDU
- Create API verification SDU for IPB
- Stress Test 压力测试
- Integrate with price stress test framework
与价格压力测试框架集成
- Integrate with price stress test framework
- Add remaining scenarios supported by Price Central Service
- Setup 设置
- price.business
- Provide a lean API which skips:
提供一个精简的 API,它跳过:- (TBC) cache (待定) 缓存
- This is to align with future architecture direction where we don't plan on caching in PBS.
这是为了与未来的架构方向保持一致,我们计划不在 PBS 中缓存。
To minimize impact, maybe we can make it configurable (toggle on / off) first.
为了最小化影响,我们或许可以先将其设置为可配置(开/关)。
- This is to align with future architecture direction where we don't plan on caching in PBS.
- filtering logic (e.g. by model_id / promotion_type)
过滤逻辑(例如按 model_id / 促销类型)- This is because if we cache the data in the new service, we shouldn't cache filtered data
这是因为如果我们在新服务中缓存数据,就不应该缓存过滤后的数据
- This is because if we cache the data in the new service, we shouldn't cache filtered data
- eligibility check 资格审查
- tax calculation 税收计算
- rebate data query 退税数据查询
- etc. (basically it should only provide price-stock-soldout calculation)
等。基本上它应该只提供价格-库存-售罄计算
- (TBC) cache (待定) 缓存
- Remove these definitions from the lean API:
从精简 API 中删除这些定义:- display_price / display_stock
显示价格 / 显示库存 - rebate 折扣
- aggregated price / stock info
汇总价格/库存信息 - ongoing / upcoming price 进行中/即将到来的价格
- status 状态
- display_price / display_stock
- PSSO query layer PSSO 查询层
- Provide a lean API which skips:
1. System Overview 1. 系统概述
To support [PRD][Price] Support AI & Shop chat bot to get Final Price Info Based on Model ID, we need to provide Shop Chat and Video AI Chat team with the promotion data that they require.
为了支持 [PRD][价格] 支持 AI & 店铺聊天机器人获取基于模型 ID 的最终价格信息,我们需要向店铺聊天和视频 AI 聊天团队提供他们所需的促销数据。
We are aiming to take a further step to revamp our Calc / Price Architecture together with this project, by implementing the changes in a new service instead of in PBS.
我们希望通过这个项目进一步改进我们的计算/价格架构,通过在一个新服务中实施这些更改,而不是在 PBS 中实施。
2. Cross Team Technical Design
2. 跨团队技术设计
2.1. Definitions 2.1. 定义
2.1.1. Item Promotion Business Service
2.1.1. 商品推广业务服务
In this project, we are introducing a new service called item_promotion_business service.
在此项目中,我们引入了一个名为 item_promotion_business 服务的新服务。
In the future, this service will be the entry point (gateway) for external & internal clients to query Product Promo Info (Price / Price+Stock) information.
在未来,该服务将成为外部和内部客户查询产品促销信息(价格/价格+库存)信息的入口(网关)。
Function - This service will function as:
功能 - 该服务将作为以下功能:
- Facade - to hide the complexities of calculating product promotion info (price / price + stock)
外观 - 用于隐藏计算产品促销信息(价格/价格+库存)的复杂性 - Gateway - as the centralized entry point for clients to obtain price information
网关 - 作为客户端获取价格信息的集中式入口 - Core Engine - as the main calculator of complex queries and business logic
核心引擎 - 作为复杂查询和业务逻辑的主要计算器
Scope - the service will only return promotion related information to its clients.
范围 - 该服务仅向其客户端返回与促销相关的信息。
Style - the service will serve requests in terms of scenario_id and client_ids (encapsulated with flow_id).
样式 - 该服务将根据场景 ID 和客户端 ID(封装在流程 ID 中)来处理请求。
The business logic / features to apply / return will differ depending on the applicable scenario_id and client_id passed in the request.
应用的业务逻辑/功能/返回结果将根据请求中传递的场景 ID 和客户端 ID 而有所不同。
2.2. Solution 2.2. 解决方案
2.2.1. Requirements Summary
2.2.1. 需求摘要
We will provide clients with a service & API to provide:
我们将向客户提供服务和 API 以提供:
- Promotion Information 促销信息
- Price 价格
- Stock 库存
- Final Price Information 最终价格信息
- E.g. price after voucher & product promo discount
例如。使用优惠券和商品促销折扣后的价格
- E.g. price after voucher & product promo discount
- User Eligibility Check 用户资格检查
- This will disable some promotions if the users are not eligible for them.
如果用户不符合资格,这将禁用一些促销活动。
e.g. 例如- Live Streaming promotions
直播促销活动 - Exclusive Price promotions
独家价格促销活动 - Welcome Package promotions
欢迎套餐促销
- Live Streaming promotions
- This will disable some promotions if the users are not eligible for them.
- Tax Selection 税项选择
- Will apply tax when applicable (based on the default tax requirements)
适用时将应用税(基于默认税项要求) - total tax 总税额
- Will apply tax when applicable (based on the default tax requirements)
- Rebate 返利
- product promo rebate 产品促销返利
- voucher rebate 优惠券返利
- total rebate 总返利
2.2.2. Overview Diagram 2.2.2. 概述图
2.2.3. API Design 2.2.3. API 设计
2.2.3.1. Namespace 2.2.3.1. 命名空间
API Name: calculation.item_promotion_business.get_promotion_info
API 名称:计算.商品促销业务.获取促销信息
2.2.3.2. Expected QPS From Clients + Traffic Type (Response Required)
2.2.3.2. 客户预期 QPS+流量类型(需要响应)
Scene ID 场景 ID | Client 客户 | Estimated QPS 预计 QPS | Type of Traffic 流量类型 |
---|---|---|---|
Scene ID 场景 ID | Client 客户 | Estimated QPS 预计 QPS | Type of Traffic 流量类型 |
5 | Shop Chat 购物聊天 | Normal: 15k 普通价格:15k Campaign Peak: 45K 活动高峰:45K The above is total sum(all regions) QPS. Therefore peak per region → daily 10k (campaign: 25k) |
|
6 | Shop Chatbot | Feb 25: 140 2 月 25 日:140 |
|
7 | Video AI Chat 视频 AI 聊天 | < 10 , max(50) |
|
8 | Off-Platform Ads 站外广告 | 6,800 |
|
2.2.3.3. Estimated QPS to Dependencies
2.2.3.3. 对依赖的估计 QPS
For some flows, QPS is still 0 and the flow is toggled off (e.g. by SPEX Configs).
对于某些流程,QPS 仍然为 0 并且流程被关闭(例如通过 SPEX 配置关闭)。
In this case, it's OK for dep. teams to choose not to accept the API permission in this phase of the project.
在此情况下,项目该阶段,部门团队选择不接受 API 权限是可以的。
Dep. API 部门 API | Cached? 缓存? | Clients 客户 | Expected Peak QPS (for 1 region) 预期峰值 QPS(针对 1 个区域) | API Permission Ticket API 权限票据 | |
---|---|---|---|---|---|
Dep. API | Cached? | Clients | Expected Peak QPS (for 1 region) | API Permission Ticket | |
1 | price.business.get_price_stock_sold_out_info | N |
| Daily: 18 k 每日:18k Campaign: 33k 活动:33k | https://space.shopee.io/utility/swp/detail/3860198 |
2 | promotion.discount.base.main.get_discount_item_snapshot_list 获取促销折扣基础的主要折扣项快照列表 | N |
Update: no rebate info needed | 0 | https://space.shopee.io/utility/swp/detail/3857296 |
3 | promotion.exclusive_price.check_exclusive_price 促销。专属价格。检查专属价格 | N |
| Daily: 11 k 每日:11k Campaign: 26k 活动:26k | https://space.shopee.io/utility/swp/detail/3857475 |
4 | promotion.exclusive_price.check_streaming_price_user_eligibility 检查用户是否符合专属价格流媒体价格资格 | N |
| Daily: 11 k 每日:11k Campaign: 26k 活动:26k | |
5 | growth.welcome_package.validate_user_with_cache | N |
| Daily: 11 k 每日:11k Campaign: 26k 活动:26k | https://space.shopee.io/utility/swp/detail/3857506 |
6 | marketplace.listing.aggregation.bass.iteminfo.get_batch_item 市场列表聚合.bass 物品信息批量获取 | N | Update: all should call IAS + ITS 更新:所有应该调用 IAS + ITS | 0 | https://space.shopee.io/utility/swp/detail/3857533 |
7 | marketplace.listing.item.itemaggregation.iteminfo.get_product_info | N |
| Daily: 18 k 每日:18k Campaign: 33k 活动:33k | https://space.shopee.io/utility/swp/detail/3857547 |
8 | marketplace.listing.itemtagservice.querying_api.get_item_labels 市场列表项标签服务查询 API 获取项标签 | N |
| Daily: 18 k 每日:18 k Campaign: 33k 活动:33k | https://space.shopee.io/utility/swp/detail/3857556 |
9 | voucher.mp.usage.get_best_vouchers_by_items_from_pool | N |
| Daily: 18 k 每日:18 k Campaign: 33k 活动:33k | https://space.shopee.io/utility/swp/detail/3857567 |
2.2.3.4. Constants 2.2.3.4. 常量
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | message Constant { // DisplayPromoResultType defines the type of display promo result returned to the clients. Clients should refer // to the constants defined under this enum to tell which field to read from Price Central API response. enum DisplayPromoResultType { UNKNOWN_DISPLAY_PROMO = 0 ; // Constant_ITEM_DISPLAY_PROMO indicates that the returned DisplayPromoResult will be in the form of ItemDisplayPromoInfo. ITEM_DISPLAY_PROMO = 1 ; // Constant_TIMESTAMP_DISPLAY_PROMO indicates that the returned DisplayPromoResult will be in the form of TimestampDisplayPromoInfo. TIMESTAMP_DISPLAY_PROMO = 2 ; } // Business Error Codes to be added later, something like these: enum ErrorCode { // Constant_ERROR_SERVICE_UNKNOWN is the default error returned for unhandled, unexpected errors in the service. ERROR_SERVICE_UNKNOWN = XXX; // Constant_ERROR_REQUEST_ASSERTION is returned when the service receives a request structure in the wrong type. ERROR_REQUEST_ASSERTION = XXX; // Constant_ERROR_RESPONSE_ASSERTION is returned when the service receives a response structure in the wrong type. ERROR_RESPONSE_ASSERTION = XXX; // Constant_ERROR_ABNORMAL_PARAM is returned upon validation failures when checking the request parameter. ERROR_ABNORMAL_PARAM = XXX; // Constant_ERROR_NOT_SUPPORTED is returned when the client is requesting for an unsupported behaviour in the API. ERROR_NOT_SUPPORTED = XXX; } enum UserPath { // from voucher.mp.usage Constant_USER_PATH_DEFAULT Constant_OrderItemUserPath = 1 Constant_USER_PATH_LIVESTREAM Constant_OrderItemUserPath = 2 Constant_USER_PATH_SHORT_VIDEO Constant_OrderItemUserPath = 4 } } |
2.2.3.5. Request 2.2.3.5. 请求
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | message GetPromotionInfoRequest { optional uint64 scene_id = 1 ; repeated ItemParam items = 2 ; optional TimeParam time = 3 ; // not for clients of this phase optional UserParam user = 4 ; } message UserParam { optional BuyerParam buyer = 1 ; } message BuyerParam { optional uint64 user_id = 1 ; optional DeviceParam device = 2 ; optional BuyerJourneyParam journey = 3 ; } message BuyerJourneyParam { optional uint32 user_path = 1 ; optional string live_stream_discount_token = 2 ; } message DeviceParam { optional uint32 client_platform = 1 ; } message ItemParam { optional uint64 item_id = 1 ; repeated ItemModelParam models = 2 ; optional ItemAdsParam ads = 3 ; optional ItemStreamerParam streamer = 4 ; } message ItemStreamerParam { optional int64 live_stream_streamer_id = 1 ; optional int64 shopee_video_creator_id = 2 ; } message ItemAdsParam { optional int64 ads_id = 1 ; } message ItemModelParam { optional uint64 model_id = 1 ; } message TimeParam { // not for clients of this phase repeated TimestampParam timestamps = 1 ; } message TimestampParam { // not for clients of this phase optional int64 query_timestamp = 1 ; } |
2.2.3.5.1. Optional Fields (Response Required)
2.2.3.5.1. 可选字段(响应必需)
The table below indicates the list of optional fields we have in the API request schema, and its explanation on the usage.
下列表格显示了 API 请求模式中可选字段的列表及其使用说明。
Do you have this field to pass to Price (Calc) API? 你有这个字段要传递给价格(计算)API 吗? | |||||
---|---|---|---|---|---|
Field Name 字段名 | Usage 使用说明 | Shop Chat 购物聊天 | Shop Chatbot | Video AI Chat 视频 AI 聊天 | Off-Platform Ads 离线平台广告 |
ModelQuery.model_id | To indicate which model 's promo info you are interested in. 用于指示您感兴趣的是哪个模型的促销信息。 If not filled, the API will return all model promo infos under the item. 如果未填写,API 将返回该项目下所有模型促销信息。 |
|
|
|
|
user_path 用户路径 | For voucher validation. 用于优惠券验证。 |
|
|
|
|
live_stream_streamer_id | For voucher & live streaming promo discount validation. 用于优惠券和直播促销折扣验证。 |
|
|
|
|
shopee_video_creator_id 视频创作者 ID | For voucher validation. 用于优惠券验证。 |
|
|
|
|
live_stream_discount_token 直播优惠券令牌 (also known as (也称为 live_streaming_price_eligibility_token) 直播价格资格令牌) | For live streaming promo discount validation. 用于直播促销折扣验证。 |
|
|
|
|
client_platform 客户平台 | For voucher validation. 用于优惠券验证。 |
|
|
|
|
ads_id 广告 ID | For voucher validation (Ads Voucher). 用于优惠券验证(广告优惠券)。 |
|
|
|
|
2.2.3.5.2. Sample 2.2.3.5.2. 示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | { "scene_id" : 5 , "items" : [ { "item_id" : 10 , "models" : [ { "model_id" : 20 }, { "model_id" : 20 }, { "model_id" : 40 } ], "ads" : { "ads_id" : 777 } } ], "user" : { "buyer" : { "user_id" : 123456 , "journey" : { "user_path" : 123 , "live_stream_streamer_id" : 456 , "short_video_streamer_id" : 789 , "live_stream_discount_token" : 12321 }, "device" : { "client_platform" : 456 } } } } |
2.2.3.6. Response 2.2.3.6. 响应
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | message GetPromotionInfoResponse { optional string debug_msg = 1 ; optional DisplayPromoResult display_promo = 2 ; } message DisplayPromoResult { optional uint32 result_type = 1 ; repeated ItemDisplayPromoInfo items = 2 ; repeated TimestampDisplayPromoInfo timestamps = 3 ; // not for clients of this phase } message TimestampDisplayPromoInfo { // not for clients of this phase optional int64 timestamp = 1 ; repeated ItemDisplayPromoInfo items = 2 ; } message ItemDisplayPromoInfo { optional uint64 item_id = 1 ; repeated ModelDisplayPromoInfo models = 2 ; } message ModelDisplayPromoInfo { optional uint64 model_id = 1 ; optional ModelMainPromoInfo main = 2 ; } message ModelMainPromoInfo { optional DisplayPrice price = 1 ; optional DisplayStock stock = 2 ; optional AppliedProductPromotionInfo applied_product_promo = 3 ; optional AppliedVoucherInfo applied_voucher = 4 ; } message AppliedProductPromotionInfo { optional uint64 promotion_id = 1 ; optional uint32 promotion_type = 2 ; optional uint32 start_time = 3 ; optional uint32 end_time = 4 ; optional AppliedProductPromotionDetail detail = 5 ; } message AppliedProductPromotionDetail { optional int64 applied_price = 1 ; optional Rebate rebate = 2 ; } message DisplayPrice { optional int64 final_price = 1 ; optional DisplayPriceDetail detail = 2 ; } message DisplayPriceDetail { optional Tax tax = 1 ; optional Rebate rebate = 2 ; } message Rebate { optional int64 value = 1 ; optional int64 rate = 2 ; // inflated by 1e5, e.g. 12352 -> 12.352% } message Tax { optional int64 value = 1 ; optional int64 rate = 2 ; // inflated by 1e5, e.g. 12352 -> 12.352% } message DisplayStock { optional int32 available_quantity = 1 ; } message AppliedVoucherInfo { optional AppliedShopVoucher shop_voucher = 1 ; optional AppliedPlatformVoucher platform_voucher = 2 ; } message AppliedShopVoucher { optional int64 voucher_id = 1 ; optional AppliedVoucherDetail detail = 2 ; } message AppliedPlatformVoucher { optional int64 voucher_id = 1 ; optional AppliedVoucherDetail detail = 2 ; } message AppliedVoucherDetail { optional int64 discount_value = 1 ; optional int64 rebate_value = 2 ; optional AppliedVoucherTimeInfo time_info = 3 ; optional AppliedVoucherQuotaInfo quota_info = 4 ; } message AppliedVoucherTimeInfo { optional uint32 start_time = 1 ; optional uint32 end_time = 2 ; } message AppliedVoucherQuotaInfo { optional int64 total_use_count = 1 ; } |
2.2.3.6.1. Sample 2.2.3.6.1. 示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | { "debug_msg" : null , "display_promo" : { "result_type" : 1 , // ITEM_DISPLAY_PROMO "items" : [ { "item_id" : 10 , "models" : [ { "model_id" : 20 , "main" : { "price" : { "final_price" : 90 , "total_tax" : { "value" : 0 , "rate" : 0 }, "total_rebate" : { "value" : 10 , "rate" : 11 } }, "stock" : { "available_quantity" : 10 }, "applied_product_promo" : { "promotion_id" : 3593928 , "promotion_type" : 301 , "start_time" : 23123124 , "end_time" : 4359348293 , "applied_price" : 100 , "rebate_value" : 10 , "rebate_rate" : 10 }, "applied_voucher" : { "shop_voucher" : { "voucher_id" : 37590 , "detail" : { "discount_value" : 10 , "rebate" : { "value" : 0 , "rate" : 0 } "time_info" : { "start_time" : 35873149 , "end_time" : 123912 }, "quota_info" : { "total_use_count" : 30 } } }, "platform_voucher" : null // null means no applicable voucher } } }, { "model_id" : 20 , "..." : {} }, { "model_id" : 30 , "..." : {} } ] } ] } } |
2.2.4. Error Flow 2.2.4. 错误流程
This API will return error when encountering errors from order-critical dependencies (e.g. Price service, Stock service).
当遇到来自订单关键依赖项(例如价格服务、库存服务)的错误时,此 API 将返回错误。
However this API will not return error when receiving errors from other services such as Voucher (display) service → on such cases the service will assume that there are no applicable vouchers for the item / model.
然而,当收到来自其他服务(如代金券(显示)服务)的错误时,此 API 不会返回错误,在这种情况下,服务将假定该商品/型号没有适用的代金券。
2.2.4.1. Accuracy vs. Availability (Response Required)
2.2.4.1. 准确性 vs. 可用性 (需要回复)
We will not return error when final price feature is downgraded.
当最终价格功能降级时,我们不会返回错误。
This is because on some regions (e.g. BR and TW), the final price feature is downgraded all of the time (during the time of writing).
这是因为在某些地区(例如巴西和台湾),最终价格功能一直处于降级状态(截至撰写本文时)。
Therefore to avoid returning error all the time in BR and TW, we should still return price-after-voucher during dependency / feature downgrades.
因此,为了避免在巴西和台湾一直返回错误,我们应在依赖项/功能降级期间仍然返回使用优惠券后的价格。
In this case, we define whether a price is accurate if → no calculation-related dependencies return error.
在这种情况下,我们定义价格是否准确的条件是:没有计算相关的依赖项返回错误。
(Downgrades don't count as errors, because usually we skip the API call).
(降级不计为错误,因为通常我们会跳过 API 调用)。
In case where clients prefer data accuracy over API availability, we're going to provide an option for clients to choose whether a scene should be downgraded when any of the Price calculation factor is downgraded. return error when a final-price-related-dependency API fails (returns error).
如果客户更倾向于数据准确性而非 API 可用性,我们将提供一个选项,让客户选择在任一价格计算因素被降级时是否应降低场景级别。当与最终价格相关的依赖 API 失败(返回错误)时,返回错误。
For example: 例如:
- If Voucher API returns an error, do you want our API to return an error, or return price-before-voucher?
如果代金券 API 返回错误,您希望我们的 API 返回错误,还是返回使用代金券前的价格? If price-after-voucher is downgraded, do you want our API to return an error, or return price-before-voucher?
如果使用优惠券后的价格降低了,您希望我们的 API 返回错误,还是返回使用优惠券前的价格?
Client Name 客户名称 | Scenario 场景 | Scene 场景 | Preference 偏好 | |
---|---|---|---|---|
Client Name | Scenario | Scene | Preference | |
1 | Shop Chat 购物聊天 | Buyer - Default 买家 - 默认 | 5 |
|
2 | Shop Chatbot | Buyer - Default 买家 - 默认 | 6 |
|
3 | Video AI Chat 视频 AI 聊天 | Buyer - Default 买家 - 默认 | 7 |
|
4 | Off-Platform Ads 站外广告 | Buyer - Nonlogin 买家 - 未登录 | 8 |
|
2.2.5. Downgrade Flow 2.2.5. 降级流程
Available downgrades: 可用的降级选项:
Downgrade Name 降级名称 | Impact 影响 | Remarks 备注 | Changes 变更 |
---|---|---|---|
Downgrade Name | Impact | Remarks | Changes |
Downgrade Price After Voucher 优惠券使用后降价 |
| Last triggered on 9.9 / 10.10 2024. 最后触发于 2024 年 9 月 9 日 / 10 月 10 日。 | After this project: 在此项目之后:
|
Downgrade Exclusive Price 降级专享价格 |
| Has never been triggered in the past 2 years. 过去两年从未被触发。 | No changes. 没有变化。 These toggles are implemented to mirror the downgrade capabilities of price.business. |
Downgrade Live Streaming Price 降级直播价格 | |||
Downgrade Welcome Package Price 降级欢迎套餐价格 |
2.2.6. Scenario Settings 2.2.6. 场景设置
2.2.6.1. Summary 2.2.6.1. 摘要
Shop Chat 购物聊天 (Scene 5) (场景 5) | Shop Chatbot | Video AI Chat 视频 AI 聊天 (Scene 7) (场景 7) | ||
---|---|---|---|---|
Scenario: Buyer - Default 场景:买家 - 默认 | Product Promotion Eligibility Check 产品推广资格检查 | Enabled (login mode) 已启用(登录模式) | ||
Price After Voucher 使用优惠券后的价格 | Apply platform & seller/shop voucher to final price 将平台和卖家/店铺优惠券应用于最终价格 | |||
Time 时间 | Real time 实时 | |||
Rebate 折扣 | Price without rebate (buyer price) 未折扣价格(买家价格) | |||
Model Price Selection 模型价格选择 | Default (Promo Priority based) 默认(促销优先) | |||
Specific Rules - Calc 具体规则 - Calc | Excluded Product Promotion Types 排除商品促销类型 | None, include all buyer price:
| ||
Granularity 粒度 | Model-level display promo (one promo price per model) 模型级显示促销(每个型号一个促销价格) | |||
Stock 库存 | Requires available stock / quantity information 需要库存/数量信息 | |||
Tax 税 |
No requirement to return tax breakdown. | |||
Rebate 折扣 |
No rebate information needed (cc weiyi.zhang@shopee.com ) | |||
Specific Rules - Voucher 具体规则 - 优惠券 | Bypass Validation 跳过验证 | None 无 |
Clients can provide shopee video creator id and user path, therefore no bypass needed (cc junbang.tan@shopee.com ) |
2.2.6.2. Eligibility Check
2.2.6.2. 资格审查
Since both Shop Chat and Video AI Chat require login mode, we will enable promotion eligibility check in the price logic.
由于 Shop Chat 和 Video AI Chat 都需要登录模式,我们将在价格逻辑中启用促销资格检查。
We have aligned that since Chat team requires LS Eligibility Logic based on PDP (by token & stored user eligibility).
我们已经确定,由于 Chat 团队需要基于 PDP 的 LS 资格逻辑(通过 token 和存储的用户资格)。
2.2.7. Voucher Information
2.2.7. 优惠券信息
2.2.7.1. Requirements 2.2.7.1. 要求
Reference: [PRD][Price] Support AI & Shop chat bot to get Final Price Info Based on Model ID
参考:[PRD][价格] 支持 AI 和店铺聊天机器人以根据模型 ID 获取最终价格信息
- For both Shop Chat & Video AI Chat
适用于店铺聊天和视频 AI 聊天- Require the same voucher requirements as item card.
需要和商品卡片相同的优惠券要求
- Require the same voucher requirements as item card.
- Video AI Chat: 视频 AI 聊天:
- Bypass video voucher eligibility checks
绕过视频优惠券资格检查
- Bypass video voucher eligibility checks
2.2.7.2. Request Parameters
2.2.7.2. 请求参数
Reference: Voucher Backend - 2024-12-06 - Price Standardisation 2.0
参考:代金券后端 - 2024-12-06 - 价格标准化 2.0
Scene ID 场景 ID | Client 客户 | Shop Voucher Pool 优惠券池 | Platform Voucher Pool 平台优惠券池 | Bypass Validation 跳过验证 |
---|---|---|---|---|
Scene ID | Client | Shop Voucher Pool | Platform Voucher Pool | Bypass Validation |
5 | Shop Chat 购物聊天 | BAU: 常规业务
Downgrade: 降级
| BAU: 常规
Downgrade: 降级
| None 无 |
6 | Shop Chatbot | BAU: 常规操作
Downgrade: 降级
| BAU: 常规
Downgrade: 降级
| None 无 |
7 | Video AI Chat 视频 AI 聊天 | BAU: 常规操作
Downgrade: 降级:
| BAU: 常规操作
Downgrade: 降级
|
None 无 |
2.2.8. Listing + Label Information
2.2.8. 商品+标签信息
In order to query the voucher API to get the best recommended vouchers (price after voucher feature), we need to provide voucher with some item basic information and label information.
为了查询代金券 API 以获取最佳推荐代金券(使用代金券后的价格功能),我们需要提供一些商品基本信息和标签信息。
Currently we have several different flows of doing so:
目前我们有多种不同的处理流程:
Flow 流程 | Listing Datasource 商品数据源 | Label ID v2 Datasource 标签 ID v2 数据源 | Remarks 备注 |
---|---|---|---|
Flow | Listing Datasource | Label ID v2 Datasource | Remarks |
Item Card 商品卡片 | marketplace.listing.aggregation.bass.iteminfo.get_batch_item | marketplace.listing.aggregation.bass.iteminfo.get_batch_item | |
PDP | from PDP (client) 从 PDP(客户端) | from PDP (client) 从 PDP(客户端) | |
Live Streaming Room 直播房间 | marketplace.listing.aggregation.listing_aggr_service.get_batch_listing_aggregation | marketplace.listing.aggregation.listing_aggr_service.get_batch_listing_aggregation | Under migration planning. 正在迁移规划中。 According to Listing team, we should move this to marketplace.listing.aggregation.bass.iteminfo.get_batch_item. 根据 Listing 团队,我们应该将这个移至 marketplace.listing.aggregation.bass.iteminfo.get_batch_item。 |
Price Central 价格中心 (price.business with sdu=central ) (价格业务,sdu=中央) | marketplace.listing.item.itemaggregation.iteminfo.get_product_info | marketplace.listing.item.itemaggregation.iteminfo.get_product_info (wrong) marketplace.listing.item.itemaggregation.iteminfo.get_product_info(错误) | We're calling IAS in this flow because this is what was recommended by Listing team during the project's TD phase. Therefore right now this flow is actually erroneous. How to retrieve Item Label V2? 如何获取商品标签 V2? According to Listing team, here's how we can retrieve Item Label V2 (which is by calling Item Tag Service).
|
Item Promotion Business 商品促销业务 | marketplace.listing.item.itemaggregation.iteminfo.get_product_info | marketplace.listing.itemtagservice.querying_api.get_item_labels | According to Listing Tag team, we can call marketplace.listing.itemtagservice.querying_api.get_item_labels if we only need item-level label data. Therefore in this project, we will call get_item_labels API instead. 根据列表标签团队的说法,如果我们只需要商品级别的标签数据,可以调用 marketplace.listing.itemtagservice.querying_api.get_item_labels。因此在这个项目中,我们将调用 get_item_labels API。 |
According to Listing team:
根据列表团队:
We can give out a new doc to clarify the usage and differences of IIB and IAS next week(before 10 Jan). And before that point, I think u can choose IAS for all scenarios if possible.
我们可以在下周(1 月 10 号之前)发布一份新文档来阐明 IIB 和 IAS 的使用方法和区别。在那之前,我认为如果可能的话,你可以选择使用 IAS 处理所有场景。
Therefore we should implement the IAS+ITS solution in this project for IPB service, by default.
因此,我们应在此项目中为 IPB 服务默认实施 IAS+ITS 解决方案。
Estimated QPS: refer to Section above: Expected QPS From Clients + Traffic Type
预计每秒请求数(QPS):参考上方:来自客户端的预期 QPS + 流量类型
Since the estimated QPS is expected to be small, we won't be caching IAS & ITS response in this phase.
由于预计的 QPS 较小,在本阶段我们不会缓存 IAS & ITS 的响应。
We should consider caching the data only when we find it's necessary in the future.
我们应在未来发现有必要时再考虑缓存数据。
The diagram below explains the query logic for IAS & ITS to calculate Price After Voucher:
下面的图表解释了 IAS 和 ITS 如何计算使用优惠券后的价格:
点击此处展开...
ACK: 确认:
- Listing - Ping He / deming.zhong@shopee.com
商品信息 - Ping He / deming.zhong@shopee.com - Listing Tag - chendong.ma@shopee.com / mingqin.tan@shopee.com
商品标签 - chendong.ma@shopee.com / mingqin.tan@shopee.com
2.2.9. Rebate Calculation
2.2.9. 折扣计算
In this project, there is an update to the calculation formula of rebate rate (field name: rebate.rate
).
在此项目中,折扣率的计算公式(字段名: rebate.rate
)有更新。
Previously in the Price Advisor Project, rebate rate is calculated by:
在价格顾问项目中,折扣率是通过以下方式计算的:
total_rebate = product_promo_rebate + shop_voucher_rebate + platform_voucher_rebate total_rebate_rate = 1e5 * (total_rebate / final_price_without_adding_back_rebate) |
This formula can cause inconsistencies for scenes where we're adding back the rebate to the final price.
此公式可能导致在将返利加回最终价格的场景中产生不一致。
点击此处展开...
given: --- seller_price = 100 (price with rebate) rebate = 10 buyer_price = seller_price - rebate buyer_price = 90 (price without rebate -> stored in Price DB) shop_voucher_discount = 5 shop_voucher_rebate = 0 need_to_add_back_rebate_to_price = TRUE (e.g. seller flow) --- final_price = min( 0 , buyer_price - shop_voucher_discount - platform_voucher_discount) + rebate final_price = ( 90 - 5 ) + 10 final_price = 95 promotion_price = 90 (same as buyer_price) --- total_rebate_rate = 1e5 * (total_rebate / final_price_without_adding_back_rebate) total_rebate_rate = 1e5 * ( 10 / ( 95 - 10 )) total_rebate_rate = 1e5 * ( 10 / 85 ) -> // we never return this 85 value in any field of the response, why are we using it here? |
After discussion with Price/Calc PM, we received a confirmation so that we update the formula to be:
在与价格/计算产品经理讨论后,我们确认可以更新公式为:
total_rebate = product_promo_rebate + shop_voucher_rebate + platform_voucher_rebate total_rebate_rate = 1e5 * (total_rebate / final_price) // this can be with or without rebate, depending on the scene |
2.2.10. Rate Inflation & Precision
2.2.10. 汇率通胀与精度
In IPB response structure, we are returning fields called tax.rate
and rebate.rate
.
在 IPB 响应结构中,我们返回了名为 tax.rate
和 rebate.rate
的字段。
Following the common (and existing) style of rate calculation, IPB will return the rate value inflated by 1e5 (multiplied by 100,000).
遵循常见的(现有的)利率计算风格,IPB 将返回的利率值会膨胀 1e5(乘以 100,000)。
In this case 100% will be 100,000, and 50% will be 50,000.
在这种情况下,100%将是 100,000,50%将是 50,000。
This way, clients can freely decide how to round the values (up to 3 decimal points).
这样,客户端可以自由决定如何四舍五入这些值(最多保留三位小数)。
For reference, existing Price (e.g. price.business), Discount and Voucher services also follow this pattern.
参考而言,现有的价格(例如 price.business)、折扣和代金券服务也遵循此模式。
2.2.11. Tax Rate Calculation
2.2.11. 税率计算
Tax rate calculation follows the implementation in Price Advisor project, which is also an existing formula since 2023.
税率计算遵循价格顾问项目中的实现,这也是自 2023 年以来现有的公式。
tax_rate = 1e5 * (tax_value / pre_tax_price) |
3. Internal Technical Design - Item Promotion Business
3. 内部技术设计 - 商品促销业务
Create a new Item Promotion Business to serve as a long-term replacement for Price Central Service, as the next step towards the new Calculation Architecture.
创建一个新的商品促销业务,作为价格中央服务长期替代方案,也是迈向新计算架构的下一步。
3.1.1. Entities 3.1.1. 实体
The core of IPB's scenario management lies in the scene entity.
IPB 场景管理的核心在于场景实体。
This scene is linked to a scenario (a predefined configuration), and a client (client information).
该场景链接到一个场景(预定义的配置),以及一个客户端(客户端信息)。
This scene may contain scene / flow-specific configurations which may differ from client-to-client, and scenario-to-scenario.
此场景可能包含场景/流程特定的配置,这些配置可能因客户而异,也可能因场景而异。
3.1.2. Scenario Management
3.1.2. 场景管理
3.1.2.1. Responsibility and Long Term Plan
3.1.2.1. 职责和长期计划
The table below defines the responsibility of each entity in the proposed scene management design.
下表定义了在拟议的场景管理设计中每个实体的职责。
Client 客户 | Scenario 场景 | Exclusion Rule 排除规则 | Scene 场景 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Responsibility 责任 | Describe the list of clients calling IPB. 描述调用 IPB 的客户端列表。 The client is not restricted to a logical client service or team. 客户端不限于逻辑客户端服务或团队。 A service may have more than 1 client ID if they have a different use-case. 如果有不同的用例,一个服务可以有多个客户端 ID。 | Describe the preconfigured settings or templates that can be applied to handle clients' needs. The configs should handle:
| Describe the preconfigured exclusion logic that can be applied for clients' use cases. | Describes custom settings to be applied to a specific client x scenario (e.g. use-case or flow-level configurations). The configs should handle:
| ||||||||
Configurations 配置 |
|
|
|
| ||||||||
Long Term Comparison 长期比较 | - | Maroon: long-term (will not be introduced in this phase). Click here to expand... 点击此处展开...
| - | Maroon: long-term (will not be introduced in this phase). Click here to expand... 点击此处展开...
|
Not in this scope: 不在本范围内:
- Settlement Price 结算价格
- Settlement price: considering that this is not a promotion to display, I feel that this deserves a separate API.
结算价格:考虑到这不是一个用于展示的促销活动,我认为这值得一个单独的 API。
- Settlement price: considering that this is not a promotion to display, I feel that this deserves a separate API.
- Membership Offer Price 会员优惠价格
- TBC: need to double-check the use case, whether it's necessary to introduce.
TBC:需要再次确认用例,是否需要引入。
- TBC: need to double-check the use case, whether it's necessary to introduce.
- Flash Sale Page's preview info
闪购页面的预览信息- If we need custom logic for FS page (e.g. for their preview-display), we should introduce it on IPB's client instead.
如果我们需要为闪购页面定制逻辑(例如,用于预览显示),我们应该在 IPB 客户端上引入它。
As much as possible, IPB should handle requests in a uniform, general way of calculation.
尽可能让 IPB 以统一、通用的方式处理请求计算。
IPB can still return FS information (based on filters & sorting & applicability check if required) if applicable to the current logic.
如果适用,IPB 仍然可以根据当前逻辑返回 FS 信息(基于过滤器、排序和适用性检查)。
- If we need custom logic for FS page (e.g. for their preview-display), we should introduce it on IPB's client instead.
Can be discussed: 可以讨论:
- Should we place purchase-limit (apply / don't apply) in scene, or scenario?
我们应该在场景还是场景中放置购买限制(应用/不应用)?- This depends on how we see this in the future.
这取决于我们未来如何看待这个问题。- Do we want to automatically apply PL for logged-in-users?
我们是否希望对登录用户自动应用 PL? - Do we consider purchase-limit as a calculation style?
我们是否将购买限额视为一种计算方式? - Do we want non-promotion configurations to be bound to our Scenario?
我们是否希望非促销配置绑定到我们的场景?
- Do we want to automatically apply PL for logged-in-users?
- This depends on how we see this in the future.
3.1.2.2. (Long-Term) Existing Scenarios - Config Mapping
3.1.2.2. (长期)现有场景 - 配置映射
The section below describes the scenario configs we're planning to add for existing scenarios.
以下部分描述了我们计划为现有场景添加的场景配置。
Note that we will only add existing scenarios & scenes (#0 - #7) into account, and will consider the rest as long-term considerations only.
注意,我们只考虑现有的场景和场景(#0 - #7),其余的只作为长期考虑。
We should revisit each scene's requirements again when we are doing the migration of each respective clients to ensure feature details accuracy.
在进行每个相应客户端的迁移时,我们应该再次审查每个场景的需求,以确保功能细节的准确性。
3.1.2.2.1. Scenarios 3.1.2.2.1. 场景
Scenario ID 场景 ID | Scenario Name 场景名称 | Configuration 配置 | Scenes 场景 | ||
---|---|---|---|---|---|
Scenario ID | Scenario Name | Configuration | Scenes | ||
0 | Template 模板 |
template Expand source
| - | ||
1 | Buyer - Default 买家 - 默认 |
Expand source
|
*to be double checked 需要二次确认 | ||
X | Buyer - Default (with GMV Logic) 买家 - 默认(含 GMV 逻辑) |
Expand source
|
*to be double checked 需要二次确认 | ||
2 | Buyer - Non-user-exclusive 买家 - 非用户专属 |
Expand source
|
| ||
3 | - | We don't need to differentiate by scenario as it's identical to Buyer - Non-user-exclusive. 我们不需要按场景区分,因为它是与买家 - 非用户专属相同的。 | |||
4 | Seller - Default 卖家 - 默认 |
Expand source
|
*in the future, S2S will also have voucher applied. | ||
5 | Buyer - Login Mode with Session-based LS Eligibility 买家 - 基于会话的 LS 资格登录模式 |
Expand source
|
| ||
6 | Buyer - Login Mode with Session-based LS Eligibility (with GMV Logic) 买家 - 基于会话的 LS 资格登录模式(含 GMV 逻辑) |
Expand source
|
| ||
7 | Buyer - Login Mode with Strict, Coexisting Teaser Promo |
Expand source
|
*double check requirements | ||
8 | Buyer - Login Mode with Strict, Coexisting Teaser Promo (with GMV Logic) 买家 - 严格登录模式,共存预告促销(含 GMV 逻辑) |
Expand source
|
*double check requirements |
3.1.2.2.2. Scenes 3.1.2.2.2. 场景
Scene ID 场景 ID | Scene Name 场景名称 | Configuration 配置 | Scenario Name 场景名称 | ||
---|---|---|---|---|---|
Scene ID 场景 ID | Scene Name 场景名称 | Configuration | Scenario Name | ||
0 | Template 模板 |
Expand source
| - | ||
1 | MPI CSPU (Buyer) MPI CSPU(买家) |
Expand source
| Buyer - Non-user-exclusive 买家 - 非用户专属 | ||
2 | SLS Future Price SLS 未来价格 |
Expand source
| Buyer - Non-user-exclusive 买家 - 非用户专属 | ||
3 | Price Advisor - S2S 价格顾问 - S2S |
Expand source
| Seller - Default 卖家 - 默认 | ||
4 | Price Advisor - CSPU (Seller) 价格顾问 - CSPU(卖家) |
Expand source
| Seller - Default 卖家 - 默认 | ||
5 | Shop Chat 购物聊天 |
Expand source
| Buyer - Default 买家 - 默认 | ||
6 | Shop Chatbot 店铺聊天机器人 |
Expand source
| Buyer - Default 买家 - 默认 | ||
7 | Video AI Chat 视频 AI 聊天 |
Expand source
| Buyer - Default 买家 - 默认 | ||
8 | Item Card - SRP 商品卡片 - SRP |
Expand source
|
| ||
9 | Item Card - Live Streaming 商品卡片 - 直播 |
Expand source
在我们将 LS 迁移到 IPB 之前,需要进行一轮检查。 On some flows, LS actually requires model-level data (even when their display is item-level). 在某些流程中,LS 实际上需要模型级别的数据(即使它们的显示是商品级别的)。 This is because they have some model-level related logic (e.g. for their cron-job, or for determining which item is considered an LS item). 这是因为它们有一些与模型级别相关的逻辑(例如,用于它们的定时任务,或用于确定哪个项目被视为 LS 项目)。
One solution is by introducing a concept called post-calculation-filter where we apply the filter after a certain calculation instead of before. |
| ||
10 | Live Streaming - Streamer 直播 - 主播 |
Expand source
|
| ||
11 | Item Card - Flash Sale 商品卡片 - 限时抢购 |
Expand source
| Buyer - Default 买家 - 默认 | ||
12 | PDP - Main Page 产品详情页 - 主页 |
Expand source
| Buyer - Default 买家 - 默认 | ||
13 | PDP - ATC Panel 商品详情页 - 自动调价面板 |
Expand source
| Buyer - Default 买家 - 默认 | ||
14 | Cart Page 购物车页面 |
Expand source
| Buyer - Default 买家 - 默认 | ||
15 | Cart Page - Guest 购物车页面 - 游客 |
Expand source
| Buyer - Non-user-exclusive 买家 - 非用户专属 | ||
16 | Checkout Page 结账页面 |
Expand source
| Buyer - Default 买家 - 默认 |
3.1.3. Impacted Business Modules
3.1.3. 影响的业务模块
Price Business 价格业务 | Item Promotion Business 商品促销业务 | |
---|---|---|
Breakdown 拆分 |
|
|
3.1.3.1. Item Display Promo - Consideration
3.1.3.1. 商品展示促销 - 考虑因素
On we received an inquiry on whether it is feasible to include Item Display Promo calculation in this phase.
我们收到一个询问,关于是否在本阶段包含商品展示促销计算是否可行。
Below is the effort analysis:
以下是工作量分析:
- TD
- Additional 1-3 days of design and discussions (e.g. to reach a good long-term design)
额外 1-3 天的设计和讨论时间(例如,以达到良好的长期设计)
- Additional 1-3 days of design and discussions (e.g. to reach a good long-term design)
- Item Display Promo - 6-7 days
商品展示促销 - 6-7 天- GMV-based 基于 GMV
- Add GMV cache logic in IPB - 4 days
在 IPB 中添加 GMV 缓存逻辑 - 4 天- Code change in IPB IPB 中的代码更改
- Code change in GMV cache cron-job
GMV 缓存计划任务中的代码更改
- Add GMV cache logic in IPB - 4 days
- Promo Priority-based - 2-3 days
基于促销优先级的 - 2-3 天
- GMV-based 基于 GMV
3.1.4. Long Term Proto 3.1.4.长期原型
Snippet (under discussion): https://git.garena.com/-/snippets/4454
提示(讨论中):https://git.garena.com/-/snippets/4454
3.1.5. Overview Diagram 3.1.5. 概述图
点击此处展开...
3.1.6. Tax Value & Rate Calculation
3.1.6. 税值与税率计算
In this project, we're changing the data source of tax rate and value calculation.
在这个项目中,我们正在更改税率和值计算的来源。
Previously in price.central
, these values are calculated by calling TaxRateCalculator.
之前在 price.central
中,这些值是通过调用 TaxRateCalculator 来计算的。
However, since this value and rate is already calculated in price.basic, we're going to reuse the existing calculation result and return them in IPB (instead of creating a new implementation / calculation logic in IPB which is redundant).
然而,由于这个值和税率已经在 price.basic 中计算过了,我们将重用现有的计算结果,并在 IPB 中返回它们(而不是在 IPB 中创建新的实现/计算逻辑,这是多余的)。
3.1.7. AB Testing Design 3.1.7. A/B 测试设计
We will be doing an AB Test in this project to measure the impact of the Price Standardization project (in the current phase).
我们将在该项目中进行 A/B 测试,以衡量价格标准化项目(当前阶段)的影响。
To perform this we can do either of these AB Testing solution
为了进行这项测试,我们可以选择以下 A/B 测试解决方案之一
- Client-side AB Testing 客户端 A/B 测试
This should lead to the most accurate AB Testing result, as the client gets to determine whether to call the old flow or new flow (IPB) based on AB Testing.
这应该能得出最准确的 A/B 测试结果,因为客户端可以根据 A/B 测试决定是否调用旧流程或新流程(IPB)。
However this is not ideal as we have several clients, and thus it has additional cost to maintain the AB Testing phase.
然而,这对于我们有多个客户来说并不理想,因此维护 A/B 测试阶段会产生额外的成本。 - Server-side AB Testing
服务器端 A/B 测试
As an alternative, we can get IPB to implement the AB Testing logic instead.
作为另一种选择,我们可以让 IPB 实现 A/B 测试逻辑。
This will not be 100% comparable to the old vs. new flow, but we can simulate the comparison by enabling / disabling the price-after-voucher feature of IPB through AB-Testing.
这将无法与旧流程和新流程完全比较,但我们可以通过启用/禁用 IPB 的价格-优惠券功能来进行 A/B 测试来模拟比较。
This is because before this Price Standardization project, the price value that clients obtain are price without voucher.
这是因为在此价格标准化项目之前,客户获得的价格值是没有优惠券的价格。
3.1.7.1. Control 3.1.7.1. 控制
Control: The AB Test will be controlled through the AB Testing platform.
控制:AB 测试将通过 AB 测试平台进行控制。
On top of the AB Testing platform, we will only enable the AB Testing logic based on scene configurations (not all scenes will have AB-T logic).
除了 AB 测试平台之外,我们只将基于场景配置启用 AB 测试逻辑(并非所有场景都将有 AB-T 逻辑)。
By default, scenes that are not included in the AB-T will always have price-after-voucher enabled.
默认情况下,未包含在 AB-T 中的场景将始终启用价格-优惠券功能。
3.1.7.2. ABT Configs 3.1.7.2. ABT 配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | { "ab_test_scene_experiment_map" : { "Price_Standardization" : { "Price_Standardization_v2" : {} } }, "ab_test_experiment_parse_func_name_map" :{ "Price_Standardization_v2" : "price_after_voucher" }, "sdk_config" :{ "ab_test_config" : { "project_keys" : [ "Promotion" ], "scene_keys" : [ "Price_Standardization" ], "interval_in_minutes" : 1 }, "disable_ab_test" : false } } |
3.1.7.3. Scene Configs 3.1.7.3. 场景配置
Note: should be enabled on scene 5 and 6 (Shop Chat & Shop Chat Bot).
注意:应在场景 5 和 6(店铺聊天 & 店铺聊天机器人)上启用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | { "scene_map": { "5": { "id": 5, "client_id": 5, "scenario_id": 1, "promotion": { "product_promotion": { "price_exclusion_rule_id": 0, "model_display_promo_info": { "need_model_main_promo": true } }, "voucher": { "voucher_bypass_validation_id": 0, "downgraded_shop_voucher_pool_id": 0, "downgraded_platform_voucher_pool_id": 0 } }, "stock": { "need_stock": true }, "listing": { "voucher_item_param_query_mode": "call-ias-and-its" }, + "ab_test": { + "include_in_ab_test": true + }, "downgrade": { "propagate_error_when_final_price_related_dependency_fails": true } }, "...": "..." } } |
3.1.8. Cache Design 3.1.8. 缓存设计
In Phase 0 of this project, we will not add any cache layer to the promotion info that we calculate.
在此项目的第一阶段,我们将不会为计算出的促销信息添加任何缓存层。
点击此处展开...
3.1.8.1. Summary
In Phase 0 of this project, we will not add any cache layer to the promotion info that we calculate.
We should add the cache in a separate phase, where we also introduce a new price pipeline which handles the responsibility of clean-wsa-cache from both price and stock services (however it purges IPB cache instead of PBI).
This is to align with our principle, where the cache owner should also own the logic for the entire cache lifecycle (which includes the pipeline for the cache purging mechanism).
Since we're expecting low-to-medium QPS in the early Phases, we will reuse PBS existing cache resources (cluster).
We will follow PBI's caching pattern in IPB, meaning we will cache price-stock data as a single structure while purging based on cache purger's cycle.
Note: this pattern is intended for display flows. When we are going to serve order flow in the future, we should make adjustments to the API call so that we bypass price-stock cache.
Why do we need to cache stock data?
This is because we want to reduce the amount of API calls from IPB → PBS, which potentially reduces CPU usage by avoiding unnecessary API response unmarshalling process.
Why do we combine price+stock data and cache this combined data instead?
This is because in IPB, we handle data in terms of Promo-info which is essentially made up of (product promo) price+stock+sold out info.
The product promo price should be the main unit, while the stock and sold-out-info is something that is bound to the product promo price (everything follows the product promo price).
We can look into splitting the cache when necessary in the future (e.g. for extendability purposes).
To implement cache on IPB, we'll need several phases of changes.
The phase is virtually named as 0.0, 0.1, and 0.2, but we can freely rename the phase or combine with an ongoing project phase (e.g. together with adding more features to IPB) whenever necessary.
3.1.8.2. Phase 0 (No Cache)
3.1.8.2.1. Overview
In the initial Phase 0, we will not add any cache to IPB.
3.1.8.3. Phase 0.1 (price-stock-cache)
- Implement price-stock-cache in IPB
- Create a new cache-purging endpoint (API) in IPB
- → calculation.item_promotion_business.delete_price_stock_cache
- Develop new cache-purging pipeline to purge IPB cache
- → pricepipeline-cleanipbpricestockcache
- Integrate with Cache Purger
3.1.8.3.1. Overview
Cache Purger integration guide:
Benefits of cache purger:
- Broadcasts cache purging API logic to multiple IDCs
- Acts as an additional layer of debounce
Estimated latency impact after cache purger implementation: https://grafana.shopee.io/d/PovMzMAMk/live-wsa-cache-purge-rate-alert?orgId=2&viewPanel=72
After Phase 0, we should introduce price-stock cache to IPB:
At this phase, Calculation should also take control of the cache purge cycle by integrating with cache purger.
3.1.8.3.2. Cache Purging
To purge the cache, we should introduce a new price-pipeline which is called clean-ipb-price-stock-cache which consumes the messages consumed by price and stock's clean-wsa-cache pipeline.
Basically, it's a combination of price and stock clean-wsa-cache.
This is designed so that Calculation can take over the ownership of clean-wsa-cache, to ensure that we have full control of the cache's purging cycle.
3.1.8.4. Phase 0.2 (pso + price-stock-cache) - Long Term
- Implement price-sold-out-info in IPB
- Create a new cache-purging endpoint (API) in IPB
- → calculation.item_promotion_business.delete_price_sold_out_info_cache
- Develop new cache-purging pipeline to purge IPB cache
- → pricepipeline-cleanipbpricesoldoutinfocache
- Integrate with Cache Purger
- Deprecate PBS cache
- → this should be reviewed again when we have migrated PBS clients away from PBS.
- Deprecate PBI & PBI cache
- → this should be reviewed again when we have migrated PBI clients away from PBI
3.1.8.4.1. Summary
This second phase is to extend a new price sold out info cache in IPB.
The purpose of this cache is to minimize the cost of querying stock data when it's not necessary.
Currently, price calculation requires sold-out-info for its promo selection / sorting logic.
Therefore, we can add a price-sold-out-info cache in IPB to reduce the amount of times we need to unmarshal stock data (which can be big if it has many breakdowns) when calling stock API / querying from the cache.
When do we need this: We should add this new price sold out info cache when we observe that there are more and more clients who only require price data without stock.
If this is only a small amount, then adding the new cache doesn't have much benefit.
Query Patterns:
Client only needs Price | Client needs Price + Stock | Client is part of order flow | |
---|---|---|---|
Flow |
|
|
|
3.1.8.4.2. Cache Purging
We should introduce a new pipeline and integrate with cache purger for purging the price-sold-out-info cache.
3.1.9. Circuit Breaker Design
3.1.9. 断路器设计
To support Voucher's automatic downgrade behavior mechanism, Item Promotion Business should support a custom circuit breaker logic for Voucher.
为了支持优惠券的自动降级行为机制,商品促销业务应支持针对优惠券的自定义断路器逻辑。
Logic: 逻辑:
- Voucher API circuit breaker should be calculated per Cmd-Scene_id instead of per Cmd name only.
优惠券 API 断路器应该按 Cmd-场景_id 计算,而不仅仅是按 Cmd 名称计算。 - When the circuit breaker triggers for Voucher API in any of the scenes, Voucher API should enter downgraded mode.
当断路器在任何场景中触发时,优惠券 API 应进入降级模式。 - When downgraded, IPB will pass the downgraded_voucher_pool of each respective scenarios as configured.
当降级时,IPB 将根据配置将每个相应场景的 downgraded_voucher_pool 传递。- If the downgraded_voucher_pools (shop and platform) are empty, skip Voucher API call.
如果降级优惠券池(商店和平台)为空,则跳过优惠券 API 调用。
- If the downgraded_voucher_pools (shop and platform) are empty, skip Voucher API call.
This way, when any of the scenes has an abnormal error / latency rate, we can do partial downgrade by (for example) not calling Voucher (by emptying the downgraded voucher pool) for item card scenario.
这样,当任何场景出现异常错误/延迟率时,我们可以通过(例如)不调用优惠券(通过清空降级优惠券池)来对商品卡片场景进行部分降级。
This capability must be added before we introduce a high-QPS client to IPB service.
在我们引入高 QPS 客户到 IPB 服务之前,必须添加此功能。
This requirement is a nice-to-have and shouldn't block this project.
此需求是锦上添花,不应阻塞此项目。
Update: this feature will not be implemented in this phase due to time constraints.
更新:由于时间限制,此功能在本阶段不会实施。
3.1.10. Downgrade Design 3.1.10. 降级设计
In the future, we might have clients who prefer data accuracy compared to API availability.
在未来,我们可能会有客户更倾向于数据准确性而不是 API 可用性。
To support this requirement, we will introduce a scene-level toggle called propagate_error_when_final_price_related_dependency_fails
to determine whether IPB should return error when any of the final price related dependencies fail (returns error).
为了支持这一需求,我们将引入一个场景级别的开关 propagate_error_when_final_price_related_dependency_fails
,以确定当任何最终价格相关的依赖项失败时,IPB 是否应返回错误(返回错误)。
Note that when the feature is downgraded instead (e.g. price-after-voucher is downgraded in BR and TW) → we will not do any special handling (if the API call is skipped due to the downgrade → then we'll simply skip them and return price before voucher).
注意,如果功能被降级(例如,在巴西和台湾地区,价格-优惠券被降级)→ 我们将不会进行任何特殊处理(如果由于降级而跳过 API 调用→ 那么我们将简单地跳过它们并返回优惠券前的价格)。
3.1.11. Config Design 3.1.11. 配置设计
Configs which need to be introduced to IPB:
需要引入到 IPB 的配置:
- batch_limit → batch_size_management
- calculation_scenario → split
计算场景 → 分割- scenario_management 场景管理
- scene_management 场景管理
- client_management 客户管理
- circuit_breaker 断路器
- dependency_api_timeout 依赖 API 超时
- gas.cache gas 缓存
- gas.engine gas 引擎
- gas.log 日志记录
- gas.shark 鲨鱼
- gas.spex.client 气体特惠客户端
- gas.spex.server 气体特惠服务器
- monitoring 监控
- enabled_metrics_map 启用指标映射
- enabled_edge_case_reporting
启用边缘情况报告
- price_business_downgrade_config → downgrade_management
价格业务降级配置 → 降级管理 - price_stock_soldout_config + remote_cache_config → cache_management (e.g. for TTL)
price_stock_soldout_config + remote_cache_config → cache_management (例如用于 TTL) - rebate_management
3.1.12. Concurrency Design
3.1.12. 并发设计
When implementing the concurrency logic for EP / WP / LS eligibility check, we should look into integrating with https://git.garena.com/shopee/common/concurrency.
在实现 EP / WP / LS 资格检查的并发逻辑时,我们应该考虑与 https://git.garena.com/shopee/common/concurrency 集成。
This should potentially lead to a cleaner interface when trying to parallelize dependency API calls.
这可能会在尝试并行化依赖 API 调用时带来一个更清晰的界面。
Update: this will not be implemented in this phase due to time constraints.
更新:由于时间限制,本阶段不会实施此功能。
3.1.13. Package Design 3.1.13. 软件包设计
- config 配置
- deploy 部署
- dm 管理员
- aggregator 聚合器
- Contains the main logic to aggregate / query / calculate data for processor response.
包含用于聚合/查询/计算处理器响应的主要逻辑。 - factory 工厂
- Creates factory components / factories.
创建工厂组件/工厂。
- Creates factory components / factories.
- result_builder 结果构建器
- Builds the result of an aggregator.
构建聚合器的结果
- Builds the result of an aggregator.
- Contains the main logic to aggregate / query / calculate data for processor response.
- business 商业
- Contains business logic. Should call service layer instead of directly calling dependencies.
包含业务逻辑。应该调用服务层而不是直接调用依赖项。
- Contains business logic. Should call service layer instead of directly calling dependencies.
- data 数据
- Contains intermediate structures / Data Transfer Objects.
包含中间结构 / 数据传输对象。 - converter 转换器
- For conversion of data package (if necessary).
用于数据套餐转换(如有必要)。
- For conversion of data package (if necessary).
- Contains intermediate structures / Data Transfer Objects.
- aggregator 聚合器
- docs 文档
- etc 等等
- logs 日志
- middleware 中间件
- circuit_breaker 电路断路器
- interceptor 拦截器
- E.g. Custom SPEX server / client interceptors.
例如定制的 SPEX 服务器/客户端拦截器。
- E.g. Custom SPEX server / client interceptors.
- mock 模拟
- mod 模块
- GAS module.go GAS 模块.go
- processor 处理器
- API entry point, simple validations and error handling.
API 入口,简单的验证和错误处理。
- API entry point, simple validations and error handling.
- scripts 脚本
- service 服务
- ab_test A/B 测试
- cache 缓存
- cron_job 定时任务
- health_check 健康检查
- http
- monitoring 监控
- rpc 远程过程调用
- templates 模板
- E.g. for generating documents, boilerplate code, etc.
例如,用于生成文档、样板代码等。
- E.g. for generating documents, boilerplate code, etc.
- utils 工具
- Should only contain low-level utilities.
应仅包含低级实用工具。
Should not depend on config, data, or any other internal packages.
不应依赖于配置、数据或任何其他内部包。
- Should only contain low-level utilities.
4. Internal Technical Design - Price Business
4. 内部技术设计 - 价格业务
In the long run, PBS serves as the aggregator / mixer for price & stock data and its query logic.
从长远来看,PBS 作为价格和库存数据的聚合器/混合器,其查询逻辑。
Therefore it should only expose price and stock information necessarily.
因此它应该只暴露必要的价格和库存信息。
Metrics: we should expose a feature metric to show how many % of our QPS needs stock API query.
指标:我们应该暴露一个功能指标来显示我们有多少百分比的 QPS 需要库存 API 查询。
If this percentage low, we can consider some optimizations such as letting PBS expose price stock sold out info (and then cache price+soldOutInfo on IPB to reduce price+stock queries).
如果这个百分比低,我们可以考虑一些优化措施,例如让 PBS 公开已售罄的价格信息(然后在 IPB 上缓存价格+已售罄信息,以减少价格+库存查询)。
4.1.1. API Design 4.1.1. API 设计
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | message GetPriceStockSoldOutInfoRequest { repeated uint64 item_ids = 1 ; optional StockQueryParams stock_query_params = 2 ; } message StockQueryParams { optional bool need_stock = 1 ; optional bool need_timeslot_stocks = 2 ; } message GetPriceStockSoldOutInfoResponse { optional string debug_msg = 1 ; optional ItemPriceStockSoldOutInfo items = 2 ; } message ItemPriceStockSoldOutInfo { optional uint64 item_id = 1 ; repeated PriceStockSoldOutInfo product_promotions = 2 ; // repeated PriceStockSoldOutInfo package_promotions = 3; // repeated SettlementPriceInfo settlement_prices = 4; } message PriceStockSoldOutInfo { optional PriceInfo price = 1 ; optional StockInfo stock = 2 ; // optional SoldOutInfo sold_out_info = 3; // to be introduced in the long term design } message PriceInfo { optional int64 shop_id = 1 ; optional uint64 item_id = 2 ; optional uint64 model_id = 3 ; optional uint32 rule_type = 4 ; optional uint64 rule_id = 5 ; optional string region = 6 ; optional uint32 start_time = 7 ; optional uint32 end_time = 8 ; optional int64 price = 9 ; optional int64 price_before_tax = 10 ; optional int64 rebate = 11 ; optional int64 discount_snapshot_id = 12 ; optional int64 tax = 13 ; optional int64 tax_rate = 14 ; // optional uint32 purchase_limit = 10; } message StockInfo { optional int32 available_stock = 1 ; optional int32 reserved_stock = 2 ; repeated StockBreakdownByLocation stock_breakdowns = 3 ; optional bool has_timeslot = 4 ; repeated FlexibleTimeslotStock timeslot_stocks = 5 ; // optional uint32 stock_type = 3; // optional uint32 stock_out_time = 4; // optional int32 timeslot_live_stream_total_stocks = 8; // optional SKUDetail sku_details = 9; } //message SoldOutInfo { // optional bool has_available_stock = 1; // optional bool has_reserved_stock = 2; // optional bool has_available_taxable_stock = 3; // optional bool has_available_non_taxable_stock = 4; //} |
4.1.2. Cache Design 4.1.2. 缓存设计
Details 详细信息 | |
---|---|
Existing Flows in PBS PBS 中现有的流程 | No changes. 没有变化。 |
price.business.get_price_stock_sold_out_info |
|
Update: cache changes are not implemented in this phase due to time constraints.
更新:由于时间限制,此阶段未实现缓存更改。
5. Backward Compatibility
5. 向后兼容性
This is a new flow for our clients, so the change is backwards compatible.
这是一个面向我们客户的新流程,因此变更具有向后兼容性。
6. Dependency & Performance Implications
6. 依赖与性能影响
There should be additional cost which is proportional to the QPS of the new flows from Shop Chat and Video AI CHat.
新的 Shop Chat 和 Video AI Chat 流程应该会产生额外的成本,该成本与 QPS 成正比。
Refer to the Expected QPS From Clients section above.
请参考上述“来自客户的预期 QPS”部分。
7. Stress Test 压力测试
Nice to have (but not a blocker), and should be scheduled after the project is finished.
比较理想(但不是障碍),并且应该在项目完成后安排。
This is because we're expecting a low-to-medium QPS from our clients.
这是因为我们预计客户的 QPS(每秒请求数)将较低到中等。
8. Monitoring and Alert 8. 监控和警报
8.1. Performance Monitoring
8.1. 性能监控
We should create new metrics and dashboards for Item Promotion Business service. (not a blocker)
我们应该为商品推广业务服务创建新的指标和仪表板。(不是障碍)
Aside from that, we should add more metrics based on the new scene management framework (e.g. metrics based on scene_id).
此外,我们应该根据新的场景管理框架添加更多指标(例如基于场景_id 的指标)。
8.1.1. Business Metrics 8.1.1. 业务指标
Metric Name 指标名称 | Purpose 目的 | |
---|---|---|
Metric Name | Purpose | |
1 | pbs_api_call_without_stock_requirement_request_count 无库存需求请求次数 |
|
2 | QPS of requests per scene, with labels including:
|
8.2. Data Correctness Monitoring
8.2. 数据正确性监控
We should integrate Item Promotion Business with API verification. (not a blocker)
我们应该将商品促销业务与 API 验证集成。(不是障碍)
9. Deployment 9. 部署
9.1. Deliverables 9.1. 可交付成果
9.1.1. Task Breakdown 9.1.1. 任务分解
Service 服务 | Task 任务 | Dev Effort* 开发工作量* | QA Effort* 质量保证工作* | JIRA | |
---|---|---|---|---|---|
Service 服务 | Task 任务 | Dev Effort* 开发工作量* | QA Effort* 测试工作量* | JIRA | |
1 | Item Promotion Business 商品推广业务 |
| Main: 8d - 11d 主要:8d - 11d Total: 12d - 15d 总计:12d - 15d |
SPPT-112480 - Jira issue doesn't exist or you don't have permission to view it.
| |
2 | Price Business 价格业务 |
| Main: 3d - 4d 主要:3 天 - 4 天 Total: 5d - 6d 总计:5 天 - 6 天 |
SPPT-112479 - Jira issue doesn't exist or you don't have permission to view it.
| |
3 | API Verification - Price Business API 验证 - 价格业务 |
| 0.5d - 1d 0.5 天 - 1 天 |
SPPT-112481 - Jira issue doesn't exist or you don't have permission to view it.
|
*Estimate in days 估计天数
9.1.2. Total Effort Estimation
9.1.2. 总工作量估计
PIC | Effort 工作量 | Remarks 备注 |
---|---|---|
PIC | Effort 工作量 | Remarks 备注 |
| Main: 11d - 15d 主要:11 天 - 15 天 | |
TBC | Y days 多久 | QA testing 测试 |
9.1.3. Tickets 票据
type 类型 | key 键 | summary 摘要 | assignee 指派 | reporter 报告 | priority 优先级 | status 状态 | resolution 解决方案 | created 创建 | updated 已更新 | due 即将 |
---|---|---|---|---|---|---|---|---|---|---|
Jira project doesn't exist or you don't have permission to view it.
查看这些 Jira 问题 |
9.2. Deployment Sequence 部署顺序 9.2
- PBS deployment PBS 部署
- IPB deployment IPB 部署
- Client deployment 客户端部署
9.3. Rollback Plan 9.3. 回滚计划
Client must have a fallback logic when IPB returns an error.
客户必须在 IPB 返回错误时具有回退逻辑。
For full compatibility, clients need to rollback first before IPB does rollback.
为了完全兼容,客户需要在 IPB 回滚之前先进行回滚。
Another alternative is they can toggle off their feature when IPB is rolled back.
另一种替代方案是,当 IPB 回滚时,他们可以关闭他们的功能。
Acknowledgements 致谢
Team 团队 | PIC | Sign-off 签署 | |
---|---|---|---|
Team 团队 | PIC | Sign-off 签收 | |
1 | Price 价格 | krishna.kannan 克里希那·坎南 |
|
2 | Price 价格 | yin.yuan 银元 |
|
Risk Assessment 风险评估
Risk level 风险等级 | MEDIUM |
---|---|
Detail 详情 | This project 这个项目
|
Risks 风险 | Wrong price value. 价格值错误。 |
Detection 检测 | Price value in some pages are wrong 一些页面的价格值是错误的 |
Prevention 预防 |
|
Mitigation 缓解 |
|
RC & Sign-off RC & 最终批准 |
|
junbang.tan@shopee.com 喜欢这个
- No labels 无标签
- Edit Labels 编辑标签
- ChangeLog 变更日志
- Background 背景
- Abbreviations:
- Related Documents:
- Product Requirements:
- Technical Requirements:
- 1. System Overview 1. 系统概述
- 2. Cross Team Technical Design
2. 跨团队技术设计 - 2.1. Definitions
- 2.1.1. Item Promotion Business Service
- 2.2. Solution
- 2.2.1. Requirements Summary
- 2.2.2. Overview Diagram
- 2.2.3. API Design
- 2.2.3.1. Namespace
- 2.2.3.2. Expected QPS From Clients + Traffic Type (Response Required)
- 2.2.3.3. Estimated QPS to Dependencies
- 2.2.3.4. Constants
- 2.2.3.5. Request
- 2.2.3.5.1. Optional Fields (Response Required)
- 2.2.3.5.2. Sample
- 2.2.3.6. Response
- 2.2.3.6.1. Sample
- 2.2.4. Error Flow
- 2.2.4.1. Accuracy vs. Availability (Response Required)
- 2.2.5. Downgrade Flow
- 2.2.6. Scenario Settings
- 2.2.6.1. Summary
- 2.2.6.2. Eligibility Check
- 2.2.7. Voucher Information
- 2.2.7.1. Requirements
- 2.2.7.2. Request Parameters
- 2.2.8. Listing + Label Information
- 2.2.9. Rebate Calculation
- 2.2.10. Rate Inflation & Precision
- 2.2.11. Tax Rate Calculation
- 3. Internal Technical Design - Item Promotion Business
3. 内部技术设计 - 商品推广业务 - 3.1.1. Entities
- 3.1.2. Scenario Management
- 3.1.2.1. Responsibility and Long Term Plan
- 3.1.2.2. (Long-Term) Existing Scenarios - Config Mapping
- 3.1.2.2.1. Scenarios
- 3.1.2.2.2. Scenes
- 3.1.3. Impacted Business Modules
- 3.1.3.1. Item Display Promo - Consideration
- 3.1.4. Long Term Proto
- 3.1.5. Overview Diagram
- 3.1.6. Tax Value & Rate Calculation
- 3.1.7. AB Testing Design
- 3.1.7.1. Control
- 3.1.7.2. ABT Configs
- 3.1.7.3. Scene Configs
- 3.1.8. Cache Design
- 3.1.8.1. Summary
- 3.1.8.2. Phase 0 (No Cache)
- 3.1.8.2.1. Overview
- 3.1.8.3. Phase 0.1 (price-stock-cache)
- 3.1.8.3.1. Overview
- 3.1.8.3.2. Cache Purging
- 3.1.8.4. Phase 0.2 (pso + price-stock-cache) - Long Term
- 3.1.8.4.1. Summary
- 3.1.8.4.2. Cache Purging
- 3.1.9. Circuit Breaker Design
- 3.1.10. Downgrade Design
- 3.1.11. Config Design
- 3.1.12. Concurrency Design
- 3.1.13. Package Design
- 4. Internal Technical Design - Price Business
4. 内部技术设计 - 价格业务 - 4.1.1. API Design
- 4.1.2. Cache Design
- 5. Backward Compatibility
5. 向后兼容性 - 6. Dependency & Performance Implications
6. 依赖关系与性能影响 - 7. Stress Test 压力测试
- 8. Monitoring and Alert
监控和警报 - 8.1. Performance Monitoring
- 8.1.1. Business Metrics
- 8.2. Data Correctness Monitoring
- 9. Deployment 部署
- 9.1. Deliverables
- 9.1.1. Task Breakdown
- 9.1.2. Total Effort Estimation
- 9.1.3. Tickets
- 9.2. Deployment Sequence
- 9.3. Rollback Plan
- Acknowledgements 致谢
- Risk Assessment 风险评估
noptovius.halimawan@shopee.com
Things to add to TD:
需要添加到 TD 的内容:
v rebate formula (denominator stuff)
v 退款公式(分母部分)
v "_rate" formatting (inflated by 1e5)
v "_rate" 格式(增加了 1e5)
v tax formula 税费公式
* overview diagram (we remove some calculators)
* 概览图(我们移除了一些计算器)
** weak promoe ** 弱促销
** timeslot recalculation
** 时间段重新计算
** tax rate data source
**税率数据源
* tax rate comes from PBS
*税率来自 PBS
* propagate error no longer fails during downgrade for tw and br compatibility purposes
*在向下兼容 tw 和 br 的目的下,传播错误不再失败
* API permission links *API 权限链接
* ab-test strategy * A/B 测试策略
* voucher flag during downgrade
* 降级期间的优惠券标志
* cross-feature interactions
* 跨功能交互
** timeslot recalculation
** 时间段重新计算
** weak promotion recalculation
** 弱推广重新计算
* Downgrades (EP, WP, LS)
* 降级(EP,WP,LS)
* Update voucher information -> request parameters
* 更新优惠券信息 -> 请求参数
* fix error in listing + label information
* 修复商品列表错误 + 标签信息
* circuit breaker 断路器
* downgrade_design 降级设计
* common/concurrency - no time
常用/并发 - 无时间
* PBS design - update
PBS 设计 - 更新
* stock filter logic * 库存过滤逻辑
Checklist: 清单:
* add metrics board * 添加指标看板
* price-core * 价格核心