工会关系人员
This commit is contained in:
@@ -1,22 +1,15 @@
|
||||
package io.v.nutz.base.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.v.nutz.base.enums.Env;
|
||||
import io.v.nutz.web.commons.base.Globals;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.http.Http;
|
||||
import org.nutz.integration.jedis.RedisService;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,7 +27,7 @@ public class MsgApi {
|
||||
/**
|
||||
* token -redis - name
|
||||
*/
|
||||
private static final String msgTokenName = "msg_token";
|
||||
private static final String MSG_TOKEN_NAME = "msg_token";
|
||||
|
||||
private static final String APP_KEY = "10c51794-45b8-4de5-ba6f-b1ed843c20f3";
|
||||
private static final String APP_SECRET = "4acbf17e-4b17-4c47-b4bb-1576a066250a";
|
||||
@@ -52,7 +45,7 @@ public class MsgApi {
|
||||
|
||||
/**
|
||||
* @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 )
|
||||
* @param loginNames
|
||||
* @param loginNames 字符串,多个工号用英文逗号分隔 ","
|
||||
* @param mtype 消息类型; 0: 图文 1: 文字 2: 外链
|
||||
* @param title 标题
|
||||
* @param content 内容
|
||||
@@ -114,14 +107,14 @@ public class MsgApi {
|
||||
* @return
|
||||
*/
|
||||
private String getMsgToken() {
|
||||
String token = redisService.get(msgTokenName);
|
||||
String token = redisService.get(MSG_TOKEN_NAME);
|
||||
if (StrUtil.isBlank(token)) {
|
||||
String body = HttpRequest.post(TOKEN_API + "?appKey=" + APP_KEY + "&appSecret=" + APP_SECRET).execute().body();
|
||||
NutMap map = Json.fromJson(NutMap.class, body);
|
||||
if (map.getInt("code") == 200) {
|
||||
NutMap data = Json.fromJson(NutMap.class, map.getString("data"));
|
||||
token = data.getString("accessToken");
|
||||
redisService.setex(msgTokenName, 3600, token);
|
||||
redisService.setex(MSG_TOKEN_NAME, 3600, token);
|
||||
} else {
|
||||
token = "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user