This commit is contained in:
Paidax
2025-02-25 10:54:05 +08:00
parent 3b9ca77374
commit f42c8c52d0
53 changed files with 2128 additions and 391 deletions
+40 -40
View File
@@ -58,46 +58,46 @@ public class MsgApi {
*/
public void sendMsg(List<String> channels, String loginNameStr, Integer mtype, String title, String content, String imageUrl,String link) {
try {
// if (!Globals.MyConfig.getBoolean("SendMsg")) {
// log.info("发送失败,消息暂未开启!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
// return;
// }
//
// if (Globals.isEnv(Env.dev)) {
// log.info("开发模式不允许发送短信!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
// return;
// }
//
// if (StrUtil.isBlank(title)||StrUtil.isBlank(content) ||Lang.isEmpty(channels) || Lang.isEmpty(loginNameStr)) {
// log.info("发送失败,缺少需要参数请检查!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
// return;
// }
//
// String msgToken = getMsgToken();
// NutMap map = new NutMap();
// map.put("channel", String.join(",", channels));
// //推送范围(1:普通模式;2:全体教师;3:全体学生;4:全体人员)
// map.put("objScope", 1);
// map.put("objIds", loginNameStr);
// map.put("mtype", mtype);
// map.put("sendStatus", 1);
// map.put("title", title);
// map.put("content", content);
// map.put("imageUrl", imageUrl);
// map.put("link", link);
//
// HttpRequest request = HttpUtil.createPost(MSG_API)
// .header("token", msgToken)
// .body(Json.toJson(map));
// JSONObject jsonObject = JSON.parseObject(request.execute().body());
// int status = jsonObject.getInteger("code");
//
// if (status == 200) {
// log.info("发送成功>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
// } else {
// log.info("发送失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
// throw new RuntimeException("Message sending failed with status code: " + status + ", Message: " + jsonObject.getString("message"));
// }
/*if (!Globals.MyConfig.getBoolean("SendMsg")) {
log.info("发送失败,消息暂未开启!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return;
}
if (Globals.isEnv(Env.dev)) {
log.info("开发模式不允许发送短信!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return;
}
if (StrUtil.isBlank(title)||StrUtil.isBlank(content) ||Lang.isEmpty(channels) || Lang.isEmpty(loginNameStr)) {
log.info("发送失败,缺少需要参数请检查!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
return;
}
String msgToken = getMsgToken();
NutMap map = new NutMap();
map.put("channel", String.join(",", channels));
//推送范围(1:普通模式;2:全体教师;3:全体学生;4:全体人员)
map.put("objScope", 1);
map.put("objIds", loginNameStr);
map.put("mtype", mtype);
map.put("sendStatus", 1);
map.put("title", title);
map.put("content", content);
map.put("imageUrl", imageUrl);
map.put("link", link);
HttpRequest request = HttpUtil.createPost(MSG_API)
.header("token", msgToken)
.body(Json.toJson(map));
JSONObject jsonObject = JSON.parseObject(request.execute().body());
int status = jsonObject.getInteger("code");
if (status == 200) {
log.info("发送成功>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
} else {
log.info("发送失败>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
throw new RuntimeException("Message sending failed with status code: " + status + ", Message: " + jsonObject.getString("message"));
}*/
} catch (Exception e) {
e.printStackTrace();
}