From b29975f06dba169e14f9e92de1403ce54d385f20 Mon Sep 17 00:00:00 2001 From: guob yuano Date: Thu, 17 Sep 2026 11:28:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8D=87=E6=8E=A5=E5=8F=A3=E9=80=9F?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ApptController.cs | 8 ++++---- api_v1/Appointment.IRepository/IApptRepo.cs | 5 +++-- api_v1/Appointment.Repository/ApptRepo.cs | 19 +++++++++++-------- api_v1/Appointment.Repository/ApptRepoJNC.cs | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/api_v1/Appointment.Api/Appointment.Api/Controllers/ApptController.cs b/api_v1/Appointment.Api/Appointment.Api/Controllers/ApptController.cs index c876e58..516253d 100644 --- a/api_v1/Appointment.Api/Appointment.Api/Controllers/ApptController.cs +++ b/api_v1/Appointment.Api/Appointment.Api/Controllers/ApptController.cs @@ -83,9 +83,9 @@ namespace Appointment.Api.Controllers /// /// [HttpPost("Add")] - public ApiResult Add(ApptSummaryReq req) + public async Task Add(ApptSummaryReq req) { - return _ApptRepo.Add(req); + return await _ApptRepo.Add(req); } /// @@ -94,9 +94,9 @@ namespace Appointment.Api.Controllers /// /// [HttpPost("ApptAudit")] - public ApiResult ApptAudit(ApptAuditReq req) + public async Task ApptAudit(ApptAuditReq req) { - return _ApptRepo.ApptAudit(req); + return await _ApptRepo.ApptAudit(req); } [HttpPost("CancelAudit")] diff --git a/api_v1/Appointment.IRepository/IApptRepo.cs b/api_v1/Appointment.IRepository/IApptRepo.cs index c7167d0..83ccf96 100644 --- a/api_v1/Appointment.IRepository/IApptRepo.cs +++ b/api_v1/Appointment.IRepository/IApptRepo.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Data; using System.Text; +using System.Threading.Tasks; namespace Appointment.IRepository { @@ -46,7 +47,7 @@ namespace Appointment.IRepository /// /// /// - ApiResult Add(ApptSummaryReq req); + Task Add(ApptSummaryReq req); /// /// 删除主单或详情 @@ -60,7 +61,7 @@ namespace Appointment.IRepository /// /// /// - public ApiResult ApptAudit(ApptAuditReq req); + Task ApptAudit(ApptAuditReq req); /// /// 取消预订 diff --git a/api_v1/Appointment.Repository/ApptRepo.cs b/api_v1/Appointment.Repository/ApptRepo.cs index ba0fe67..06c3b25 100644 --- a/api_v1/Appointment.Repository/ApptRepo.cs +++ b/api_v1/Appointment.Repository/ApptRepo.cs @@ -282,7 +282,7 @@ namespace Appointment.Repository /// /// /// - public ApiResult Add(ApptSummaryReq req) + public async Task Add(ApptSummaryReq req) { DateTime now = DateTime.Now; @@ -654,7 +654,7 @@ namespace Appointment.Repository Remark = "自动" }; InsertReturnId(auditLog); - return InAppt(summaryId); + return await InAppt(summaryId); } else { @@ -729,7 +729,7 @@ namespace Appointment.Repository /// /// /// - public ApiResult ApptAudit(ApptAuditReq req) + public async Task ApptAudit(ApptAuditReq req) { var loginUserRes = BaseRepo.DECLoginInfo(req.AccountDES); if (!loginUserRes.IsSuccess) return ApiResult.Failed(loginUserRes.Msg); @@ -758,7 +758,7 @@ namespace Appointment.Repository } else { - return InAppt(req.ApptId); + return await InAppt(req.ApptId); } @@ -1420,7 +1420,7 @@ namespace Appointment.Repository /// /// /// - private ApiResult InAppt(int id) + private async Task InAppt(int id) { var appt = GetDataModel(id); if (!appt.IsSuccess) return ApiResult.Failed(appt.Msg); @@ -1431,7 +1431,7 @@ namespace Appointment.Repository DateTime now = DateTime.Now; - var userList = Db.Queryable().ToList().Replace(); + var userList =await Db.Queryable().ToListAsync().Replace(); var user = userList.Where(t => t.OpId == appt.Info.UserId).FirstOrDefault(); if (user == null && user.Locked == "T") return ApiResult.Failed("生成正式预订失败,提交人不存在!"); @@ -1709,7 +1709,7 @@ namespace Appointment.Repository }); if (!string.IsNullOrEmpty(item.WxServiceId)) { - SetCopyMsg(item.WxServiceId); + _ = SetCopyMsg(item.WxServiceId); } } InsertRange(apptAuditLogs); @@ -1879,10 +1879,11 @@ namespace Appointment.Repository /// 抄送 消息模板 /// /// 接收人程序openid - private void SetCopyMsg(string wxSericeOpenId) + private async Task SetCopyMsg(string wxSericeOpenId) { try { + await Task.Delay(1); string AppId = BaseConfig.App(new string[] { "WeChatService", "AppId" }); if (AppId == "wx3f193488e04b2ed8") { @@ -1925,6 +1926,8 @@ namespace Appointment.Repository { _logger.Error(ex.ToString()); } + + return ApiResult.Success(string.Empty); } } } diff --git a/api_v1/Appointment.Repository/ApptRepoJNC.cs b/api_v1/Appointment.Repository/ApptRepoJNC.cs index ee87c51..76d0606 100644 --- a/api_v1/Appointment.Repository/ApptRepoJNC.cs +++ b/api_v1/Appointment.Repository/ApptRepoJNC.cs @@ -4526,7 +4526,7 @@ namespace Appointment.Repository }); if (!string.IsNullOrEmpty(item.WxServiceId)) { - _ = await SetCopyMsg(createUserName, summary.BuyerTitle, item.WxServiceId, true, ""); + _ = SetCopyMsg(createUserName, summary.BuyerTitle, item.WxServiceId, true, ""); } } InsertRange(apptAuditLogs);