MpMessageEntityEnlightener.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using Senparc.NeuChar.Entities;
  2. using Senparc.NeuChar.Exceptions;
  3. using Senparc.NeuChar.MessageHandlers;
  4. using Senparc.Weixin.MP.Entities;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Senparc.Weixin.MP.MessageHandlers
  11. {
  12. /// <summary>
  13. /// 公众号 MessageEntityEnlightener
  14. /// </summary>
  15. public class MpMessageEntityEnlightener : MessageEntityEnlightener
  16. {
  17. //说明:此处不需要强制使用单例模式
  18. /// <summary>
  19. /// MpMessageEntityEnlightener 全局对象
  20. /// </summary>
  21. public static MessageEntityEnlightener Instance = new MpMessageEntityEnlightener(NeuChar.PlatformType.WeChat_OfficialAccount);
  22. MpMessageEntityEnlightener(NeuChar.PlatformType platformType) : base(platformType) { }
  23. public override IRequestMessageEvent NewRequestMessageEvent()
  24. {
  25. return new RequestMessageEventBase();
  26. }
  27. public override IRequestMessageFile NewRequestMessageFile()
  28. {
  29. return new RequestMessageFile();
  30. }
  31. public override IRequestMessageImage NewRequestMessageImage()
  32. {
  33. return new RequestMessageImage();
  34. }
  35. public override IRequestMessageLink NewRequestMessageLink()
  36. {
  37. return new RequestMessageLink();
  38. }
  39. public override IRequestMessageLocation NewRequestMessageLocation()
  40. {
  41. return new RequestMessageLocation();
  42. }
  43. public override IRequestMessageShortVideo NewRequestMessageShortVideo()
  44. {
  45. return new RequestMessageShortVideo();
  46. }
  47. public override IRequestMessageText NewRequestMessageText()
  48. {
  49. return new RequestMessageText();
  50. }
  51. public override IRequestMessageVideo NewRequestMessageVideo()
  52. {
  53. return new RequestMessageVideo();
  54. }
  55. public override IRequestMessageVoice NewRequestMessageVoice()
  56. {
  57. return new RequestMessageVoice();
  58. }
  59. public override IResponseMessageImage NewResponseMessageImage()
  60. {
  61. return new ResponseMessageImage();
  62. }
  63. public override IResponseMessageMpNews NewResponseMessageMpNews()
  64. {
  65. throw new MessageHandlerException("微信公众号不支持 IResponseMessageMpNews 响应类型");
  66. }
  67. public override IResponseMessageMusic NewResponseMessageMusic()
  68. {
  69. return new ResponseMessageMusic();
  70. }
  71. public override IResponseMessageNews NewResponseMessageNews()
  72. {
  73. return new ResponseMessageNews();
  74. }
  75. public override IResponseMessageText NewResponseMessageText()
  76. {
  77. return new ResponseMessageText();
  78. }
  79. public override IResponseMessageTransfer_Customer_Service NewResponseMessageTransfer_Customer_Service()
  80. {
  81. return new ResponseMessageTransfer_Customer_Service();
  82. }
  83. public override IResponseMessageVideo NewResponseMessageVideo()
  84. {
  85. return new ResponseMessageVideo();
  86. }
  87. public override IResponseMessageVoice NewResponseMessageVoice()
  88. {
  89. return new ResponseMessageVoice();
  90. }
  91. }
  92. }