Authored by 胡古飞

Update push-对外接口文档.md

... ... @@ -81,7 +81,7 @@
pushTaskMqMessage.setAndroidVersions(null);
//生成丢进mq的字符串
pushMessage.put("data", JSON.toJSON(pushTaskMqMessage));
pushMessage.put("data", pushTaskMqMessage);
String addToMqString = pushMessage.toJSONString();
System.out.println(addToMqString);
//TODO ADD pushMessage json String to RabbitMq,topic is yoho_task_push
... ... @@ -126,3 +126,45 @@
- id为send_task表中对应的id,因为业务方并不知道,默认情况下直接设为0即可。
- sceneType 和 sceneKey 很重要,大数据统计时会用到,请合理命名。
- uids大小不要超过1W,数据量大时,请自行分片。
#### 生成MQ消息实体的demo
- PushSendTaskBO对象
public class PushSendTaskBO {
private int id = 0;//任务id,为0即可
private String title;//推送标题
private String content;//推送内容
private String sendMethods;//ios/android_getui
private String version;//版本,可为空
private String appendParams;//APP跳转链接
private String pushScene;//推送场景
private String pushSceneKey;//推送场景key
}
- DispatchPushMsgBO对象
public class DispatchPushMsgBO {
private PushSendTaskBO task;
private List<String> uids;
}
- 生成写进MQ的消息字符串
public class DispatchPushMsgDemo {
public static void main(String[] args) {
JSONObject dispatchPushMsgDemo = new JSONObject();
DispatchPushMsgBO dispatchPushMsg = new DispatchPushMsgBO();
//构造推送内容
PushSendTaskBO pushSendTaskBO = new PushSendTaskBO();
pushSendTaskBO.setId(0);
pushSendTaskBO.setTitle("");
pushSendTaskBO.setContent("您订阅的adidas秒杀活动计即将开始,赶紧戳进来>>");
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\"}");
pushSendTaskBO.setPushScene("SpecilSkill");
pushSendTaskBO.setPushSceneKey("841");
pushSendTaskBO.setSendMethods("ios");
dispatchPushMsg.setTask(pushSendTaskBO);
//构造推送的uids
dispatchPushMsg.setUids(Arrays.asList("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"));
dispatchPushMsgDemo.put("data", dispatchPushMsg);
//显示MQ消息的内容
System.out.println(dispatchPushMsgDemo.toJSONString());
}
}
... ...