PostModel.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. 文件名:PostModel.cs
  17. 文件功能描述:微信公众服务器Post过来的加密参数集合(不包括PostData)
  18. 创建标识:Senparc - 20150211
  19. 修改标识:Senparc - 20150303
  20. 修改描述:整理接口
  21. 修改标识:Senparc - 20150321
  22. 修改描述:v11.2.7 添加SetSecretInfo()方法
  23. 修改标识:Senparc - 20181117
  24. 修改描述:v16.5.0 添加 DomainId 属性
  25. ----------------------------------------------------------------*/
  26. using Senparc.NeuChar;
  27. namespace Senparc.Weixin.MP.Entities.Request
  28. {
  29. /// <summary>
  30. /// 微信公众服务器Post过来的加密参数集合(不包括PostData)
  31. /// <para>如需使用 NeuChar,需要在 MessageHandler 中提供 PostModel 并设置 AppId</para>
  32. /// </summary>
  33. public class PostModel : EncryptPostModel
  34. {
  35. public override string DomainId { get => AppId; set => AppId = value; }
  36. //以下信息不会出现在微信发过来的信息中,都是微信后台需要设置(获取的)的信息,用于扩展传参使用
  37. /// <summary>
  38. /// 当前请求对应的微信 AppId
  39. /// 如需在 MessageHandler 中使用 NeuChar 进行消息处理,请无比在此处提供 AppId,并对AppId-Secret进行注册,以便自动调用高级接口(如自动发送客服消息)
  40. /// </summary>
  41. public string AppId { get; set; }
  42. /// <summary>
  43. /// 设置服务器内部保密信息
  44. /// </summary>
  45. /// <param name="token"></param>
  46. /// <param name="encodingAESKey"></param>
  47. /// <param name="appId"></param>
  48. public void SetSecretInfo(string token, string encodingAESKey, string appId)
  49. {
  50. Token = token;
  51. EncodingAESKey = encodingAESKey;
  52. AppId = appId;
  53. }
  54. }
  55. }