mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 23:31:52 +08:00
商品:用户未登录时,不记录商品浏览记录
This commit is contained in:
parent
9c341be4ae
commit
0944584029
@ -27,6 +27,11 @@ public class ProductBrowseHistoryServiceImpl implements ProductBrowseHistoryServ
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createBrowseHistory(Long userId, Long spuId) {
|
public Long createBrowseHistory(Long userId, Long spuId) {
|
||||||
|
// 用户未登录时不记录
|
||||||
|
if (userId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 情况一:同一个商品,只保留最新的一条记录
|
// 情况一:同一个商品,只保留最新的一条记录
|
||||||
ProductBrowseHistoryDO historyDO = browseHistoryMapper.selectOne(ProductBrowseHistoryDO::getUserId, userId, ProductBrowseHistoryDO::getSpuId, spuId);
|
ProductBrowseHistoryDO historyDO = browseHistoryMapper.selectOne(ProductBrowseHistoryDO::getUserId, userId, ProductBrowseHistoryDO::getSpuId, spuId);
|
||||||
if (historyDO != null) {
|
if (historyDO != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user