diff --git a/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java b/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java index a7fa29a..d79ef7f 100644 --- a/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java +++ b/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java @@ -10,6 +10,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; +import java.util.Map; + @RestController class AuthenticationController { @@ -91,5 +94,19 @@ class AuthenticationController { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } + @PostMapping("/sendVerificationCode") + public ResponseEntity> sendVerificationCode(@RequestBody Map request) { + String contactInfo = request.get("contactInfo"); +// TODO:发送验证码功能有待添加。 boolean isSent = userService.sendVerificationCode(contactInfo); + boolean isSent = true; + if (isSent) { + HashMap response = new HashMap<>(); + response.put("code", 1234); + return new ResponseEntity<>(response, HttpStatus.OK); + } else { + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } + } + }