jekins 推送测试

This commit is contained in:
Leo
2023-12-14 17:38:03 +08:00
parent 79706cd57f
commit 01d252f1fe
3 changed files with 61 additions and 6 deletions

View File

@@ -190,11 +190,7 @@ public class WXController {
@RateLimiter(time = 5, count = 60)
public R sendToJD(HttpServletRequest request, @RequestBody MessageRequest message) throws Exception {
logger.info("message 打印---{}",JSON.toJSONString(message));
String vanToken = request.getHeader("vanToken");
if (StrUtil.isEmpty(vanToken)) {
return R.error("vanToken为空");
}
if (!TokenUtil.checkToken(vanToken)) {
if (!TokenUtil.checkToken(message.getVanToken())) {
return R.error("vanToken无效");
}
String source = request.getHeader("source");
@@ -204,7 +200,6 @@ public class WXController {
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
return R.error("缺少标题和内容");
}
logger.info("vanToken 打印---{}",vanToken);
logger.info("source 打印---{}",source);
String sourceForQL = SourceForQLUtil.transferSource(source);
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {

View 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);
// }

View File

@@ -15,6 +15,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;