Commit ded133fc authored by renandong's avatar renandong 🇨🇳

1,处理冲突

parent 30d0f9bb
......@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HtmlUtil;
import cn.hutool.http.HttpException;
import cn.hutool.http.HttpRequest;
......@@ -19,6 +20,8 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -250,20 +253,35 @@ public class GeTuiUtils {
/**
* 【toSingle】执行别名单推
*
* @param alias 用户别名
* @param appId 应用id
* @param messageTemplate 消息模板
* @param messageTemplate 应用id
* @param appId 消息模板
* @param token 接口访问凭据
* @return 消息推送结果
*/
public static String singlePushAlias(String[] alias, String appId, MessageTemplate messageTemplate, String token) {
Map<String, Object> map = convertBeanToMap(alias, messageTemplate);
public static String singlePushAlias(Integer device, MessageTemplate messageTemplate, String appId, String token) throws UnsupportedEncodingException {
Map<String, Object> map = convertBeanToMap(device, false, 1, messageTemplate);
//请求url
String url = GE_TUI_BASE_URL + appId + "/push/single/alias";
log.info("执行别名单推");
return generalPost(url, token, map);
}
/**
* 【toSingle】执行cid单推
*
* @param appId appId
* @param messageTemplate 消息
* @param token 鉴权
* @return 执行结果
*/
public static String singlePushCid(Integer device, String appId, MessageTemplate messageTemplate, String token) throws UnsupportedEncodingException {
Map<String, Object> map = convertBeanToMap(device, false, 0, messageTemplate);
//请求url
String url = GE_TUI_BASE_URL + appId + "/push/single/cid";
log.info("执行cid单推");
return generalPost(url, token, map);
}
/**
* 创建消息拿到任务id
*
......@@ -271,10 +289,10 @@ public class GeTuiUtils {
* @param token token
* @return 任务id
*/
public static String getTaskId(MessageTemplate messageTemplate, String token) {
Map<String, Object> map = convertBeanToMap(null, messageTemplate);
public static String getTaskId(Integer device, String appId, MessageTemplate messageTemplate, String token) throws UnsupportedEncodingException {
Map<String, Object> map = convertBeanToMap(device, true, 1, messageTemplate);
//请求url
String url = GE_TUI_BASE_URL + KK_SH_APP_ID + "/push/list/message";
String url = GE_TUI_BASE_URL + appId + "/push/list/message";
String body = generalPost(url, token, map);
JSONObject jsonObject = JSONObject.parseObject(body);
return (jsonObject.containsKey("code") && jsonObject.getInteger("code") == 0) ? jsonObject.getJSONObject("data").getString("taskid") : body;
......@@ -338,45 +356,57 @@ public class GeTuiUtils {
*/
public static CommonResult listPush(InformForm informForm) {
MessageTemplate messageTemplate = new MessageTemplate();
messageTemplate.setAudience(new MessageTemplate.Audience(informForm.getAlias()));
MessageTemplate.Settings settings = new MessageTemplate.Settings();
settings.setTtl(3600000);
messageTemplate.setSettings(settings);
MessageTemplate.PushMessage pushMessage = new MessageTemplate.PushMessage();
MessageTemplate.PushMessage.Notification notification = new MessageTemplate.PushMessage.Notification();
BeanUtil.copyProperties(informForm, notification, CopyOptions.create().ignoreNullValue());
notification.setChannel_level(4);
pushMessage.setNotification(notification);
messageTemplate.setPush_message(pushMessage);
String result = null;
switch (informForm.getEquipmentType()) {
//看看生活
case "kksh":
String kk_sh_token_ge_tui = getAuthToken("kk_sh_token_ge_tui");
result = GeTuiUtils.listPushToApp(messageTemplate, KK_SH_APP_ID, kk_sh_token_ge_tui);
break;
//看看社保
case "kksb":
String kk_sb_token_ge_tui = getAuthToken("kk_sb_token_ge_tui");
result = GeTuiUtils.listPushToApp(messageTemplate, KK_SB_APP_ID, kk_sb_token_ge_tui);
break;
case "kkwj":
String kk_wj_token_ge_tui = getAuthToken("kk_wj_token_ge_tui");
result = GeTuiUtils.listPushToApp(messageTemplate, KK_WJ_APP_ID, kk_wj_token_ge_tui);
break;
default:
break;
}
if (result == null) {
return CommonResult.failed();
}
JSONObject jsonObject = JSONObject.parseObject(result);
if ((jsonObject.containsKey("code") && jsonObject.getInteger("code") == 0)) {
JSONObject data = jsonObject.getJSONObject("data");
return CommonResult.success(data);
try {
// String[] alias = {"kksh_59354"};
// String[] alias = {"kksh_10131492"};
Integer device = informForm.getDevice();
if (device == null) {
device = 4;
}
Integer speed = informForm.getSpeed();
// messageTemplate.setAudience(new MessageTemplate.Audience(alias));
messageTemplate.setSettings(new MessageTemplate.Settings(3600000, speed == null ? 0 : speed));
MessageTemplate.PushMessage pushMessage = new MessageTemplate.PushMessage();
MessageTemplate.PushMessage.Transmission transmission = new MessageTemplate.PushMessage.Transmission();
transmission.setTitle(informForm.getTitle());
transmission.setContent(informForm.getBody());
transmission.setUrl(HtmlUtil.unescape(informForm.getUrl()));
pushMessage.setTransmission(transmission);
messageTemplate.setPush_message(pushMessage);
String result = null;
switch (informForm.getEquipmentType()) {
//看看生活
case "kksh":
String kk_sh_token_ge_tui = getAuthToken("kk_sh_token_ge_tui");
// result = GeTuiUtils.singlePushAlias(device, messageTemplate, KK_SH_APP_ID, kk_sh_token_ge_tui);
result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_SH_APP_ID, kk_sh_token_ge_tui);
break;
//看看社保
case "kksb":
String kk_sb_token_ge_tui = getAuthToken("kk_sb_token_ge_tui");
// result = GeTuiUtils.singlePushAlias(device, messageTemplate, KK_SB_APP_ID, kk_sb_token_ge_tui);
result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_SB_APP_ID, kk_sb_token_ge_tui);
break;
case "kkwj":
String kk_wj_token_ge_tui = getAuthToken("kk_wj_token_ge_tui");
// result = GeTuiUtils.singlePushAlias(device, messageTemplate, KK_WJ_APP_ID, kk_wj_token_ge_tui);
result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_WJ_APP_ID, kk_wj_token_ge_tui);
break;
default:
break;
}
if (result == null) {
return CommonResult.failed();
}
JSONObject jsonObject = JSONObject.parseObject(result);
if ((jsonObject.containsKey("code") && jsonObject.getInteger("code") == 0)) {
JSONObject data = jsonObject.getJSONObject("data");
return CommonResult.success(data);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return CommonResult.failed();
}
......@@ -388,8 +418,8 @@ public class GeTuiUtils {
* @param token token
* @return 执行结果
*/
public static String listPushToApp(MessageTemplate messageTemplate, String appId, String token) {
Map<String, Object> map = convertBeanToMap(null, messageTemplate);
public static String listPushToApp(Integer device, MessageTemplate messageTemplate, String appId, String token) throws UnsupportedEncodingException {
Map<String, Object> map = convertBeanToMap(device, false, 1, messageTemplate);
//请求url
String url = GE_TUI_BASE_URL + appId + "/push/all";
log.info("执行群推");
......@@ -399,17 +429,13 @@ public class GeTuiUtils {
/**
* 实体类封装为map
*
* @param alias 别名
* @param messageTemplate 消息模板
* @return map对象
*/
public static Map<String, Object> convertBeanToMap(String[] alias, MessageTemplate messageTemplate) {
public static Map<String, Object> convertBeanToMap(Integer device, boolean flag, int type, MessageTemplate messageTemplate) throws UnsupportedEncodingException {
if (messageTemplate == null) {
return null;
}
//设置推送目标
messageTemplate.setAudience(new MessageTemplate.Audience(alias));
//设置请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
Map<String, Object> map = new HashMap<>();
map.put("request_id", String.valueOf(IdUtil.getSnowflake(1, 1).nextId()));
......@@ -420,118 +446,129 @@ public class GeTuiUtils {
}
//推送条件设置
MessageTemplate.Settings settings = messageTemplate.getSettings();
if (settings != null) {
Map<String, Object> setting = BeanUtil.beanToMap(settings, false, true);
Map<String, Object> strategy = new HashMap<>();
strategy.put("default", 4);
strategy.put("ios", 4);
strategy.put("st", 4);
strategy.put("hw", 4);
strategy.put("xm", 4);
strategy.put("vv", 4);
strategy.put("mz", 4);
strategy.put("op", 4);
setting.put("strategy", strategy);
map.put("settings", setting);
}
//推送目标用户该接口audience 对应值为all,表示推送所有用户
if (alias == null || alias.length == 0) {
map.put("audience", "all");
} else {
Map<String, Object> audience = BeanUtil.beanToMap(messageTemplate.getAudience(), false, true);
map.put("audience", audience);
Map<String, Object> setting = BeanUtil.beanToMap(messageTemplate.getSettings(), false, true);
Map<String, Object> strategy = new HashMap<>();
strategy.put("default", 4);
strategy.put("ios", 1);
strategy.put("st", 4);
strategy.put("hw", 4);
strategy.put("xm", 4);
strategy.put("vv", 4);
strategy.put("mz", 4);
strategy.put("op", 4);
setting.put("strategy", strategy);
map.put("settings", setting);
//获取推送目标
if (!flag) {
//推送目标用户该接口audience 对应值为all,表示推送所有用户
MessageTemplate.Audience audience1 = messageTemplate.getAudience();
if (audience1 == null) {
map.put("audience", "all");
} else {
if (type == 1) {
Map<String, Object> audience = BeanUtil.beanToMap(audience1, false, true);
map.put("audience", audience);
} else {
Map<String, Object> cid = new HashMap<>();
cid.put("cid", audience1.getAlias());
map.put("audience", cid);
}
}
}
//获取推送消息转为map 不转为下划线,忽略空值
MessageTemplate.PushMessage push_message = messageTemplate.getPush_message();
Map<String, Object> push_messages = BeanUtil.beanToMap(push_message, false, true);
//转换消息忽略空值
MessageTemplate.PushMessage.Notification notification = push_message.getNotification();
if (notification != null) {
//设置消息
Map<String, Object> notifications = BeanUtil.beanToMap(notification, false, true);
push_messages.put("notification", notifications);
}
//透传消息内容,与notification、revoke 三选一,都填写时报错,长度 ≤ 3072
MessageTemplate.PushMessage.Transmission transmission = push_message.getTransmission();
// String intent = null;
// if (device == 4) {
// String pack = "com.weface.kksocialsecurity";
// String component = pack + "/com.weface.kksocialsecurity.activity.WellcomeActivity";
// String str = "intent://com.weface.kksocialsecurity/localopen?push_type=0&url=%s#Intent;scheme=kankan;package=%s;component=%s;S.kkparam={\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"};end";
// intent = String.format(str, URLEncoder.encode(transmission.getUrl(), "UTF-8"), pack, component, transmission.getContent(), transmission.getTitle(), URLEncoder.encode(transmission.getUrl(), "UTF-8"));
// } else if (device == 1) {
// }
String str = "{\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"}";
String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl());
push_messages.put("transmission", intent);
//撤回消息时使用(仅撤回厂商通道消息,支持的厂商有小米、VIVO),与notification、transmission三选一,都填写时报错(消息撤回请勿填写策略参数)
MessageTemplate.PushMessage.Revoke revoke = push_message.getRevoke();
if (revoke != null) {
//设置撤回消息
Map<String, Object> revokes = BeanUtil.beanToMap(revoke, false, true);
push_messages.put("revoke", revokes);
}
//设置ios厂商通道
map.put("push_channel", setChannel(notification));
//设置android厂商通道
//设置推送消息
map.put("push_message", push_messages);
//设置厂商通道
map.put("push_channel", setChannel(push_message));
return map;
}
/**
* 设置推送渠道
*
* @param notification 消息
* @param push_message 消息
* @return json
*/
public static cn.hutool.json.JSONObject setChannel(MessageTemplate.PushMessage.Notification notification) {
public static cn.hutool.json.JSONObject setChannel(MessageTemplate.PushMessage push_message) throws UnsupportedEncodingException {
Map<String, Object> channel = new HashMap<>();
//获取ios配置
channel.put("ios", getIosChannel(notification));
channel.put("ios", getIosChannel(push_message));
//获取android配置
channel.put("android", getAndroidChannel(notification));
channel.put("android", getAndroidChannel(push_message));
return JSONUtil.parseFromMap(channel);
}
/**
* ios厂商通道消息配置
*
* @param notification 消息
* @param push_message 消息
* @return ios配置
*/
private static Map<String, Object> getIosChannel(MessageTemplate.PushMessage.Notification notification) {
private static Map<String, Object> getIosChannel(MessageTemplate.PushMessage push_message) throws UnsupportedEncodingException {
Map<String, Object> ios = new HashMap<>();
ios.put("type", "notify");
// ios.put("auto_badge", "+1");
//推送通知消息内容
Map<String, Object> aps = new HashMap<>();
aps.put("content-available", 0);
//通知消息
MessageTemplate.PushMessage.Transmission transmission = push_message.getTransmission();
Map<String, Object> alert = new HashMap<>();
alert.put("title", notification.getTitle());
alert.put("body", notification.getBody());
alert.put("title", transmission.getTitle());
alert.put("body", transmission.getContent());
aps.put("alert", alert);
ios.put("aps", aps);
String str = "{\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"}";
String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl());
ios.put("payload", intent);
return ios;
}
/**
* 安卓厂商通道消息配置
*
* @param notification 消息
* @param push_message 消息
* @return android配置
*/
private static Map<String, Object> getAndroidChannel(MessageTemplate.PushMessage.Notification notification) {
private static Map<String, Object> getAndroidChannel(MessageTemplate.PushMessage push_message) throws UnsupportedEncodingException {
Map<String, Object> android = new HashMap<>();
//android厂商通道推送消息内容
Map<String, Object> ups = new HashMap<>();
//通知消息内容,与transmission、revoke三选一,都填写时报错。若希望客户端离线时,直接在系统通知栏中展示通知栏消息,推荐使用此参数。
Map<String, Object> informAndroid = new HashMap<>();
informAndroid.put("title", notification.getTitle());
informAndroid.put("body", notification.getBody());
informAndroid.put("click_type", notification.getClick_type());
switch (notification.getClick_type()) {
case "url":
informAndroid.put("url", notification.getUrl());
break;
case "intent":
informAndroid.put("intent", notification.getIntent());
}
ups.put("notification", informAndroid);
MessageTemplate.PushMessage.Transmission transmission = push_message.getTransmission();
HashMap<String, Object> notification = new HashMap<>();
notification.put("title", transmission.getTitle());
notification.put("body", transmission.getContent());
notification.put("click_type", "intent");
String pack = "com.weface.kksocialsecurity";
String component = pack + "/com.weface.kksocialsecurity.activity.WellcomeActivity";
String str = "intent://com.weface.kksocialsecurity/localopen?push_type=0&url=%s#Intent;scheme=kankan;package=%s;component=%s;S.kkparam={\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"};end";
String intent = String.format(str, URLEncoder.encode(transmission.getUrl(), "UTF-8"), pack, component, transmission.getContent(), transmission.getTitle(), URLEncoder.encode(transmission.getUrl(), "UTF-8"));
notification.put("intent", intent);
ups.put("notification", notification);
android.put("ups", ups);
return android;
}
......
package com.weface.component;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Snowflake;
......@@ -104,7 +105,7 @@ public class MenuService {
}
return all;
} else {
log.error("返回值内不包含需要解析的数据" + jsonObject.toJSONString());
log.error("看看生活:返回值内不包含需要解析的数据{}", jsonObject.toJSONString());
}
} catch (Exception e) {
e.printStackTrace();
......@@ -133,7 +134,7 @@ public class MenuService {
JSONArray userTag = jsonObject.getJSONArray("userTag");
return getUserTagByTag(userTag, 2, tags);
} else {
log.error("返回值内不包含需要解析的数据" + jsonObject.toJSONString());
log.error("看看社保:返回值内不包含需要解析的数据{}", jsonObject.toJSONString());
}
return null;
}
......@@ -186,9 +187,11 @@ public class MenuService {
//如果调用的是看看生活的用户标签失败时,尝试调取看看社保用户标签
if (type == 1) {
List<Map<String, Object>> sbTags = getSBTags(gidList, tags);
if (sbTags != null && sbTags.size() > 0) {
userTags.addAll(sbTags);
if (CollUtil.isNotEmpty(gidList)) {
List<Map<String, Object>> sbTags = getSBTags(gidList, tags);
if (sbTags != null && sbTags.size() > 0) {
userTags.addAll(sbTags);
}
}
}
}
......
......@@ -75,11 +75,10 @@ public class MessageTemplate implements Serializable {
@AllArgsConstructor
public static class PushMessage implements Serializable {
private static final long serialVersionUID = 1L;
//手机端通知展示时间段,格式为毫秒时间戳段,两个时间的时间差必须大于10分钟,例如:"1590547347000-1590633747000"
private String duration;
//纯透传消息内容,安卓和iOS均支持,与notification、revoke 三选一,都填写时报错,长度 ≤ 3072
private String transmission;
private Transmission transmission;
//消息模板
private Notification notification;
//撤回消息时使用(仅撤回个推通道消息),与notification、transmission三选一,都填写时报错(消息撤回请勿填写策略参数)
......@@ -109,6 +108,23 @@ public class MessageTemplate implements Serializable {
private String thread_id;
}
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class Transmission {
private String title;
private String content;
private String url;
//0:h5 1:app原生
private String push_type;
//跳转功能名称
private String className;
//功能标题
private String classTitle;
//是否需要登录
private String needLogin;
}
@Data
public static class Revoke {
private String old_task_id;
......
......@@ -36,7 +36,7 @@ public class PushController {
}
@PostMapping("/all")
public CommonResult pushAll(@RequestBody @Validated({Default.class}) InformForm informForm) {
public CommonResult pushAll(@Validated({Default.class}) InformForm informForm) {
return GeTuiUtils.listPush(informForm);
}
}
......@@ -9,14 +9,28 @@ import javax.validation.constraints.NotBlank;
*/
@Data
public class InformForm {
//标题
@NotBlank
private String title;
//内容
@NotBlank
private String body;
@NotBlank
private String click_type;
//跳转url
private String url;
private String[] alias;
//推送类型 0:h5 1:原生
private String push_type;
//跳转功能名称
private String className;
//功能标题
private String classTitle;
//是否需要登录
private String needLogin;
//请求应用名称首字母小写 例:看看生活->kksh
@NotBlank
private String equipmentType;
//推送设备 4 android 1: ios
private Integer device;
//定速推送,例如100,个推控制下发速度在100条/秒左右,0表示不限速
private Integer speed;
}
......@@ -2,9 +2,12 @@ package com.weface;
import cn.hutool.core.util.IdUtil;
import cn.hutool.http.HtmlUtil;
import com.weface.code.CommonResult;
import com.weface.component.GeTuiUtils;
import com.weface.component.MenuService;
import com.weface.component.MessageTemplate;
import com.weface.dto.InformForm;
import com.weface.entity.MenuTagsEntity;
import com.weface.entity.UserTagEntity;
import com.weface.entity.UserMenusEntity;
......@@ -90,33 +93,49 @@ class PushMessageApplicationTests {
}
}
@Test
void testListPush() {
InformForm informForm = new InformForm();
informForm.setTitle("河南一名小学生确诊阳性!");
informForm.setBody("1月23日新增一例本土确诊病例!为11岁小学生");
informForm.setUrl("https://kk.weface.com.cn/news/page/?id=c0933d0e2fc85f7333b6202dff0e611c&type=hot&from=101");
informForm.setPush_type("0");
informForm.setEquipmentType("kksh");
CommonResult commonResult = GeTuiUtils.listPush(informForm);
System.out.println(commonResult);
}
@Test
void testConventTemplate() throws UnsupportedEncodingException {
//String[] alias = {"kksh_10255318"};
//String[] alias = {"kksh_10131492"};
String[] alias = {"kksh_59354"};
String token = GeTuiUtils.getAuthToken("kk_sh_token_ge_tui");
InformForm informForm = new InformForm();
String[] alias = {"kksh_10131492"};
// String[] alias = {"kksh_59354"};
// String token = GeTuiUtils.getAuthToken("kk_sh_token_ge_tui");
String token = GeTuiUtils.getAuthToken("kk_sb_token_ge_tui");
informForm.setTitle("河南一名小学生确诊阳性!");
informForm.setBody("1月23日新增一例本土确诊病例!为11岁小学生");
informForm.setUrl("https://kk.weface.com.cn/news/page/?id=c0933d0e2fc85f7333b6202dff0e611c&type=hot&from=101");
MessageTemplate messageTemplate = new MessageTemplate();
messageTemplate.setAudience(new MessageTemplate.Audience(alias));
MessageTemplate.Settings settings = new MessageTemplate.Settings();
settings.setTtl(3600000);
messageTemplate.setSettings(settings);
messageTemplate.setSettings(new MessageTemplate.Settings(3600000, 0));
MessageTemplate.PushMessage pushMessage = new MessageTemplate.PushMessage();
MessageTemplate.PushMessage.Notification notification = new MessageTemplate.PushMessage.Notification();
notification.setTitle("河南一名小学生确诊阳性!");
notification.setBody("1月23日新增一例本土确诊病例!为11岁小学生");
notification.setClick_type("intent");
String pack = "com.weface.kksocialsecurity/com.weface.kksocialsecurity.activity.WellcomeActivity";
String str = "intent:#Intent;component=%s;S.kkparam={\"content\": \"%s\", \"ispush\": \"1\", \"preload\": \"2\", \"push_type\": \"0\", \"pushlabel\": \"\", \"pushts\": \"1561619033\", \"title\": \"%s\", \"url\": \"%s\"};end";
String url = "https://kk.weface.com.cn/news/page/?id=c0933d0e2fc85f7333b6202dff0e611c&type=hot&from=101";
String intent = String.format(str, pack, notification.getBody(), notification.getTitle(), URLEncoder.encode(url, "UTF-8"));
// String intent = "intent:#Intent;component=com.weface.kksocialsecurity/com.weface.kksocialsecurity.activity.WellcomeActivity;S.kkparam={\"content\": \"1月23日新增一例本土确诊病例!为11岁小学生\", \"ispush\": \"1\", \"preload\": \"2\", \"push_type\": \"0\", \"pushlabel\": \"\", \"pushts\": \"1561619033\", \"title\": \"河南一名小学生确诊阳性!\", \"url\": \"https://kk.weface.com.cn/news/page/?id=c0933d0e2fc85f7333b6202dff0e611c&type=hot&from=101\"};end";
notification.setIntent(intent);
notification.setChannel_level(4);
pushMessage.setNotification(notification);
MessageTemplate.PushMessage.Transmission transmission = new MessageTemplate.PushMessage.Transmission();
transmission.setTitle(informForm.getTitle());
transmission.setContent(informForm.getBody());
transmission.setUrl(informForm.getUrl());
pushMessage.setTransmission(transmission);
messageTemplate.setPush_message(pushMessage);
String s = GeTuiUtils.singlePushAlias(alias, GeTuiUtils.KK_SH_APP_ID, messageTemplate, token);
// String s = GeTuiUtils.singlePushAlias(4, messageTemplate, GeTuiUtils.KK_SH_APP_ID, token);
String s = GeTuiUtils.singlePushAlias(1, messageTemplate, GeTuiUtils.KK_SB_APP_ID, token);
System.out.println(s);
}
......@@ -129,7 +148,7 @@ class PushMessageApplicationTests {
Map<String, Object> push_message = new HashMap<>();
HashMap<String, Object> revoke = new HashMap<>();
revoke.put("old_task_id", "RASA_0124_1679436c706dc2ea869c7c43eed0fb7d");
revoke.put("old_task_id", "RASA_0127_011f801354c5236738787cdda86cf232");
revoke.put("force", false);
push_message.put("revoke", revoke);
map.put("push_message", push_message);
......@@ -140,4 +159,11 @@ class PushMessageApplicationTests {
}
@Test
void testBase() {
String url = "https://kk.weface.com.cn/news/page/?id=8def012d3485ca0e87455b6c5aeeea18&amp;type=hot&amp;from=101";
String unescape = HtmlUtil.unescape(url);
System.out.println(unescape);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment