1.前端页面接入商品收藏接口,

2.暂时使用alert弹出框提示收藏和取消收藏,回头改成颜色显示效果
This commit is contained in:
xiaofeng
2019-07-09 23:54:36 +08:00
parent 1fa68d070b
commit 83d8bc4fab
6 changed files with 85 additions and 5 deletions

View File

@@ -39,8 +39,16 @@ public class UserFavoriteController {
@DeleteMapping("remove")
@RequiresLogin
@ApiOperation(value = "用户商品收藏-删除")
public CommonResult<Boolean> removeFavorite(@RequestParam("spuId") final Integer spuId) {
public CommonResult<Boolean> removeUserFavorite(@RequestParam("spuId") final Integer spuId) {
final Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userProductSpuCollectionsService.deleteUserProductSpuCollections(userId, spuId);
}
@GetMapping("hasUserFavorite")
@RequiresLogin
@ApiOperation(value = "用户商品收藏-是否收藏")
public CommonResult<Boolean> hasUserSpuFavorite(@RequestParam("spuId") final Integer spuId) {
final Integer userId = UserSecurityContextHolder.getContext().getUserId();
return userProductSpuCollectionsService.hasUserSpuFavorite(spuId, userId);
}
}