Push_Batch_Device_Mod.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace CommLib.BdPush
  7. {
  8. /// <summary>
  9. /// 作者:冼树华
  10. /// QQ:56472465
  11. /// 日期:20150-04-29
  12. /// 功能:推送消息给批量设备(批量单播)
  13. /// </summary>
  14. public class Push_Batch_Device_Mod : Baidu_Mod
  15. {
  16. #region 属性
  17. public string channel_ids { get; set; } //string 是 一组channel_id(最多为一万个)组成的json数组字符串 对应一批设备
  18. public uint msg_type { get; set; } //number 否 取值如下:0:消息;1:通知。默认为0 消息类型
  19. public string msg { get; set; } //string 是 详情见消息/通知数据格式 消息内容,json格式
  20. public uint msg_expires { get; set; } //number 否 0~604800(86400*7),默认为5小时(18000秒) 相对于当前时间的消息过期时间,单位为秒
  21. public string topic_id { get; set; } //string 是 字母、数字及下划线组成,长度限制为1~128 分类主题名称
  22. #endregion
  23. #region 构造函数
  24. public Push_Batch_Device_Mod(string apikey, string channel_ids, string msg, string topic_id)
  25. {
  26. this.apikey = apikey;
  27. this.channel_ids = channel_ids;
  28. this.msg = msg;
  29. this.timestamp = Tool.getDefauleTimestamp(); //默认使用当前时间戳
  30. this.msg_type = 0; //消息
  31. this.msg_expires = 86400; //1天过期(只能一天)
  32. this.device_type = 3; //安卓
  33. this.topic_id = topic_id; //主题
  34. }
  35. public Push_Batch_Device_Mod(string apikey, string channel_ids, string msg, uint msg_type, string topic_id)
  36. {
  37. this.apikey = apikey;
  38. this.channel_ids = channel_ids;
  39. this.msg = msg;
  40. this.timestamp = Tool.getDefauleTimestamp(); //默认使用当前时间戳
  41. this.msg_type = msg_type; //消息类型
  42. this.msg_expires = 86400; //1天过期(只能一天)
  43. this.device_type = 3; //安卓
  44. this.topic_id = topic_id; //主题
  45. }
  46. #endregion
  47. }
  48. }