|
|
|
@ -31,6 +31,8 @@ namespace _24Hour
|
|
|
|
|
/// 小程序secretID |
|
|
|
|
/// </summary> |
|
|
|
|
private string secid = "e752e4fba67526eca21313a18c96a58f"; |
|
|
|
|
private string TemplateIdSuccess { get; set; } = ""; |
|
|
|
|
private string TemplateIdFail { get; set; } = ""; |
|
|
|
|
private readonly ILogger<WechatMessagerClient> logger; |
|
|
|
|
public WechatMessagerClient(HttpClient _httpCliet, IConfiguration configuration, ILogger<WechatMessagerClient> _logger) |
|
|
|
|
{ |
|
|
|
@ -44,6 +46,8 @@ namespace _24Hour
|
|
|
|
|
appid = $"{configuration.GetSection("Wechat:appid").Value}"; |
|
|
|
|
secret = $"{configuration.GetSection("Wechat:secret").Value}"; |
|
|
|
|
secid = $"{configuration.GetSection("Wechat:secid").Value}"; |
|
|
|
|
TemplateIdSuccess = $"{configuration.GetSection("Wechat:templateIdSuccess").Value}"; |
|
|
|
|
TemplateIdFail = $"{configuration.GetSection("Wechat:templateIdFail").Value}"; |
|
|
|
|
} |
|
|
|
|
public async Task<Result> GetOpenId(string code) |
|
|
|
|
{ |
|
|
|
@ -112,7 +116,8 @@ namespace _24Hour
|
|
|
|
|
msg = new |
|
|
|
|
{ |
|
|
|
|
touser = useropenId, |
|
|
|
|
template_id = "XgrMTq1gwDfMJI6vN0jsSEv3xGy7v3amh0JMWj4SnAY", |
|
|
|
|
//兼容北关区模板id,那边的配置文件没有模板id的字段 |
|
|
|
|
template_id = string.IsNullOrEmpty(TemplateIdSuccess) ? "XgrMTq1gwDfMJI6vN0jsSEv3xGy7v3amh0JMWj4SnAY" : TemplateIdSuccess, |
|
|
|
|
page = "pages/selfService/reception/reception", |
|
|
|
|
miniprogram_state = $"{_configuration.GetSection("Wechat:miniprogram_state").Value}", |
|
|
|
|
lang = "zh_CN", |
|
|
|
@ -185,7 +190,8 @@ namespace _24Hour
|
|
|
|
|
msg = new |
|
|
|
|
{ |
|
|
|
|
touser = useropenId, |
|
|
|
|
template_id = "bfA-t5EN4pkQzAOS17SRPRKvmMteaJt0kw3YKIcovIQ", |
|
|
|
|
//兼容北关区模板id,那边的配置文件没有模板id的字段 |
|
|
|
|
template_id = string.IsNullOrEmpty(TemplateIdFail) ? "bfA-t5EN4pkQzAOS17SRPRKvmMteaJt0kw3YKIcovIQ" : TemplateIdFail, |
|
|
|
|
page = "pages/selfService/reception/reception", |
|
|
|
|
miniprogram_state = $"{_configuration.GetSection("Wechat:miniprogram_state").Value}", |
|
|
|
|
lang = "zh_CN", |
|
|
|
|