Skip to content

Commit

Permalink
Merge pull request #17 from BingChunMoLi/release-v3.3.4
Browse files Browse the repository at this point in the history
Release v3.3.4
  • Loading branch information
BingChunMoLi authored Dec 17, 2021
2 parents 403e3a6 + 5c1d77e commit d45669c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<groupId>com.bingchunmoli</groupId>
<artifactId>moliapi</artifactId>
<version>3.3.3</version>
<version>3.3.4</version>
<name>MoLiApi</name>
<description>MoLiApi</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public ResultVO<String> httpRequestMethodNotSupportedException(HttpRequestMethod

@ExceptionHandler
public ResultVO<String> defaultException(Exception e) {
log.error(e.getMessage());
log.error("defaultException: {}, msg: {}", e, e.getMessage());
e.printStackTrace();
return new ResultVO<>(CodeEnum.FAILURE.getCode(), CodeEnum.FAILURE.getMsg(), "默认未分类异常");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bingchunmoli.api.tencent.controller;


import com.bingchunmoli.api.exception.ApiParamException;
import com.bingchunmoli.api.tencent.bean.enums.QQSizeEnum;
import com.bingchunmoli.api.tencent.bean.enums.QZSizeEnum;
import com.bingchunmoli.api.tencent.service.IQqService;
Expand All @@ -22,17 +23,16 @@
@Slf4j
@RestController
@RequestMapping("tencent")
public class QQController {
public class QqController {
@Resource
private IQqService qqService;

@ApiOperation("返回QQ头像")
@GetMapping(value = "qq", produces = MediaType.IMAGE_JPEG_VALUE)
@CrossOrigin
public BufferedImage getQqImage(String qq, @RequestParam(required = false, defaultValue = "140") Integer size) {
if (size <= 0) {
log.debug("非法参数值 负数");
return null;
throw new ApiParamException("非法参数值 负数");
}
if (isQqImageSize(size)) {
return qqService.getQqImage(qq, size);
Expand All @@ -44,7 +44,6 @@ public BufferedImage getQqImage(String qq, @RequestParam(required = false, defau

@ApiOperation("返回QQ空间头像")
@GetMapping(value = "qz", produces = MediaType.IMAGE_JPEG_VALUE)
@CrossOrigin
public BufferedImage getQzImage(String qq, @RequestParam(required = false, defaultValue = "100") Integer size) {
if (size <= 0) {
return null;
Expand All @@ -58,7 +57,6 @@ public BufferedImage getQzImage(String qq, @RequestParam(required = false, defau

@ApiOperation("返回JSON的QQ头像地址,加密")
@GetMapping("qq/json")
@CrossOrigin
public String getQqImageForJson(String qq, @RequestParam(required = false, defaultValue = "100") Integer size) {
if (size <= 0) {
return "没有这样的尺寸";
Expand All @@ -72,15 +70,13 @@ public String getQqImageForJson(String qq, @RequestParam(required = false, defau

@ApiOperation("返回JSON的QQ空间头像地址")
@GetMapping("qz/json")
@CrossOrigin
public String getQzImageForJson(String qq) {
return qqService.getQzImageForJson(qq);
}

@ApiOperation("返回加密的QQ头像地址")
@GetMapping("qq/json/encrypt")
@PostMapping("qq/json/encrypt")
@CrossOrigin
public String getQqImageForJsonEncrypt(String qq, @RequestParam(required = false, defaultValue = "100") Integer size) {
if (size <= 0) {
return "没有这样的尺寸";
Expand All @@ -95,7 +91,6 @@ public String getQqImageForJsonEncrypt(String qq, @RequestParam(required = false
@ApiOperation("返回加密的QQ头像")
@GetMapping(value = "qq/encrypt", produces = MediaType.IMAGE_JPEG_VALUE)
@PostMapping(value = "qq/encrypt", produces = MediaType.IMAGE_JPEG_VALUE)
@CrossOrigin
public BufferedImage getQqImageForEncrypt(String qq, @RequestParam(required = false, defaultValue = "100") Integer size) {
if (size <= 0) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
public class QqServiceImpl implements IQqService {

@Override
@Cacheable("getQqImage")
public BufferedImage getQqImage(String qq, Integer size) {
try {
return ImageIO.read(new URL("https://q1.qlogo.cn/g?b=qq&nk=" + qq + "&s=" + size));
Expand All @@ -51,7 +50,6 @@ public BufferedImage getQqImage(String qq, Integer size) {
}

@Override
@Cacheable("getQzImage")
public BufferedImage getQzImage(String qq, Integer size) {
try {
return ImageIO.read(new URL("https://qlogo1.store.qq.com/qzone/" + qq + "/" + qq + "/" + size));
Expand Down

0 comments on commit d45669c

Please sign in to comment.