| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 查询订阅消息模板 |
| | | /// </summary> |
| | | /// <param name="command"></param> |
| | | /// <returns></returns> |
| | | public async Task<GetWxmpSubscribMessageTemplatesResponse> GetWxmpSubscribMessageTemplate(GetWxmpSubscribMessageTemplatesRequest command) |
| | | { |
| | | var option = options.Value.Items.FirstOrDefault(it => it.Code == command.WxmpCode); |
| | | if (option == null || option.AppId.IsNull() || option.AppSecret.IsNull()) |
| | | throw Oops.Oh(EnumErrorCodeType.s400, "发送订阅消息失败,缺失配置:WxmpOptions"); |
| | | var accessToken = await GetAccessToken(command.WxmpCode); |
| | | var jsonContent = JsonConvert.SerializeObject(command, new JsonSerializerSettings |
| | | { |
| | | NullValueHandling = NullValueHandling.Ignore |
| | | }); |
| | | var response = await httpRemoteService.GetAsAsync<GetWxmpSubscribMessageTemplatesResponse>( |
| | | "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate", |
| | | builder => builder.WithQueryParameter("access_token", accessToken)); |
| | | return response; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送订阅消息 |
| | | /// </summary> |
| | | /// <param name="command"></param> |