Promotion Platform 2.0 Architecture Upgrade: Unified Promotion Model, Low‑Code Workflow, and Rule Engine
The Promotion Platform 2.0 upgrade replaces the fragmented 1.0 system with a unified promotion model, low‑code DSL‑driven workflow, and QLExpress rule engine, enabling rapid creation of diverse promotional tools, consistent pricing calculations, and high‑performance caching while preserving stability for the ACG e‑commerce ecosystem.
The article introduces the upgrade of the "会员购" promotion platform from version 1.0 to 2.0, aiming to support a growing variety of promotional activities while maintaining rapid delivery and system stability.
Background : The platform serves an e‑commerce ecosystem focused on ACG culture, offering diverse product categories (figures, publications, 3C, etc.) and multiple sales stages (pre‑sale, stock, crowdfunding). Existing promotional tools include coupons, price reductions, full‑refund promotions, and gameplay‑type activities.
2.0 Architecture Upgrade : The new architecture adopts a low‑code approach, defining a unified promotion model and a DSL‑driven workflow engine. This enables rapid addition of new promotional tools without extensive code changes.
Unified Promotion Model : The model is decomposed into six reusable component modules:
Time module – start, end, pre‑heat, award times.
User module – target audience, new‑user tags, CDP groups.
Product module – applicable categories, brands, item types.
Limit module – participation limits per user, period, or reward amount.
Rule module – purchase thresholds, priority rules.
Benefit module – price discount, free shipping, etc.
An example of a "seckill" promotion template is shown below:
{
"triggerAction":"购买中权益",
"timeConfig":{
"timeList":["开始时间","结束时间","预热时间","发奖时间"],
"recallStartTimeType":"预热时间",
"recallEndTimeType":"结束时间"
},
"userConfig":{
"newList":["会员购新用户","漫画新用户"],
"needCrowd":false
},
"itemscopeConfig":{
"scopeDimList":["类目","品牌"],
"cateList":["游戏3C数码","可动手办"],
"brandList":["万代"],
"itemsTypeList":["定金预售","现货"]
},
"limitConfig":{
"principal":["用户账号限次"],
"period":["天","周","终身"],
"traget":["累计奖励金额"]
},
"benefitRule":{
"rules":["ruleId1","ruleId2"],
"benefit":[
{"type":"价格立减","amount":300},
{"type":"包邮","delivery":true}
]
}
}Promotion data is cached in Redis with multi‑level and local caches to accelerate SKU/SPU‑level queries and reduce Redis load.
Domain Rule Engine : To handle the highly variable promotion rules, the platform evaluates conditions using QLExpress combined with a rule‑group parser. Compared with alternatives (Groovy, Drools, EasyRule), QLExpress offers a balance of performance and simplicity. The engine processes three core parts:
Rule condition definition – object and operator selection.
Rule condition – specific operator and right‑hand value.
Rule – a set of conditions combined with logical operators.
An example rule and its user context are illustrated:
{
"userRegisterTime":"2021-08-10 20:00:01.123",
"payTimes":10
}The rule "(register > 2021‑01‑01 && payTimes > 1) || (register > 2020‑01‑01 && payTimes > 5)" is parsed into four conditions and evaluated to a boolean result via QLExpress.
Unified Promotion Process : Previously, pricing calculations for promotions were scattered across product detail, cart, and checkout modules. The 2.0 platform consolidates all pricing queries and calculations into a common service, ensuring consistency across scenarios and simplifying rule updates.
Workflow Configuration (Low‑Code) : The platform introduces a DSL‑based workflow definition expressed in JSON, where each node represents an atomic operation (event handling, time handling, user handling, risk handling, benefit handling). Nodes are linked via a directed acyclic graph (DAG) and executed in parallel using a Disruptor ring buffer. A simplified seckill workflow example:
{
"startNode":"nodeA",
"excuteNodes":[
{"node":"nodeA","componentName":"EventHandler","nextNodeList":[{"result":"$.code=0","nextNode":"nodeB"},{"result":"$.code=0","nextNode":"nodeC"}]},
{"node":"nodeB","componentName":"TimeHandler"},
{"node":"nodeC","componentName":"UserHandler"},
{"node":"nodeD","componentName":"RiskHandler","accessRule":"nodeB.code==0 && nodeC.code==0","nextNodeList":[{"result":"$.code=0","nextNode":"nodeE"}]},
{"node":"nodeE","componentName":"BenefitHandler"}
]
}Conclusion : The 2.0 upgrade unifies the promotion model and process, builds reusable rule and workflow engines, and adopts low‑code principles to accelerate feature delivery while maintaining system stability. Future work will focus on pricing strategies, user‑profile‑driven promotions, and continuous architectural refinement.
Bilibili Tech
Provides introductions and tutorials on Bilibili-related technologies.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.