Report_Statistic_Device.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /// 功能:统计APP 设备数
  13. /// </summary>
  14. public class Report_Statistic_Device : Baidu_Send
  15. {
  16. #region 构造函数
  17. public Report_Statistic_Device(string secret_key, Baidu_Mod mod)
  18. {
  19. this.httpMehtod = Baidu_Helper.HTTP_POST;
  20. this.url = "http://api.tuisong.baidu.com/rest/3.0/" + Baidu_Helper.REPORT_STATISTIC_DEVICE;
  21. this.secret_key = secret_key;
  22. this.mod = mod;
  23. }
  24. public Report_Statistic_Device(string httpMehtod, string secret_key, Baidu_Mod mod)
  25. {
  26. this.httpMehtod = httpMehtod;
  27. this.url = "http://api.tuisong.baidu.com/rest/3.0/" + Baidu_Helper.REPORT_STATISTIC_DEVICE;
  28. this.secret_key = secret_key;
  29. this.mod = mod;
  30. }
  31. #endregion
  32. #region 重写PushMessage方法
  33. public override string PushMessage()
  34. {
  35. string strResult = "";
  36. //1.创建异步任务
  37. Task<string> task = Baidu_Helper.SendBaidu(this.httpMehtod, this.url, this.secret_key, this.mod);
  38. //2.等待任务完成
  39. task.Wait();
  40. //3.异步任务完成
  41. if (task.IsCompleted)
  42. {
  43. strResult = task.Result.ToString();
  44. }
  45. return strResult;
  46. }
  47. #endregion
  48. }
  49. }