|
|
|
@ -62,9 +62,11 @@ public class ShortServerOpenApiController {
|
|
|
|
|
ThreadLocalUtil.set(CUSTOMER_IP_ADDR_KEY, SystemConstant.DEFAULT_IP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 参数不存在的时候,给一个标识,来缩短短链
|
|
|
|
|
// 参数不存在的时候,给一个标识,来缩短短链,该种短链只能代表一个长网址
|
|
|
|
|
if (CollectionUtil.isEmpty(shortChainRequestVO.getVariableList())){
|
|
|
|
|
shortChainDTO = shortServerService.handleOriginUrlsToShortUrls(shortChainDTO, true);
|
|
|
|
|
}else {
|
|
|
|
|
shortChainDTO = shortServerService.handleOriginUrlsToShortUrls(shortChainDTO, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -77,8 +79,13 @@ public class ShortServerOpenApiController {
|
|
|
|
|
return CommonResponse.createBySuccess(shortChainResponseVO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* modify by q , 修改短链前面的 /s/ 符号,节省短链字符
|
|
|
|
|
* @param redeem
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("短链接兑换长链接并进行")
|
|
|
|
|
@GetMapping(value = "/s/{redeem}")
|
|
|
|
|
@GetMapping(value = "/{redeem}")
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
public ModelAndView redeemShortChainClick(@PathVariable("redeem") String redeem) {
|
|
|
|
|
log.info("=== [ShortServerOpenApiController|redeemShortChainClick, one request is coming, request param is {} ] ===", redeem);
|
|
|
|
@ -99,7 +106,8 @@ public class ShortServerOpenApiController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("redirect:" + originUrl);
|
|
|
|
|
// return new ModelAndView("redirect:" + originUrl);
|
|
|
|
|
return new ModelAndView(new RedirectView(originUrl,true,false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation("用于测试转发")
|
|
|
|
@ -108,7 +116,8 @@ public class ShortServerOpenApiController {
|
|
|
|
|
@Deprecated
|
|
|
|
|
public ModelAndView testRedirect(@PathVariable("redeem") String redeem) {
|
|
|
|
|
System.out.println(redeem);
|
|
|
|
|
return new ModelAndView(new RedirectView("http://www.baidu.com"));
|
|
|
|
|
|
|
|
|
|
return new ModelAndView(new RedirectView("https://www.baidu.com",true,false));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|