You've already forked FrameTour-BE
jackson
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.ycwl.basic.notify.adapters;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.utils.JacksonUtil;
|
||||
import com.ycwl.basic.notify.entity.NotifyContent;
|
||||
import com.ycwl.basic.notify.entity.WxMpSrvConfig;
|
||||
|
||||
@@ -45,15 +45,16 @@ public class WxMpSrvNotifyAdapter implements INotifyAdapter{
|
||||
}
|
||||
String url = String.format(ACCESS_TOKEN_URL, config.getAppId(), config.getAppSecret());
|
||||
String response = HttpUtil.get(url);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response);
|
||||
ACCESS_TOKEN = jsonObject.getString("access_token");
|
||||
expireTime = new Date(System.currentTimeMillis() + jsonObject.getInteger("expires_in") * 1000);
|
||||
Map<String, Object> jsonObject = JacksonUtil.parseObject(response, Map.class);
|
||||
ACCESS_TOKEN = (String) jsonObject.get("access_token");
|
||||
Integer expiresIn = (Integer) jsonObject.get("expires_in");
|
||||
expireTime = new Date(System.currentTimeMillis() + (expiresIn != null ? expiresIn : 7200) * 1000);
|
||||
return ACCESS_TOKEN;
|
||||
}
|
||||
|
||||
public void sendServiceNotification(Map<String, Object> params) {
|
||||
String url = String.format(SEND_TEMPLATE_MESSAGE_URL, getAccessToken());
|
||||
String response = HttpUtil.post(url, JSONObject.toJSONString(params));
|
||||
String response = HttpUtil.post(url, JacksonUtil.toJSONString(params));
|
||||
System.out.println(response);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user