diff --git a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs index 6dae74b..d02bc86 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs @@ -523,37 +523,39 @@ namespace NCC.Extend.LqKdKdjlb { await _db.Insertable(allKjbsyjEntities).ExecuteCommandAsync(); } - //关闭事务 _db.CommitTran(); - // 生成开单记录字符串并发送到企业微信 try { - var entityInfo = await GetInfo(newEntity.Id); - if (entityInfo != null) + //判断如果开单金额大于0,则发送开单记录字符串到企业微信 + if (newEntity.Sfyj > 0) { - var orderRecordString = _stringGenerator.GenerateOrderRecordString(entityInfo, HealthInstructorNames); - Console.WriteLine("开单记录字符串生成成功:"); - Console.WriteLine(orderRecordString); - - // 发送到企业微信群 - try + var entityInfo = await GetInfo(newEntity.Id); + if (entityInfo != null) { - var sendResult = await _weChatBotService.SendOrderRecordMessage(orderRecordString); - if (sendResult) + var orderRecordString = _stringGenerator.GenerateOrderRecordString(entityInfo, HealthInstructorNames); + Console.WriteLine("开单记录字符串生成成功:"); + Console.WriteLine(orderRecordString); + + // 发送到企业微信群 + try { - Console.WriteLine("开单记录已成功发送到企业微信群"); + var sendResult = await _weChatBotService.SendOrderRecordMessage(orderRecordString); + if (sendResult) + { + Console.WriteLine("开单记录已成功发送到企业微信群"); + } + else + { + Console.WriteLine("开单记录发送到企业微信群失败"); + } } - else + catch (Exception wechatEx) { - Console.WriteLine("开单记录发送到企业微信群失败"); + Console.WriteLine($"发送企业微信消息异常: {wechatEx.Message}"); } } - catch (Exception wechatEx) - { - Console.WriteLine($"发送企业微信消息异常: {wechatEx.Message}"); - } } } catch (Exception ex) diff --git a/netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs b/netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs index ac4b177..0df2a6e 100644 --- a/netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs +++ b/netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs @@ -13,7 +13,12 @@ namespace NCC.Extend.Utils { private readonly HttpClient _httpClient; private const string BOT_API_URL = "http://wx.lvqianmeiye.com/api/Bot/send-text"; - private const string WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83"; + //正式地址 + //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=581c22a6-cb67-42e5-8c76-b8e90052e188 + //测试地址 + //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83 + private const string WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=581c22a6-cb67-42e5-8c76-b8e90052e188"; + private const string WEBHOOK_URL_TEST = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83"; public WeChatBotService(HttpClient httpClient) {