Procházet zdrojové kódy

完成工单详情脱敏

qinchaoyue před 7 měsíci
rodič
revize
589532baaa

+ 2 - 1
src/Hotline.Api/Controllers/OrderController.cs

@@ -3012,8 +3012,9 @@ public class OrderController : BaseController
         {
             dto.IsReturnUnderApproval = true;
         }
+        
 
-        return dto;
+        return _sessionContext.OrgIsCenter ? dto : dto.DataMask();
     }
 
     /// <summary>

+ 12 - 0
src/Hotline.Api/Filter/DataMaskingAttribute.cs

@@ -0,0 +1,12 @@
+using Microsoft.AspNetCore.Mvc.Filters;
+
+namespace Hotline.Api.Filter;
+
+public class DataMaskingAttribute : ActionFilterAttribute
+{
+    public override void OnActionExecuted(ActionExecutedContext context)
+    {
+        var result = context.Result;
+        base.OnActionExecuted(context);
+    }
+}

+ 18 - 1
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -664,6 +664,22 @@ namespace Hotline.Share.Dtos.Order
             return overDays;
         }
 
+        public OrderDto DataMask()
+        {
+            if (this.IsSecret == false) return this;
+            var maskString = "***";
+            this.Contact = maskString;
+            this.FromName = maskString;
+            this.FromGender = EGender.Unknown;
+            this.FromPhone = maskString;
+
+            this.FullAddress = maskString;
+            this.Address = maskString;
+            this.City = maskString;
+            this.Street = maskString;
+            return this;
+        }
+
         /// <summary>
         /// 中心意见
         /// </summary>
@@ -708,7 +724,8 @@ namespace Hotline.Share.Dtos.Order
         /// 退回截至时间
         /// </summary>
         public DateTime? SendBackAuditEndTime { get; set; }
-	}
+
+    }
 
     public class UpdateOrderDto : AddOrderDto
     {