WeixinTemplateBase.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #region Apache License Version 2.0
  2. /*----------------------------------------------------------------
  3. Copyright 2019 Jeffrey Su & Suzhou Senparc Network Technology Co.,Ltd.
  4. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
  5. except in compliance with the License. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software distributed under the
  8. License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  9. either express or implied. See the License for the specific language governing permissions
  10. and limitations under the License.
  11. Detail: https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md
  12. ----------------------------------------------------------------*/
  13. #endregion Apache License Version 2.0
  14. /*----------------------------------------------------------------
  15. Copyright (C) 2019 Senparc
  16. 文件名:EntityBase.cs
  17. 文件功能描述:EntityBase
  18. 创建标识:Senparc - 20170131
  19. 创建描述:v4.10.0 添加TemplateMessageBase作为所有模板消息数据实体基类
  20. ----------------------------------------------------------------*/
  21. using System;
  22. using System.Collections.Generic;
  23. using System.Linq;
  24. using System.Text;
  25. namespace Senparc.Weixin.Entities.TemplateMessage
  26. {
  27. /// <summary>
  28. /// 模板消息数据基础类接口
  29. /// </summary>
  30. public interface ITemplateMessageBase
  31. {
  32. /// <summary>
  33. /// Url,为null时会自动忽略
  34. /// </summary>
  35. string TemplateId { get; set; }
  36. /// <summary>
  37. /// Url,为null时会自动忽略
  38. /// </summary>
  39. string Url { get; set; }
  40. /// <summary>
  41. /// 模板名称
  42. /// </summary>
  43. string TemplateName { get; set; }
  44. }
  45. /// <summary>
  46. /// 模板消息数据基础类
  47. /// </summary>
  48. public abstract class TemplateMessageBase : ITemplateMessageBase
  49. {
  50. /// <summary>
  51. /// 每个公众号都不同的templateId
  52. /// </summary>
  53. public string TemplateId { get; set; }
  54. /// <summary>
  55. /// Url,为null时会自动忽略
  56. /// </summary>
  57. public string Url { get; set; }
  58. /// <summary>
  59. /// 模板名称
  60. /// </summary>
  61. public string TemplateName { get; set; }
  62. public TemplateMessageBase(string templateId, string url, string templateName)
  63. {
  64. TemplateId = templateId;
  65. Url = url;
  66. TemplateName = templateName;
  67. }
  68. }
  69. }