mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
feat: auto add http protocol head
This commit is contained in:
parent
c9b0cef1ea
commit
8bb2cd7f3f
@ -25,6 +25,9 @@ import java.util.List;
|
||||
@Service
|
||||
public class WebHookAlarmService implements Alarmable {
|
||||
|
||||
private static final String HTTP_PROTOCOL_PREFIX = "http://";
|
||||
private static final String HTTPS_PROTOCOL_PREFIX = "https://";
|
||||
|
||||
@Override
|
||||
public void onFailed(Alarm alarm, List<UserInfoDO> targetUserList) {
|
||||
if (CollectionUtils.isEmpty(targetUserList)) {
|
||||
@ -36,6 +39,11 @@ public class WebHookAlarmService implements Alarmable {
|
||||
return;
|
||||
}
|
||||
|
||||
// 自动添加协议头
|
||||
if (!webHook.startsWith(HTTP_PROTOCOL_PREFIX) && !webHook.startsWith(HTTPS_PROTOCOL_PREFIX)) {
|
||||
webHook = HTTP_PROTOCOL_PREFIX + webHook;
|
||||
}
|
||||
|
||||
MediaType jsonType = MediaType.parse(OmsConstant.JSON_MEDIA_TYPE);
|
||||
RequestBody requestBody = RequestBody.create(jsonType, JSONObject.toJSONString(alarm));
|
||||
|
||||
|
@ -15,6 +15,7 @@ public class ModifyUserInfoRequest {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
private String webHook;
|
||||
|
||||
// 手机号
|
||||
private String phone;
|
||||
|
Loading…
x
Reference in New Issue
Block a user