Commit 17f7a014 authored by renandong's avatar renandong 🇨🇳

1,群推

parent 0895ce3f
package com.weface.component; package com.weface.component;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HtmlUtil; import cn.hutool.http.HtmlUtil;
...@@ -357,14 +356,11 @@ public class GeTuiUtils { ...@@ -357,14 +356,11 @@ public class GeTuiUtils {
public static CommonResult listPush(InformForm informForm) { public static CommonResult listPush(InformForm informForm) {
MessageTemplate messageTemplate = new MessageTemplate(); MessageTemplate messageTemplate = new MessageTemplate();
try { try {
// String[] alias = {"kksh_59354"};
// String[] alias = {"kksh_10131492"};
Integer device = informForm.getDevice(); Integer device = informForm.getDevice();
if (device == null) { if (device == null) {
device = 4; device = 4;
} }
Integer speed = informForm.getSpeed(); Integer speed = informForm.getSpeed();
// messageTemplate.setAudience(new MessageTemplate.Audience(alias));
messageTemplate.setSettings(new MessageTemplate.Settings(3600000, speed == null ? 0 : speed)); messageTemplate.setSettings(new MessageTemplate.Settings(3600000, speed == null ? 0 : speed));
MessageTemplate.PushMessage pushMessage = new MessageTemplate.PushMessage(); MessageTemplate.PushMessage pushMessage = new MessageTemplate.PushMessage();
...@@ -380,18 +376,15 @@ public class GeTuiUtils { ...@@ -380,18 +376,15 @@ public class GeTuiUtils {
//看看生活 //看看生活
case "kksh": case "kksh":
String kk_sh_token_ge_tui = getAuthToken("kk_sh_token_ge_tui"); 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); result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_SH_APP_ID, kk_sh_token_ge_tui);
break; break;
//看看社保 //看看社保
case "kksb": case "kksb":
String kk_sb_token_ge_tui = getAuthToken("kk_sb_token_ge_tui"); 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); result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_SB_APP_ID, kk_sb_token_ge_tui);
break; break;
case "kkwj": case "kkwj":
String kk_wj_token_ge_tui = getAuthToken("kk_wj_token_ge_tui"); 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); result = GeTuiUtils.listPushToApp(device, messageTemplate, KK_WJ_APP_ID, kk_wj_token_ge_tui);
break; break;
default: default:
...@@ -481,14 +474,6 @@ public class GeTuiUtils { ...@@ -481,14 +474,6 @@ public class GeTuiUtils {
//透传消息内容,与notification、revoke 三选一,都填写时报错,长度 ≤ 3072 //透传消息内容,与notification、revoke 三选一,都填写时报错,长度 ≤ 3072
MessageTemplate.PushMessage.Transmission transmission = push_message.getTransmission(); 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 str = "{\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"}";
String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl()); String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl());
push_messages.put("transmission", intent); push_messages.put("transmission", intent);
...@@ -542,7 +527,6 @@ public class GeTuiUtils { ...@@ -542,7 +527,6 @@ public class GeTuiUtils {
alert.put("body", transmission.getContent()); alert.put("body", transmission.getContent());
aps.put("alert", alert); aps.put("alert", alert);
ios.put("aps", aps); ios.put("aps", aps);
String str = "{\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"}"; String str = "{\"content\": \"%s\", \"push_type\": \"0\", \"title\": \"%s\", \"url\": \"%s\"}";
String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl()); String intent = String.format(str, transmission.getContent(), transmission.getTitle(), transmission.getUrl());
ios.put("payload", intent); ios.put("payload", intent);
......
...@@ -55,7 +55,7 @@ public class UserTagsTask { ...@@ -55,7 +55,7 @@ public class UserTagsTask {
/** /**
* 更新用户标签 * 更新用户标签
*/ */
@Scheduled(cron = "0 15 10 * * ?") @Scheduled(cron = "0 0 23 * * ?")
public void updateUserTags() { public void updateUserTags() {
try { try {
//获取每次处理的id起始值 //获取每次处理的id起始值
......
...@@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -93,18 +92,6 @@ class PushMessageApplicationTests { ...@@ -93,18 +92,6 @@ 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 @Test
void testConventTemplate() throws UnsupportedEncodingException { void testConventTemplate() throws UnsupportedEncodingException {
InformForm informForm = new InformForm(); InformForm informForm = new InformForm();
...@@ -158,12 +145,4 @@ class PushMessageApplicationTests { ...@@ -158,12 +145,4 @@ class PushMessageApplicationTests {
System.out.println(s); System.out.println(s);
} }
@Test
void testBase() {
String url = "https://kk.weface.com.cn/news/page/?id=8def012d3485ca0e87455b6c5aeeea18&type=hot&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