Push_Single_Device_Mod.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace CommLib.BdPush
  6. {
  7. /// <summary>
  8. /// 作者:冼树华
  9. /// QQ:56472465
  10. /// 日期:20150-04-29
  11. /// 功能:根据给定的channel_id推送消息给单个设备
  12. /// </summary>
  13. public class Push_Single_Device_Mod : Baidu_Mod
  14. {
  15. #region 属性
  16. public string channel_id { get; set; } //string 是 必须为端上初始化channel成功之后返回的channel_id 唯一对应一台设备
  17. public uint msg_type { get; set; } //number 否 取值如下:0:消息;1:通知。默认为0 消息类型
  18. public string msg { get; set; } //string 是 详情见消息/通知数据格式 消息内容,json格式
  19. public uint msg_expires { get; set; } //number 否 0~604800(86400*7),默认为5小时(18000秒) 相对于当前时间的消息过期时间,单位为秒
  20. public uint deploy_status { get; set; } //number 否 取值为:1:开发状态;2:生产状态; 若不指定,则默认设置为生产状态。 设置iOS应用的部署状态,仅iOS应用推送时使用
  21. #endregion
  22. #region 构造函数
  23. public Push_Single_Device_Mod(string apikey, string channel_id, string msg)
  24. {
  25. this.apikey = apikey;
  26. this.channel_id = channel_id;
  27. this.msg = msg;
  28. this.timestamp = Tool.getDefauleTimestamp(); //默认使用当前时间戳
  29. this.msg_type = 0; //消息
  30. this.msg_expires = 604800; //7天过期
  31. this.device_type = 3; //安卓
  32. this.deploy_status = 2; //生产状态
  33. }
  34. public Push_Single_Device_Mod(string apikey, string channel_id, string msg, uint msg_type)
  35. {
  36. this.apikey = apikey;
  37. this.channel_id = channel_id;
  38. this.msg = msg;
  39. this.timestamp = Tool.getDefauleTimestamp(); //默认使用当前时间戳
  40. this.msg_type = msg_type; //消息类型
  41. this.msg_expires = 604800; //7天过期
  42. this.device_type = 3; //安卓
  43. this.deploy_status = 2; //生产状态
  44. }
  45. #endregion
  46. }
  47. }