jekins 推送测试
This commit is contained in:
@@ -5,17 +5,17 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
import cn.van333.wxsend.aop.annotation.RateLimiter;
|
||||||
import cn.van333.wxsend.business.model.R;
|
import cn.van333.wxsend.business.model.R;
|
||||||
import cn.van333.wxsend.business.service.LogService;
|
import cn.van333.wxsend.business.service.LogService;
|
||||||
import cn.van333.wxsend.config.TokenUtil;
|
import cn.van333.wxsend.util.TokenUtil;
|
||||||
import cn.van333.wxsend.enums.WXMessageType;
|
import cn.van333.wxsend.enums.WXMessageType;
|
||||||
import cn.van333.wxsend.util.WxSendUtil;
|
import cn.van333.wxsend.util.WxSendUtil;
|
||||||
import cn.van333.wxsend.util.request.MessageRequest;
|
import cn.van333.wxsend.util.request.MessageRequest;
|
||||||
|
import cn.van333.wxsend.util.SourceForQLUtil;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.Enumeration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Leo
|
* @author Leo
|
||||||
@@ -71,14 +71,22 @@ public class WXController {
|
|||||||
if (!TokenUtil.checkToken(vanToken)) {
|
if (!TokenUtil.checkToken(vanToken)) {
|
||||||
return R.error("vanToken无效");
|
return R.error("vanToken无效");
|
||||||
}
|
}
|
||||||
|
String source = request.getHeader("source");
|
||||||
|
if (StrUtil.isEmpty(source)) {
|
||||||
|
return R.error("来源为空");
|
||||||
|
}
|
||||||
|
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
||||||
|
return R.error("缺少标题和内容");
|
||||||
|
}
|
||||||
logger.info("vanToken 打印---{}",vanToken);
|
logger.info("vanToken 打印---{}",vanToken);
|
||||||
//if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
logger.info("source 打印---{}",source);
|
||||||
// return R.error("缺少标题和内容");
|
String sourceForQL = SourceForQLUtil.transferSource(source);
|
||||||
//}
|
if (!StrUtil.isAllNotEmpty(message.getTitle(), message.getText())) {
|
||||||
//String result = WxSendUtil.sendNotify(message.getTitle(), message.getText(), message.getTouser(), WXMessageType.QL);
|
return R.error("缺少标题和内容");
|
||||||
//return R.ok(result);
|
}
|
||||||
|
String result = WxSendUtil.sendNotify("("+sourceForQL+") "+message.getTitle(), message.getText(), message.getTouser(), WXMessageType.QL);
|
||||||
|
return R.ok(result);
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/send/qh")
|
@RequestMapping(value = "/send/qh")
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cn.van333.wxsend.config;
|
package cn.van333.wxsend.util;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
Reference in New Issue
Block a user