Browse Source

客户资料 API
增加 接口验证

leiy 1 year ago
parent
commit
2aa48dd5ae

+ 60 - 0
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -60,6 +60,14 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> QueryNewClientData(NewClientDataQueryDto dto)
         {
+            #region 参数验证
+            if (dto.OperationUserId < 0)
+                return Ok(JsonView(false, "请传入有效的OperationUserId参数!"));
+
+            if (dto.PortType < 0)
+                return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            #endregion
+
             JsonView jw = new JsonView();
             try
             {
@@ -94,6 +102,17 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostNewClientDataDetails(NewClientDataDetailsDto dto)
         {
+            #region 参数验证
+            if (dto.Id < 0)
+                return Ok(JsonView(false, "请传入有效的Id参数!"));
+
+            if (dto.UserId < 0)
+                return Ok(JsonView(false, "请传入有效的UserId参数!"));
+
+            if (dto.PortType < 0)
+                return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            #endregion
+
             JsonView jw = new JsonView();
             try
             {
@@ -127,6 +146,19 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> NewClientOp(NewClientOpDto dto)
         {
+            #region 参数验证
+
+            if (dto.CreateUserId < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的CreateUserId参数!"));
+            }
+
+            if (dto.PortType < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            }
+            #endregion
+
             try
             {
                 Domain.Result result = await _clientDataRepository.NewClientOp(dto);
@@ -163,6 +195,22 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> NewClientDel(DelBaseDto dto)
         {
+            #region 参数验证
+            if (dto.Id < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的Id参数!"));
+            }
+
+            if (dto.DeleteUserId < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的DeleteUserId参数!"));
+            }
+
+            if (dto.PortType < 0 )
+            {
+                return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            }
+            #endregion
             var res = await _clientDataRepository.DelNewClientData(dto);
             if (res.Code != 0)
             {
@@ -247,6 +295,18 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostBatchAssignment(BatchAssignmentDto dto)
         {
+            #region 参数验证
+            if (dto.UserId < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的UserId参数!"));
+            }
+
+            if (dto.PortType < 0)
+            {
+                return Ok(JsonView(false, "请传入有效的PortType参数!"));
+            }
+            #endregion
+
             var res = await _clientDataRepository._BatchAssignment(dto);
             if (res.Code != 0)
             {

+ 0 - 9
OASystem/OASystem.Api/OAMethodLib/Hubs/IChatClient.cs

@@ -1,9 +0,0 @@
-namespace OASystem.API.OAMethodLib.Hubs
-{
-    public interface IChatClient
-    {
-        Task ReceiveMessage(string user, string message);
-        Task ReceiveMessage(object message);
-        Task ReceiveCaller(object message);
-    }
-}

+ 6 - 0
OASystem/OASystem.Api/OAMethodLib/Hubs/ServerHub.cs

@@ -92,6 +92,12 @@ namespace OASystem.API.OAMethodLib.Hubs
             return base.OnDisconnectedAsync(exception);
         }
 
+        public async Task Send(string name, string message)
+        {
+            // Call the broadcastMessage method to update clients.
+            await Clients.All.SendAsync("broadcastMessage", name, message);
+        }
+
         /// <summary>
         /// 接受用户的数进行推送
         /// </summary>

+ 1 - 13
OASystem/OASystem.Api/OAMethodLib/Quartz/Business/TaskNewsFeedJob.cs

@@ -8,18 +8,6 @@ namespace OASystem.API.OAMethodLib.Quartz.Business
 {
     public static class TaskNewsFeedJob
     {
-        private readonly static TaskAllocationRepository _taskAllocationRep = AutofacIocManager.Instance.GetService<TaskAllocationRepository>();
-        private readonly static ILogger _logger;
-        private readonly static IHubContext<ServerHub> _hubContext = (IHubContext<ServerHub>)AutofacIocManager.Instance.GetService<ServerHub>();
-
-        /// <summary>
-        /// 定时任务更改状态
-        /// 每天下午六点定时更新
-        /// </summary>
-        public static async void PostTaskMessagePush()
-        {
-            
-            
-        }
+       
     }
 }

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/Quartz/Jobs/TaskNewsFeedJob.cs

@@ -30,7 +30,7 @@ namespace OASystem.API.OAMethodLib.Quartz.Jobs
         /// <returns></returns>
         public async Task Execute(IJobExecutionContext context)
         {
-            _logger.LogInformation("调用任务消息推送 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"【在线人数】:"+JsonConvert.SerializeObject(ServerHub.OnlineUser));
+            //_logger.LogInformation("调用任务消息推送 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")+"【在线人数】:"+JsonConvert.SerializeObject(ServerHub.OnlineUser));
 
             //在此处编写任务业务代码
             #region 消息处理

+ 1 - 0
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -48,6 +48,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 //负责人下拉框
                 List<dynamic> _Users = new List<dynamic>();
                 List<Sys_Users> users = _sqlSugar.Queryable<Sys_Users>().Where(u => u.IsDel == 0 && u.CompanyId == 2).ToList();
+
                 foreach (Sys_Users user in users)
                 {
                     var data = new