From 98e3dc033cf993a8d9738504e5d4370b3a17a78c Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Fri, 25 Jul 2025 15:19:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E6=B5=B7=E4=BF=A1=E6=81=AF=E8=84=B1?= =?UTF-8?q?=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/crm/service/CustomerService.php | 2 ++ app/crm/utils/Util.php | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/app/crm/service/CustomerService.php b/app/crm/service/CustomerService.php index f4b498f..4c66414 100644 --- a/app/crm/service/CustomerService.php +++ b/app/crm/service/CustomerService.php @@ -91,6 +91,8 @@ class CustomerService foreach ($customer as &$item) { $item = $this->getCustomer($item); if($seas == 'seas'){ + $item['phone'] = Util::mask($item['phone']); + $item['email'] = Util::mask($item['email']); $item['seas_time'] = time()-(empty($item['deleted_at'])?strtotime($item['updated_at']):strtotime($item['deleted_at'])); } } diff --git a/app/crm/utils/Util.php b/app/crm/utils/Util.php index db6743b..afc05b9 100644 --- a/app/crm/utils/Util.php +++ b/app/crm/utils/Util.php @@ -118,4 +118,16 @@ class Util return $en; } + public static function mask($str) + { + if(empty($str)){ + return ''; + } + // 只对 11 位手机号进行脱敏,中间 4 位用 * 替换 + if (preg_match('/^1[3-9]\d{9}$/', $str)) { + return substr($str, 0, 3) . '****' . substr($str, -4); + } + return $str; + } + } \ No newline at end of file