公海信息脱敏
This commit is contained in:
@@ -91,6 +91,8 @@ class CustomerService
|
|||||||
foreach ($customer as &$item) {
|
foreach ($customer as &$item) {
|
||||||
$item = $this->getCustomer($item);
|
$item = $this->getCustomer($item);
|
||||||
if($seas == 'seas'){
|
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']));
|
$item['seas_time'] = time()-(empty($item['deleted_at'])?strtotime($item['updated_at']):strtotime($item['deleted_at']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,4 +118,16 @@ class Util
|
|||||||
return $en;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user