From 72ed026e6dc651e7bd1f77f41face93a7a9f49cb Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期四, 27 三月 2025 08:58:34 +0800
Subject: [PATCH] fix:新增在线客服配置、户号编辑功能优化、用户列表更新

---
 LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs      |    8 ++
 LifePayment/LifePayment.Domain/Common/OnlineService.cs                      |   14 +++
 LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml  |   17 ++++
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs                |   29 +++++++
 LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs |    3 
 LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml                 |   13 +++
 LifePayment/LifePayment.Application/Setting/CommonService.cs                |   50 ++++++++++++
 LifePayment/LifePayment.Application.Contracts/Setting/ICommonService.cs     |   15 +++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs               |   44 +++++++---
 9 files changed, 176 insertions(+), 17 deletions(-)

diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
index 0659e93..16a9684 100644
--- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
+++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -1100,4 +1100,12 @@
 public class ChannelRateOutput
 {
     public decimal ChannlesRate { get; set; }
+}
+
+public class OnlineServiceInput
+{
+    /// <summary>
+    /// 鍦ㄧ嚎瀹㈡湇閾炬帴
+    /// </summary>
+    public string Link { get; set; }
 }
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application.Contracts/Setting/ICommonService.cs b/LifePayment/LifePayment.Application.Contracts/Setting/ICommonService.cs
new file mode 100644
index 0000000..2f4a953
--- /dev/null
+++ b/LifePayment/LifePayment.Application.Contracts/Setting/ICommonService.cs
@@ -0,0 +1,15 @@
+锘縰sing System.Collections.Generic;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+
+namespace LifePayment.Application.Contracts
+{
+    public interface ICommonService : IApplicationService
+    {
+
+        Task<string> GetOnlineService();
+
+        Task UpdateOnlineService(OnlineServiceInput input);
+        
+    }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 405d11c..4820c56 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1537,7 +1537,7 @@
             var userAccount = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.Id == input.Id)
                                             .FirstOrDefaultAsync();
             CheckExtensions.IfTrueThrowUserFriendlyException(userAccount == null, "鎴峰彿涓嶅瓨鍦�");
-            var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id)
+            var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.Id != input.Id && x.IsDeleted == false)
                                             .FirstOrDefaultAsync();
             CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�");
 
@@ -1551,22 +1551,36 @@
         }
         else
         {
-            var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content)
+            var repeatAccountContent = await _lifePayAccount.Where(x => x.UserId == input.UserId && x.LifePayType == input.LifePayType && x.Content == input.Content && x.IsDeleted == false)
                                             .FirstOrDefaultAsync();
-            CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�");
-            var userAccount = new LifePayAccount
+            /// CheckExtensions.IfTrueThrowUserFriendlyException(repeatAccountContent != null, "鎴峰彿宸插瓨鍦�");
+            if (repeatAccountContent != null)
             {
-                Id = Guid.NewGuid(),
-                UserId = input.UserId,
-                Content = input.Content,
-                Province = input.Province,
-                LifePayType = input.LifePayType,
-                City = input.City,
-                Remark = input.Remark,
-                Operators = input.Operators,
-                ExtraProperties = input.ExtraProperties,
-            };
-            await _lifePayAccount.InsertAsync(userAccount);
+                repeatAccountContent.LifePayType = input.LifePayType;
+                repeatAccountContent.Content = input.Content;
+                repeatAccountContent.Province = input.Province;
+                repeatAccountContent.City = input.City;
+                repeatAccountContent.Remark = input.Remark;
+                repeatAccountContent.Operators = input.Operators;
+                repeatAccountContent.ExtraProperties = input.ExtraProperties;
+            }
+            else
+            {
+                var userAccount = new LifePayAccount
+                {
+                    Id = Guid.NewGuid(),
+                    UserId = input.UserId,
+                    Content = input.Content,
+                    Province = input.Province,
+                    LifePayType = input.LifePayType,
+                    City = input.City,
+                    Remark = input.Remark,
+                    Operators = input.Operators,
+                    ExtraProperties = input.ExtraProperties,
+                };
+                await _lifePayAccount.InsertAsync(userAccount);
+            }
+            
         }
 
         if (input.LifePayType == LifePayOrderTypeEnum.璇濊垂璁㈠崟)
diff --git a/LifePayment/LifePayment.Application/Setting/CommonService.cs b/LifePayment/LifePayment.Application/Setting/CommonService.cs
new file mode 100644
index 0000000..842a935
--- /dev/null
+++ b/LifePayment/LifePayment.Application/Setting/CommonService.cs
@@ -0,0 +1,50 @@
+锘縰sing LifePayment.Application.Contracts;
+using LifePayment.Domain.Common;
+using LifePayment.Domain.Models;
+using LifePayment.Domain.Shared;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+
+namespace LifePayment.Application
+{
+    public class CommonService : ApplicationService, ICommonService
+    {
+        private readonly IRepository<OnlineService, Guid> _onlineServiceRepository;
+
+        public CommonService(
+               IRepository<OnlineService, Guid> onlineServiceRepository)
+        {
+            _onlineServiceRepository = onlineServiceRepository;
+        }
+
+        public async Task<string> GetOnlineService()
+        {
+            var query = await _onlineServiceRepository.FirstOrDefaultAsync();
+           
+            return query.Link;
+        }
+
+        public async Task UpdateOnlineService(OnlineServiceInput input)
+        {
+            var area = await _onlineServiceRepository.FirstOrDefaultAsync();
+            if (area != null)
+            {
+                area.Link = input.Link;
+            }
+            else
+            {
+                OnlineService onlineService = new OnlineService()
+                {
+                    Id = Guid.NewGuid(),
+                    Link = input
+                };
+                await _onlineServiceRepository.InsertAsync(onlineService);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/LifePayment/LifePayment.Domain/Common/OnlineService.cs b/LifePayment/LifePayment.Domain/Common/OnlineService.cs
new file mode 100644
index 0000000..cf4408c
--- /dev/null
+++ b/LifePayment/LifePayment.Domain/Common/OnlineService.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Entities;
+
+namespace LifePayment.Domain.Common
+{
+    public class OnlineService : Entity<Guid>, IAggregateRoot<Guid>
+    {
+        public string Link { get; set; }
+    }
+}
diff --git a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
index effc166..e232ed4 100644
--- a/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
+++ b/LifePayment/LifePayment.EntityFrameworkCore/LifePaymentServicesDbContext.cs
@@ -1,4 +1,5 @@
 using LifePayment.Domain;
+using LifePayment.Domain.Common;
 using LifePayment.Domain.LifePay;
 using LifePayment.Domain.Models;
 using Microsoft.EntityFrameworkCore;
@@ -30,6 +31,8 @@
 
         public virtual DbSet<Role> Roles { get; set; }
 
+        public virtual DbSet<OnlineService> OnlineService { get; set; }
+
         public virtual DbSet<LifePayIntroInfo> LifePayIntroInfo { get; set; }
 
         public virtual DbSet<UserRole> UserRoles { get; set; }
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index 5af6b0a..a4edee5 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -122,6 +122,12 @@
             </summary>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.LifePayController.GetOnlineService">
+            <summary>
+            鑾峰彇鍦ㄧ嚎瀹㈡湇
+            </summary>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.LifePayController.GetUserPage(LifePayment.Application.Contracts.QueryUserPageInput)">
             <summary>
             鑾峰彇鐢ㄦ埛鍒嗛〉鏁版嵁
@@ -348,6 +354,13 @@
             <param name="input"></param>
             <returns></returns>
         </member>
+        <member name="M:LifePayment.HttpApi.LifePayController.UpdateOnlineService(System.String)">
+            <summary>
+            鍦ㄧ嚎瀹㈡湇閰嶇疆
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="M:LifePayment.HttpApi.LifePayController.SetLifePayOrderPayType(LifePayment.Domain.Shared.SetLifePayOrderPayTypeInput)">
             <summary>
             璁剧疆鐢熸椿缂磋垂鏀粯绫诲瀷
diff --git a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
index a7b1079..f90c317 100644
--- a/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentServices.Application.Contracts.xml
@@ -645,7 +645,22 @@
         </member>
         <member name="P:LifePayment.Application.Contracts.QueryUserPageInput.CreationTimeBegin">
             <summary>
-            娉ㄥ唽鏃堕棿
+            娉ㄥ唽寮�濮嬫椂闂�
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.QueryUserPageInput.CreationTimeEnd">
+            <summary>
+            娉ㄥ唽缁撴潫鏃堕棿
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.QueryUserPageInput.LoginTimeBegin">
+            <summary>
+            鐧诲綍寮�濮嬫椂闂�
+            </summary>
+        </member>
+        <member name="P:LifePayment.Application.Contracts.QueryUserPageInput.LoginTimeEnd">
+            <summary>
+            鐧诲綍缁撴潫鏃堕棿
             </summary>
         </member>
         <member name="P:LifePayment.Application.Contracts.OrderPriceReturn.PlatformPrice">
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index ce05b3d..08f7441 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -1,4 +1,5 @@
 锘縰sing LifePayment.Application.Contracts;
+using LifePayment.Domain.Common;
 using LifePayment.Domain.Shared;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
@@ -22,17 +23,20 @@
         private readonly ILifePayService _lifePayService;
         private readonly IStatisticsService _statisticsService;
         private readonly IWebClientInfoProvider _webClientInfoProvider;
+        private readonly ICommonService _commonService;
         private readonly ILogger<LifePayController> _logger;
         public LifePayController(
               ILifePayService lifePayService,
               IStatisticsService statisticsService,
-              IWebClientInfoProvider webClientInfoProvider
+              IWebClientInfoProvider webClientInfoProvider,
+              ICommonService commonService
             , ILogger<LifePayController> logger
               )
         {
             _lifePayService = lifePayService;
             _statisticsService = statisticsService;
             _webClientInfoProvider = webClientInfoProvider;
+            _commonService = commonService;
             _logger = logger;
         }
 
@@ -182,6 +186,16 @@
             return await _lifePayService.GetIntroInfo(type);
         }
 
+        /// <summary>
+        /// 鑾峰彇鍦ㄧ嚎瀹㈡湇
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        [AllowAnonymous]
+        public async Task<string> GetOnlineService()
+        {
+            return await _commonService.GetOnlineService();
+        }
 
         /// <summary>
         /// 鑾峰彇鐢ㄦ埛鍒嗛〉鏁版嵁
@@ -596,6 +610,19 @@
         }
 
         /// <summary>
+        /// 鍦ㄧ嚎瀹㈡湇閰嶇疆
+        /// </summary>
+        /// <param name="input"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<int> UpdateOnlineService(OnlineServiceInput input)
+        {
+            await _commonService.UpdateOnlineService(input);
+            return Constant.SUCCESS;
+        }
+
+
+        /// <summary>
         /// 璁剧疆鐢熸椿缂磋垂鏀粯绫诲瀷
         /// </summary>
         /// <param name="input"></param>

--
Gitblit v1.9.1