11package com .ligg .apiclient .controller ;
22
3+ import com .ligg .common .module .vo .FavoriteVo ;
34import com .ligg .common .constants .Constant ;
45import com .ligg .common .constants .UserConstant ;
56import com .ligg .common .enums .BusinessStates ;
3132import java .util .Objects ;
3233
3334/**
34- * @Author Ligg
35+ * @author Ligg
3536 * @time 2025/10/10
3637 * @update_time 2025/11/6 14:28
3738 **/
@@ -44,13 +45,10 @@ public class ClientUserController {
4445
4546 private final UserService userService ;
4647
47- private final ProductCommentService commentService ;
48-
4948 private final FileService fileService ;
5049
51- /**
52- * 获取用户信息
53- */
50+ private final ProductCommentService commentService ;
51+
5452 @ Operation (summary = "获取用户信息" )
5553 @ GetMapping ("/info" )
5654 public Response <UserInfoVo > getUserInfo () {
@@ -59,6 +57,7 @@ public Response<UserInfoVo> getUserInfo() {
5957 }
6058
6159 @ PutMapping
60+ @ Operation (summary = "更新用户信息" )
6261 public Response <String > updateUserInfo (@ Validated UserDto userDto ,
6362 MultipartFile avatarFile ) {
6463 if (avatarFile != null && !avatarFile .isEmpty () && Objects .requireNonNull (avatarFile .getContentType ()).startsWith ("image" )) {
@@ -75,9 +74,7 @@ public Response<String> updateUserInfo(@Validated UserDto userDto,
7574 : Response .success (BusinessStates .SUCCESS );
7675 }
7776
78- /**
79- * 发布商品评价
80- */
77+ @ Operation (summary = "发布商品评价" )
8178 @ PostMapping ("/comment" )
8279 public Response <String > publishComment (@ RequestParam (required = false ) MultipartFile [] imageFiles ,
8380 ProductCommentDto content ) {
@@ -104,9 +101,7 @@ public Response<String> publishComment(@RequestParam(required = false) Multipart
104101 }
105102
106103
107- /**
108- * 余额充值
109- */
104+ @ Operation (summary = "余额充值" )
110105 @ PatchMapping ("/recharge" )
111106 public Response <String > recharge (@ RequestBody PaymentDto payment ) {
112107 //金额是否小于0
@@ -129,4 +124,12 @@ public Response<String> productFavorite(@NotNull Long productId, @NotNull boolea
129124 ? Response .error (BusinessStates .INTERNAL_SERVER_ERROR )
130125 : Response .success (BusinessStates .SUCCESS );
131126 }
127+
128+ @ Operation (summary = "获取收藏商品" )
129+ @ GetMapping ("/favorite" )
130+ public Response <List <FavoriteVo >> getUserFavorite () {
131+ Map <String , Object > userInf = ThreadLocalUtil .get ();
132+ String userId = (String ) userInf .get (UserConstant .USER_ID );
133+ return Response .success (BusinessStates .SUCCESS , userService .getUserFavorite (userId ));
134+ }
132135}
0 commit comments