Commit 63db275af1b016238bd659d12f0e1d15ee4a4072
1 parent
772b7943
✨ MALL:默认异步记录商品访问日志、访问次数
Showing
2 changed files
with
5 additions
and
0 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/history/ProductBrowseHistoryService.java
| ... | ... | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.service.history; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.product.controller.admin.history.vo.ProductBrowseHistoryPageReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.product.dal.dataobject.history.ProductBrowseHistoryDO; |
| 6 | +import org.springframework.scheduling.annotation.Async; | |
| 6 | 7 | |
| 7 | 8 | import java.util.Collection; |
| 8 | 9 | |
| ... | ... | @@ -20,6 +21,7 @@ public interface ProductBrowseHistoryService { |
| 20 | 21 | * @param spuId SPU 编号 |
| 21 | 22 | * @return 编号 |
| 22 | 23 | */ |
| 24 | + @Async | |
| 23 | 25 | Long createBrowseHistory(Long userId, Long spuId); |
| 24 | 26 | |
| 25 | 27 | /** | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuService.java
| ... | ... | @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRe |
| 6 | 6 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 7 | 7 | |
| 8 | 8 | import jakarta.validation.Valid; |
| 9 | +import org.springframework.scheduling.annotation.Async; | |
| 10 | + | |
| 9 | 11 | import java.util.Collection; |
| 10 | 12 | import java.util.List; |
| 11 | 13 | import java.util.Map; |
| ... | ... | @@ -154,6 +156,7 @@ public interface ProductSpuService { |
| 154 | 156 | * @param id 商品 SPU 编号 |
| 155 | 157 | * @param incrCount 增加的数量 |
| 156 | 158 | */ |
| 159 | + @Async | |
| 157 | 160 | void updateBrowseCount(Long id, int incrCount); |
| 158 | 161 | |
| 159 | 162 | } | ... | ... |