Showing
1 changed file
with
44 additions
and
2 deletions
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | pushTaskMqMessage.setAndroidVersions(null); | 81 | pushTaskMqMessage.setAndroidVersions(null); |
82 | 82 | ||
83 | //生成丢进mq的字符串 | 83 | //生成丢进mq的字符串 |
84 | - pushMessage.put("data", JSON.toJSON(pushTaskMqMessage)); | 84 | + pushMessage.put("data", pushTaskMqMessage); |
85 | String addToMqString = pushMessage.toJSONString(); | 85 | String addToMqString = pushMessage.toJSONString(); |
86 | System.out.println(addToMqString); | 86 | System.out.println(addToMqString); |
87 | //TODO ADD pushMessage json String to RabbitMq,topic is yoho_task_push | 87 | //TODO ADD pushMessage json String to RabbitMq,topic is yoho_task_push |
@@ -125,4 +125,46 @@ | @@ -125,4 +125,46 @@ | ||
125 | - title和content表示推送的内容和标题,安卓两个字段都要填,ios的title设为'',content设为完整的推送内容 | 125 | - title和content表示推送的内容和标题,安卓两个字段都要填,ios的title设为'',content设为完整的推送内容 |
126 | - id为send_task表中对应的id,因为业务方并不知道,默认情况下直接设为0即可。 | 126 | - id为send_task表中对应的id,因为业务方并不知道,默认情况下直接设为0即可。 |
127 | - sceneType 和 sceneKey 很重要,大数据统计时会用到,请合理命名。 | 127 | - sceneType 和 sceneKey 很重要,大数据统计时会用到,请合理命名。 |
128 | - - uids大小不要超过1W,数据量大时,请自行分片。 | ||
128 | + - uids大小不要超过1W,数据量大时,请自行分片。 | ||
129 | + | ||
130 | +#### 生成MQ消息实体的demo | ||
131 | + - PushSendTaskBO对象 | ||
132 | + public class PushSendTaskBO { | ||
133 | + private int id = 0;//任务id,为0即可 | ||
134 | + private String title;//推送标题 | ||
135 | + private String content;//推送内容 | ||
136 | + private String sendMethods;//ios/android_getui | ||
137 | + private String version;//版本,可为空 | ||
138 | + private String appendParams;//APP跳转链接 | ||
139 | + private String pushScene;//推送场景 | ||
140 | + private String pushSceneKey;//推送场景key | ||
141 | + } | ||
142 | + | ||
143 | + - DispatchPushMsgBO对象 | ||
144 | + public class DispatchPushMsgBO { | ||
145 | + private PushSendTaskBO task; | ||
146 | + private List<String> uids; | ||
147 | + } | ||
148 | + | ||
149 | + - 生成写进MQ的消息字符串 | ||
150 | + public class DispatchPushMsgDemo { | ||
151 | + public static void main(String[] args) { | ||
152 | + JSONObject dispatchPushMsgDemo = new JSONObject(); | ||
153 | + DispatchPushMsgBO dispatchPushMsg = new DispatchPushMsgBO(); | ||
154 | + //构造推送内容 | ||
155 | + PushSendTaskBO pushSendTaskBO = new PushSendTaskBO(); | ||
156 | + pushSendTaskBO.setId(0); | ||
157 | + pushSendTaskBO.setTitle(""); | ||
158 | + pushSendTaskBO.setContent("您订阅的adidas秒杀活动计即将开始,赶紧戳进来>>"); | ||
159 | + pushSendTaskBO.setAppendParams("{\"type\":\"event\",\"ad_action\":\"go.url\",\"ad_option\":\"link=http://feature.yoho.cn/1019/1019NEWGIRL/index.html?app_version=4.9.2.1609120001\",\"isLogin\":\"Y\",\"act_id\":\"841\"}"); | ||
160 | + pushSendTaskBO.setPushScene("SpecilSkill"); | ||
161 | + pushSendTaskBO.setPushSceneKey("841"); | ||
162 | + pushSendTaskBO.setSendMethods("ios"); | ||
163 | + dispatchPushMsg.setTask(pushSendTaskBO); | ||
164 | + //构造推送的uids | ||
165 | + dispatchPushMsg.setUids(Arrays.asList("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15")); | ||
166 | + dispatchPushMsgDemo.put("data", dispatchPushMsg); | ||
167 | + //显示MQ消息的内容 | ||
168 | + System.out.println(dispatchPushMsgDemo.toJSONString()); | ||
169 | + } | ||
170 | + } |
-
Please register or login to post a comment