jekins 推送测试
This commit is contained in:
@@ -190,11 +190,7 @@ public class WXController {
|
|||||||
@RateLimiter(time = 5, count = 60)
|
@RateLimiter(time = 5, count = 60)
|
||||||
public R sendToJD(HttpServletRequest request, @RequestBody MessageRequest message) throws Exception {
|
public R sendToJD(HttpServletRequest request, @RequestBody MessageRequest message) throws Exception {
|
||||||
logger.info("message 打印---{}",JSON.toJSONString(message));
|
logger.info("message 打印---{}",JSON.toJSONString(message));
|
||||||
String vanToken = request.getHeader("vanToken");
|
if (!TokenUtil.checkToken(message.getVanToken())) {
|
||||||
if (StrUtil.isEmpty(vanToken)) {
|
|
||||||
return R.error("vanToken为空");
|
|
||||||
}
|
|
||||||
if (!TokenUtil.checkToken(vanToken)) {
|
|
||||||
return R.error("vanToken无效");
|
return R.error("vanToken无效");
|
||||||
}
|
}
|
||||||
String source = request.getHeader("source");
|
String source = request.getHeader("source");
|
||||||
@@ -204,7 +200,6 @@ public class WXController {
|
|||||||
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
||||||
return R.error("缺少标题和内容");
|
return R.error("缺少标题和内容");
|
||||||
}
|
}
|
||||||
logger.info("vanToken 打印---{}",vanToken);
|
|
||||||
logger.info("source 打印---{}",source);
|
logger.info("source 打印---{}",source);
|
||||||
String sourceForQL = SourceForQLUtil.transferSource(source);
|
String sourceForQL = SourceForQLUtil.transferSource(source);
|
||||||
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
||||||
|
|||||||
59
src/main/java/cn/van333/wxsend/business/test1.java
Normal file
59
src/main/java/cn/van333/wxsend/business/test1.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
//package cn.van333.wxsend.business;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @author Leo
|
||||||
|
// * @version 1.0
|
||||||
|
// * @create 2023/11/22 0022 下午 01:49
|
||||||
|
// * @description:
|
||||||
|
// */
|
||||||
|
///**
|
||||||
|
// * https://www.hxm5.com/t/2065908 线报抓取
|
||||||
|
// *
|
||||||
|
// * @param url
|
||||||
|
// * @return Quartet<String, String, List < String>,List<String>> 标题 内容 图片 超链接
|
||||||
|
// */
|
||||||
|
//public static Quartet<String, String, List<String>, List<String>> getShoppingTipInfo(String url) {
|
||||||
|
// String title = null;
|
||||||
|
// StringBuilder content = new StringBuilder();
|
||||||
|
// ArrayList<String> imageUrl = Lists.newArrayList();
|
||||||
|
// ArrayList<String> hrefUrl = Lists.newArrayList();
|
||||||
|
// try {
|
||||||
|
// URI host = URLUtil.getHost(new URL(url));
|
||||||
|
// Document jsoupDocument = getJsoupDocument(HttpUtil.get(url));
|
||||||
|
// Element elementById = jsoupDocument.body().getElementById("topic-desc");
|
||||||
|
// title = elementById.children().select("h1").text();
|
||||||
|
// // content in <p> element
|
||||||
|
// Elements elementsContents = elementById.children().select("p");
|
||||||
|
// for (Element elementsContent : elementsContents) {
|
||||||
|
// for (Node pChild : elementsContent.childNodes()) {
|
||||||
|
// if (pChild instanceof TextNode) {
|
||||||
|
// content.append(((TextNode) pChild).text());
|
||||||
|
// Node preNode = pChild.previousSibling();
|
||||||
|
// if (!(preNode instanceof TextNode)) {
|
||||||
|
// content.append(StringUtils.LF);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (pChild instanceof Element) {
|
||||||
|
// if (((Element) pChild).is("a")) { // a href url
|
||||||
|
// String href = host + pChild.attr("href");
|
||||||
|
// Request.Builder request = getRequestBuilder(href);
|
||||||
|
// request.removeHeader("Host");
|
||||||
|
// String resultJSJson = getOkHttp().newCall(request.build()).execute().request().url().toString();// Direct url
|
||||||
|
// content.append(resultJSJson);
|
||||||
|
// hrefUrl.add(href);
|
||||||
|
// content.append(StringUtils.LF);
|
||||||
|
// }
|
||||||
|
// if (((Element) pChild).is("img")) { // image url
|
||||||
|
// String imageHref = pChild.attr("data-original");
|
||||||
|
// content.append(imageHref);
|
||||||
|
// imageUrl.add(imageHref);
|
||||||
|
// content.append(StringUtils.LF);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error(e.getMessage());
|
||||||
|
// }
|
||||||
|
// return Quartet.with(title, content.toString(), imageUrl, hrefUrl);
|
||||||
|
// }
|
||||||
@@ -15,6 +15,7 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user