Commit 7503d0970a119f0810a5b4e4293f112aa2c1da70

Authored by “wangming”
1 parent 4df932e7

更新服务类:LqKdKdjlbService、WeChatBotService

netcore/src/Modularity/Extend/NCC.Extend/LqKdKdjlbService.cs
... ... @@ -523,37 +523,39 @@ namespace NCC.Extend.LqKdKdjlb
523 523 {
524 524 await _db.Insertable(allKjbsyjEntities).ExecuteCommandAsync();
525 525 }
526   -
527 526 //关闭事务
528 527 _db.CommitTran();
529   -
530 528 // 生成开单记录字符串并发送到企业微信
531 529 try
532 530 {
533   - var entityInfo = await GetInfo(newEntity.Id);
534   - if (entityInfo != null)
  531 + //判断如果开单金额大于0,则发送开单记录字符串到企业微信
  532 + if (newEntity.Sfyj > 0)
535 533 {
536   - var orderRecordString = _stringGenerator.GenerateOrderRecordString(entityInfo, HealthInstructorNames);
537   - Console.WriteLine("开单记录字符串生成成功:");
538   - Console.WriteLine(orderRecordString);
539   -
540   - // 发送到企业微信群
541   - try
  534 + var entityInfo = await GetInfo(newEntity.Id);
  535 + if (entityInfo != null)
542 536 {
543   - var sendResult = await _weChatBotService.SendOrderRecordMessage(orderRecordString);
544   - if (sendResult)
  537 + var orderRecordString = _stringGenerator.GenerateOrderRecordString(entityInfo, HealthInstructorNames);
  538 + Console.WriteLine("开单记录字符串生成成功:");
  539 + Console.WriteLine(orderRecordString);
  540 +
  541 + // 发送到企业微信群
  542 + try
545 543 {
546   - Console.WriteLine("开单记录已成功发送到企业微信群");
  544 + var sendResult = await _weChatBotService.SendOrderRecordMessage(orderRecordString);
  545 + if (sendResult)
  546 + {
  547 + Console.WriteLine("开单记录已成功发送到企业微信群");
  548 + }
  549 + else
  550 + {
  551 + Console.WriteLine("开单记录发送到企业微信群失败");
  552 + }
547 553 }
548   - else
  554 + catch (Exception wechatEx)
549 555 {
550   - Console.WriteLine("开单记录发送到企业微信群失败");
  556 + Console.WriteLine($"发送企业微信消息异常: {wechatEx.Message}");
551 557 }
552 558 }
553   - catch (Exception wechatEx)
554   - {
555   - Console.WriteLine($"发送企业微信消息异常: {wechatEx.Message}");
556   - }
557 559 }
558 560 }
559 561 catch (Exception ex)
... ...
netcore/src/Modularity/Extend/NCC.Extend/Utils/WeChatBotService.cs
... ... @@ -13,7 +13,12 @@ namespace NCC.Extend.Utils
13 13 {
14 14 private readonly HttpClient _httpClient;
15 15 private const string BOT_API_URL = "http://wx.lvqianmeiye.com/api/Bot/send-text";
16   - private const string WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83";
  16 + //正式地址
  17 + //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=581c22a6-cb67-42e5-8c76-b8e90052e188
  18 + //测试地址
  19 + //https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83
  20 + private const string WEBHOOK_URL = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=581c22a6-cb67-42e5-8c76-b8e90052e188";
  21 + private const string WEBHOOK_URL_TEST = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=6f8686ec-5011-4c1d-bae9-d82a2a2f4d83";
17 22  
18 23 public WeChatBotService(HttpClient httpClient)
19 24 {
... ...