53 lines
2.0 KiB
Java
53 lines
2.0 KiB
Java
|
package cn.bunny.services.controller;
|
|||
|
|
|||
|
import cn.bunny.dao.pojo.result.Result;
|
|||
|
import cn.bunny.dao.vo.financial.user.home.HomeVo;
|
|||
|
import cn.bunny.services.service.index.IndexService;
|
|||
|
import cn.hutool.captcha.CaptchaUtil;
|
|||
|
import cn.hutool.captcha.CircleCaptcha;
|
|||
|
import io.swagger.v3.oas.annotations.Operation;
|
|||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
|
import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
import org.springframework.http.HttpHeaders;
|
|||
|
import org.springframework.http.HttpStatus;
|
|||
|
import org.springframework.http.MediaType;
|
|||
|
import org.springframework.http.ResponseEntity;
|
|||
|
import org.springframework.web.bind.annotation.GetMapping;
|
|||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|||
|
import org.springframework.web.bind.annotation.RestController;
|
|||
|
import reactor.core.publisher.Mono;
|
|||
|
|
|||
|
@Tag(name = "访问首页内容", description = "访问首页内容相关接口")
|
|||
|
@RestController
|
|||
|
@RequestMapping("/")
|
|||
|
public class IndexController {
|
|||
|
|
|||
|
@Autowired
|
|||
|
private IndexService indexService;
|
|||
|
|
|||
|
@Operation(summary = "访问首页", description = "访问首页")
|
|||
|
@GetMapping("")
|
|||
|
public String index() {
|
|||
|
return "欢迎访问 Bunny Java Template,欢迎去Gitee:https://gitee.com/BunnyBoss/java_single.git";
|
|||
|
}
|
|||
|
|
|||
|
@Operation(summary = "首页内容展示", description = "首页内容展示")
|
|||
|
@GetMapping("admin/noManage/homeDatalist")
|
|||
|
public Mono<Result<HomeVo>> homeDatalist() {
|
|||
|
HomeVo homeVo = indexService.homeDatalist();
|
|||
|
return Mono.just(Result.success(homeVo));
|
|||
|
}
|
|||
|
|
|||
|
@Operation(summary = "生成验证码", description = "生成验证码")
|
|||
|
@GetMapping("noAuth/checkCode")
|
|||
|
public ResponseEntity<byte[]> checkCode() {
|
|||
|
HttpHeaders headers = new HttpHeaders();
|
|||
|
headers.setContentType(MediaType.IMAGE_JPEG);
|
|||
|
|
|||
|
// 生成验证码
|
|||
|
CircleCaptcha captcha = CaptchaUtil.createCircleCaptcha(150, 48, 4, 2);
|
|||
|
byte[] image = captcha.getImageBytes();
|
|||
|
|
|||
|
return new ResponseEntity<>(image, headers, HttpStatus.OK);
|
|||
|
}
|
|||
|
}
|