-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d7f91e
commit 8408864
Showing
7 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+427 KB
...ress/public/images/article/project/group-buy-market/group-buy-market-2-6-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+260 KB
...ress/public/images/article/project/group-buy-market/group-buy-market-2-6-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+203 KB
...ress/public/images/article/project/group-buy-market/group-buy-market-2-6-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: 【更】第2-6节:拆分库表关联关系 | ||
pay: https://t.zsxq.com/SisVe | ||
--- | ||
|
||
# 《拼团交易平台系统》第2-6节:拆分库表关联关系 | ||
|
||
作者:小傅哥 | ||
<br/>博客:[https://bugstack.cn](https://bugstack.cn) | ||
<br/>视频:[https://t.zsxq.com/MyFI0](https://t.zsxq.com/MyFI0) | ||
|
||
> 沉淀、分享、成长,让自己和他人都能有所收获!😄 | ||
大家好,我是技术UP主小傅哥。 | ||
|
||
有伙伴问,看视频写项目,能跟着完成,也能运行出结果。但怎样才算是真正的掌握了这个项目的内容呢? | ||
|
||
多年的工作经验,要想掌握一个项目,只听分享、只看视频、只看文档,都是不行的,这些都只能让你了解但不是深入。只要上手写代码,一行行的完成需求逻辑,才能算是真正的掌握了这个项目。 | ||
|
||
所以,趁着项目不大,本节我们设定一个作业。我会给你讲解诉求和需要改动的功能点,你可以按照这样的流程来做编码和调试。完成后,在继续跟进课程学习,比对代码。当然如果你目前还处于小白阶段,也可以直接跟着课程学习。 | ||
|
||
## 一、本章诉求 | ||
|
||
在系统开始之初,简化功能设计,让拼团活动配置表直接耦合商品ID。也就是一个拼团活动,只关联一个商品ID。那么如果现在需要给10个商品,全配置一个相同的拼团活动,就没法配置了。总不能一个个全配置一遍。所以本节要对这块的内容做拆分解耦。 | ||
|
||
<div align="center"> | ||
<img src="https://bugstack.cn/images/article/project/group-buy-market/group-buy-market-2-6-01.png" width="700px"> | ||
</div> | ||
|
||
- group_buy_activity 拼团活动配置表中,融合了渠道和商品ID,属于和活动配置绑定了。 | ||
- sku 商品信息,已经包含了渠道SC值和商品ID。而商品表咱们前面提到过,它是由接入方同步的商品信息,也可以不走这里,直接用 RPC/HTTP 接口查询数据,所以 sku 表不适合绑定互动ID。 | ||
- 那么,就需要一个新的表来关联活动和商品信息配置,表名为 sc_sku_activity 必备字段;SC渠道、活动ID、商品ID。(自己创建库表后可以和课程的库表对比) | ||
- 你可以根据这样的信息来创建你的库表,同时移除 group_buy_activity 表中 SC渠道值和商品ID。 | ||
|
||
## 二、业务流程 | ||
|
||
如图,整个改动流程的核心为让 MarketNode 节点的查询由原来方式改为先查询SC商品活动配置关联表,获得到活动ID,再查询活动信息。这期间如果有效的活动配置信息无,那么则走到 ErrorNode 节点,返回一个指定的错误码。 | ||
|
||
<div align="center"> | ||
<img src="https://bugstack.cn/images/article/project/group-buy-market/group-buy-market-2-6-02.png" width="700px"> | ||
</div> | ||
|
||
- 首先,你可以先通过如图的调用过程,理解本节要完成的编程动作。包括解耦后的新的库表关联关系。 | ||
- 之后,编码的时候异步多线程查询商品关联配置,如果配置的信息为空,或者不存在有效的活动,那么可以返回一个 null。当拿到null 以后,可以做判断进行路由,走到 ErrorNode 节点。「这部分代码一定自己尝试下,多思考。」 |
This file was deleted.
Oops, something went wrong.