种子,促销

Change-Id: I0ce919ce4228dcefec26ef636bacd3298c0dc77a
diff --git a/src/main/java/com/example/myproject/controller/UserController.java b/src/main/java/com/example/myproject/controller/UserController.java
index 4bf6adf..acda403 100644
--- a/src/main/java/com/example/myproject/controller/UserController.java
+++ b/src/main/java/com/example/myproject/controller/UserController.java
@@ -1,16 +1,25 @@
 package com.example.myproject.controller;
 
+import cn.dev33.satoken.annotation.SaCheckLogin;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.example.myproject.common.base.PageUtil;
+import com.example.myproject.dto.param.TorrentParam;
+import com.example.myproject.dto.vo.TorrentVO;
+import com.example.myproject.entity.TorrentEntity;
 import com.example.myproject.mapper.UserMapper;
 import com.example.myproject.mapper.VerificationTokenMapper;
 import com.example.myproject.entity.User;
 import com.example.myproject.entity.VerificationToken;
 import com.example.myproject.service.EmailService;
 import com.example.myproject.service.UserService;
-import com.example.myproject.utils.Result;
+import com.example.myproject.common.base.Result;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -27,6 +36,7 @@
 import javax.annotation.Resource;
 import java.time.Instant;
 import java.time.temporal.ChronoUnit;
+import java.util.List;
 
 @RestController
 @RequestMapping("/user")
@@ -61,9 +71,9 @@
             User user = userMapper.selectOne(new QueryWrapper<User>().eq("username", username));
 
             System.out.println("Login successful for user: " + username);
-            return Result.success(user);
+            return Result.ok(user);
         } catch (AuthenticationException e) {
-            return Result.error("401", "登录失败:" + e.getMessage());
+            return Result.error("登录失败");
         }
     }
 
@@ -71,15 +81,15 @@
     @ApiOperation(value = "用户注册", notes = "使用用户信息进行注册")
     public Result registerController(@RequestBody @ApiParam(value = "新用户信息", required = true) User newUser) {
         if (userService.checkEmailExists(newUser.getEmail())) {
-            return Result.error("邮箱冲突", "邮箱已被使用,请使用其他邮箱注册或找回密码!");
+            return Result.error( "邮箱已被使用,请使用其他邮箱注册或找回密码!");
         }
         boolean success = userService.preRegisterUser(newUser);
         if (success) {
             User responseUser = new User();
             responseUser.setEmail(newUser.getEmail());
-            return Result.success(responseUser, "验证邮件已发送,请检查您的邮箱。");
+            return Result.ok();
         } else {
-            return Result.error("注册失败", "账号已存在或注册失败!");
+            return Result.error("账号已存在或注册失败!");
         }
     }
 
@@ -100,9 +110,9 @@
         String code = verificationRequest.getCode();
         boolean isVerified = userService.verifyEmail(email, code);
         if (isVerified) {
-            return Result.success(null, "邮箱验证成功!");
+            return Result.ok();
         } else {
-            return Result.error("验证失败", "验证码错误或已过期!");
+            return Result.error( "验证码错误或已过期!");
         }
     }
 
@@ -123,7 +133,7 @@
         if (user == null) {
             logger.error("未找到与该邮箱地址相关联的用户: {}", email);
             return ResponseEntity.status(HttpStatus.BAD_REQUEST)
-                    .body(Result.error("1","未找到与该邮箱地址相关联的用户"));
+                    .body(Result.error("未找到与该邮箱地址相关联的用户"));
         }
 
         // 生成验证码
@@ -139,15 +149,42 @@
         logger.info("验证令牌已保存,用户: {}", user.getUsername());
         emailService.sendVerificationEmail(email, token);
 
-        return ResponseEntity.ok(Result.success(200, "验证邮件已发送!"));
+        return ResponseEntity.ok(Result.ok());
     }
     @PostMapping("/checkPassword")
     public Result<String> checkPassword(@RequestParam Long userId, @RequestParam String password) {
         boolean isPasswordCorrect = userService.checkPassword(userId, password);
         if (isPasswordCorrect) {
-            return Result.success("200","原始密码输入正确");
+            return Result.ok();
         } else {
-            return Result.error("305","原始密码输入错误");
+            return Result.error("原始密码输入错误");
         }
     }
+
+
+//    @SaCheckLogin
+//    @Operation(summary = "用户收藏列表", description = "获取用户收藏的种子列表-分页-排序")
+//    @ApiResponse(responseCode = "0", description = "操作成功",
+//            content = {@Content(mediaType = "application/json",
+//                    schema = @Schema(implementation = TorrentVO.class))
+//            })
+//    @PostMapping("/favorite/list")
+//    public Result listFavorites(@RequestBody FavoriteParam param) {
+//        if (param.getUserId() == null) {
+//            return Result.error("缺少 userId");
+//        }
+//
+//        // 校验排序字段是否合理(可选)
+//        param.validOrder(param.getOrderKey(TorrentEntity.class));
+//
+//        PageUtil.startPage(param);
+//
+//        List<TorrentEntity> list = favoriteService.getUserFavoritesPaged(param.getUserId());
+//
+//        return Result.ok(list, PageUtil.getPage(list));
+//    }
+//
+
+
+
 }