脱敏 RegexUtil.KeywordStar(valueT, null);


 /**
         * 关键字打星号
         * @param {*} signStr 
         * @param {b4a4,b6a4} keytype 
         * @returns 
         */
        public static string KeywordStar(string signStr, string keytype)
        {
            if (string.IsNullOrEmpty(signStr)) return signStr;
            if (keytype == "none")
            {
                return signStr;
            }
            else if (keytype == "b4a4")
            {
                return Regex.Replace(signStr, "^(.{3})(?:\\d+)(.{3})$", "$1****$2");
            }
            else if (keytype == "b6a4" || signStr.Length > 14)
            {
                return Regex.Replace(signStr, "^(.{6})(?:\\d+)(.{4})$", "$1****$2");
            }
            else
            {
                return Regex.Replace(signStr, "^(.{3})(?:\\d+)(.{3})$", "$1****$2");
            }
        }

脱敏用户

角色:ptexport

开发模式时候导出设置为需要脱敏

_desensitize=1


 var fromOpRmt = RequestModuleType.Export;
 if (dictionaryUrl.ContainsKey("_desensitize") && dictionaryUrl["_desensitize"].ToString() == "1")
 {
     fromOpRmt = RequestModuleType.Export;
 }
 else if (_authProvider.GetCurrentDeveloper(pf.OwnerId) || _authProvider.GetCurrentPfExport() == true)
 {
     //开发者运行脱敏显示原数据
     fromOpRmt = RequestModuleType.ExportDes;
 }
文档更新时间: 2024-05-03 09:11   作者:admin