当前位置: 首页 > news >正文

dw做的网站放文件夹数字营销包括哪些方面

dw做的网站放文件夹,数字营销包括哪些方面,网站建设设计平台,网页设计实训总结ppt极光推送常用的几个api方法总结#xff0c;抽取出了utils类#xff0c;利用MsgType进行业务类型区别#xff0c;方便app端收到推送后进行不同处理#xff1a; 首先引入依赖#xff1a; !-- 极光推送 --dependencygroupIdcn.jpush.api/groupId…极光推送常用的几个api方法总结抽取出了utils类利用MsgType进行业务类型区别方便app端收到推送后进行不同处理 首先引入依赖 !-- 极光推送 --dependencygroupIdcn.jpush.api/groupIdartifactIdjpush-client/artifactIdversion3.3.4/version/dependencydependencygroupIdcn.jpush.api/groupIdartifactIdjiguang-common/artifactIdversion1.1.1/version/dependency   package com.commons.utils;import java.text.SimpleDateFormat; import java.util.Collections; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory;import com.ecp.commons.exception.APIException; import com.ecp.commons.utils.JsonUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder;import cn.jiguang.common.resp.APIConnectionException; import cn.jiguang.common.resp.APIRequestException; import cn.jpush.api.JPushClient; import cn.jpush.api.push.PushResult; import cn.jpush.api.push.model.Message; import cn.jpush.api.push.model.Platform; import cn.jpush.api.push.model.PushPayload; import cn.jpush.api.push.model.audience.Audience; import cn.jpush.api.schedule.ScheduleResult;public class JpushUtils {//读取配置中的appkey和masterSecretprotected static final Logger LOG LoggerFactory.getLogger(JpushUtils.class);public static final String appKey com.ecp.commons.common.PropertiesUtil.getProperty(jPush.appKey);public static final String masterSecret com.ecp.commons.common.PropertiesUtil.getProperty(jPush.masterSecret);/*** * auth Ren* date 2018年5月2日* decripe 定时推送,利用DeviceSN做别名,点对点发送,同时记录返回的msg_id* param obj推送对象,deviceSN设备识别码,定时的时间date,MsgType推送的业务类型(APIConstants中定义),* name推送的名称*/public static ScheduleResult sendSchedulePush(Object obj, String deviceSN, Date date, String MsgType, String name) {JPushClient jPushClient new JPushClient(masterSecret, appKey);String objStr ObjectToJson(obj);SimpleDateFormat format new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);String time format.format(date);ScheduleResult result null;PushPayload push PushPayload.newBuilder().setPlatform(Platform.all()).setMessage(Message.newBuilder().setMsgContent(objStr).addExtras(Collections.singletonMap(MsgType, MsgType)).build()).setAudience(Audience.alias(deviceSN)).build();try {result jPushClient.createSingleSchedule(name, time, push);LOG.info(Got result - result);LOG.info(send objStr - objStr);System.out.println(result);System.out.println(objStr);} catch (APIConnectionException e) {LOG.error(Connection error. Should retry later. , e);} catch (APIRequestException e) {LOG.error(Error response from JPush server. Should review and fix it. , e);LOG.info(HTTP Status: e.getStatus());LOG.info(Error Code: e.getErrorCode());LOG.info(Error Message: e.getErrorMessage());}return result;}/*** * auth Ren* date 2018年5月2日* decripe 定时推送,推送到所有设备,同时记录返回的msg_id* param obj推送对象,定时的时间date,MsgType推送的业务类型(APIConstants中定义),name推送的名称*/public static ScheduleResult sendSchedulePushAll(Object obj, Date date, String MsgType, String name) {JPushClient jPushClient new JPushClient(masterSecret, appKey);String objStr ObjectToJson(obj);SimpleDateFormat format new SimpleDateFormat(yyyy-MM-dd HH:mm:ss);String time format.format(date);ScheduleResult result null;PushPayload push PushPayload.newBuilder().setPlatform(Platform.all()).setMessage(Message.newBuilder().setMsgContent(objStr).addExtras(Collections.singletonMap(MsgType, MsgType)).build()).setAudience(Audience.all()).build();try {result jPushClient.createSingleSchedule(name, time, push);LOG.info(Got result - result);LOG.info(send objStr - objStr);System.out.println(result);System.out.println(objStr);} catch (APIConnectionException e) {LOG.error(Connection error. Should retry later. , e);} catch (APIRequestException e) {LOG.error(Error response from JPush server. Should review and fix it. , e);LOG.info(HTTP Status: e.getStatus());LOG.info(Error Code: e.getErrorCode());LOG.info(Error Message: e.getErrorMessage());}return result;}/*** * auth Ren* date 2018年5月2日* decripe 删除定时任务* param scheduleId定时任务的Id*/public static void DeleteSchedule(String scheduleId) {try {JPushClient jPushClient new JPushClient(masterSecret, appKey);jPushClient.deleteSchedule(scheduleId);} catch (APIConnectionException e) {LOG.error(Connection error. Should retry later. , e);} catch (APIRequestException e) {LOG.error(Error response from JPush server. Should review and fix it. , e);LOG.info(HTTP Status: e.getStatus());LOG.info(Error Code: e.getErrorCode());LOG.info(Error Message: e.getErrorMessage());}}/*** * auth Ren* date 2018年5月2日* decripe:把obj对象的json串推送到别名为DeviceSN的设备上,同时记录返回的msg_id* param obj推送对象,deviceSN设备识别码,MsgType推送的业务类型(APIConstants中定义)*/public static PushResult SendPush(Object obj, String DeviceSN, String MsgType) {JPushClient jPushClient new JPushClient(masterSecret, appKey);String objStr ObjectToJson(obj);PushPayload push PushPayload.newBuilder().setPlatform(Platform.all()).setMessage(Message.newBuilder().setMsgContent(objStr).addExtras(Collections.singletonMap(MsgType, MsgType)).build()).setAudience(Audience.alias(DeviceSN)).build();PushResult result null;try {result jPushClient.sendPush(push);LOG.info(Got result - result);LOG.info(send objStr - objStr);System.out.println(result);System.out.println(objStr);} catch (APIConnectionException e) {LOG.error(Connection error. Should retry later. , e);LOG.error(Sendno: push.getSendno());} catch (APIRequestException e) {LOG.error(Error response from JPush server. Should review and fix it. , e);LOG.info(HTTP Status: e.getStatus());LOG.info(Error Code: e.getErrorCode());LOG.info(Error Message: e.getErrorMessage());LOG.info(Msg ID: e.getMsgId());LOG.error(Sendno: push.getSendno());}if (result null) {throw new APIException(与设备通话失败请联系管理员处理);}return result;}/*** * auth Ren* date 2018年5月2日* decripe 把obj对象的json串推送到所有设备上* param obj推送对象,MsgType推送的业务类型(APIConstants中定义)*/public static PushResult SendPushAll(Object obj, String MsgType) {JPushClient jPushClient new JPushClient(masterSecret, appKey);String objStr ObjectToJson(obj);PushPayload push PushPayload.newBuilder().setPlatform(Platform.all()).setMessage(Message.newBuilder().setMsgContent(objStr).addExtras(Collections.singletonMap(MsgType, MsgType)).build()).setAudience(Audience.all()).build();PushResult result null;try {result jPushClient.sendPush(push);LOG.info(Got result - result);LOG.info(send objStr - objStr);System.out.println(result);System.out.println(objStr);} catch (APIConnectionException e) {LOG.error(Connection error. Should retry later. , e);LOG.error(Sendno: push.getSendno());} catch (APIRequestException e) {LOG.error(Error response from JPush server. Should review and fix it. , e);LOG.info(HTTP Status: e.getStatus());LOG.info(Error Code: e.getErrorCode());LOG.info(Error Message: e.getErrorMessage());LOG.info(Msg ID: e.getMsgId());LOG.error(Sendno: push.getSendno());}if (result null) {throw new APIException(推送失败,请联系管理员处理);}return result;}public static String ObjectToJson(Object o) {String json JsonUtil.getJsonString4JavaPOJO(o, yyyy-MM-dd HH:mm:ss);return json;} }  转载于:https://www.cnblogs.com/self-studyRen/p/9141725.html
http://www.sadfv.cn/news/238867/

相关文章:

  • 沈阳网站建设开发单页网站建设教程
  • 网站用cms婚纱影楼网站建设
  • 做网站网站犯法吗百度seo排名曝光行者seo
  • 个体工商户做的网站能推广吗长沙优秀网站建设
  • 网站建站麻烦吗自己想做网站
  • 单位建网站怎么做零基础视频制作剪辑培训
  • mq网站开发asp.net当前网站路径
  • wordpress 高端主题seo深圳优化
  • 找阿里巴巴购买做网站的软件甘肃省住房建设厅网站
  • 网站开发word文档深圳品牌家政公司排行榜
  • 网站建设和实现程序外包一般多少钱
  • 做网站主要是做什么如何网上申请个人营业执照
  • 互联网建站公司有哪些博物馆设计公司哪个好
  • 南通网站排名优化公司网站域名被注册
  • 西部数码网站管理助手3.0网站开发教案
  • 外贸网站建设上海阳江58同城招聘网
  • 落伍者论坛 做网站购物网站排名前十
  • asp做一个简单网站东莞阳光网上投诉
  • 网站后台左侧导航折叠效果打不开网站关键词排名不稳定
  • 当今做那些网站致富wordpress快
  • 用php做网站视频ps软件下载花钱吗
  • 广西网站建设哪家不错乒乓球网页设计素材
  • 网上做设计的网站有哪些企业网站建设合同版本
  • 长裕建设有限公司网站成都建站优化公司
  • 做团餐 承包食堂的企业网站网站建设的目标有哪些
  • 做教育app的网站有哪些内容展示型网站可以做推广的吗
  • 网站备案号链接南通高端网站建设机构
  • 四川省建设厅网站投诉企业外包是什么意思
  • dw网站首页制作国内建设网站的公司
  • 手机搭建网站工具桂林旅游网站制作