|
|
@@ -8,10 +8,7 @@ import cn.reghao.tnb.account.app.service.CodeService;
|
|
|
import cn.reghao.tnb.account.app.service.PubkeyService;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.MediaType;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
@@ -60,27 +57,4 @@ public class AccountCodeController {
|
|
|
Result result = codeService.sendVerifyCode(verifyCodeDto);
|
|
|
return WebResult.result(result);
|
|
|
}
|
|
|
-
|
|
|
- @Operation(summary = "头像", description = "N")
|
|
|
- @GetMapping(value = "/avatar.jpg", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- @Deprecated
|
|
|
- public ResponseEntity<byte[]> getAvatar() throws IOException {
|
|
|
- String avatarResource = "static/dist/images/face.jpg";
|
|
|
- InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(avatarResource);
|
|
|
- byte[] imageBytes = resourceAsStream.readAllBytes();
|
|
|
-
|
|
|
- /*URL resource = Thread.currentThread().getContextClassLoader().getResource(avatarResource);
|
|
|
- String avatarPath = resource.getPath();
|
|
|
- System.out.println(avatarPath);
|
|
|
- File file = new File(avatarPath);
|
|
|
- byte[] imageBytes = Files.readAllBytes(file.toPath());*/
|
|
|
-
|
|
|
- // 构建 HTTP 响应头
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.IMAGE_JPEG);
|
|
|
- headers.setContentLength(imageBytes.length);
|
|
|
-
|
|
|
- // 返回包含图片字节数组的 ResponseEntity
|
|
|
- return new ResponseEntity<>(imageBytes, headers, HttpStatus.OK);
|
|
|
- }
|
|
|
}
|