Commit eb8191ac by 杨树贤

中文

parent 55b9e064
......@@ -18,30 +18,30 @@ class SupplierContactTransformer
if (!empty($item['supplier_email'])) {
$emailTemp = explode('@', $item['supplier_email'])[0];
$replace = str_pad('*', strlen($emailTemp), '*');
$emailTemp = str_replace($emailTemp, $replace, $emailTemp);
$emailTemp = mb_str_replace($emailTemp, $replace, $emailTemp);
if (count(explode('@', $item['supplier_email'])) > 1) {
$item['supplier_email'] = $emailTemp . '@' . explode('@', $item['supplier_email'])[1];
} else {
$item['supplier_email'] = $emailTemp;
}
}
if (!empty($item['supplier_mobile'])) {
if (!empty($item['supplier_mobile']) && !preg_match("/[\x{4e00}-\x{9fa5}]/u", $item['supplier_mobile'])) {
$temp = substr($item['supplier_mobile'], 3, 4);
$item['supplier_mobile'] = str_replace($temp, '****', $item['supplier_mobile']);
$item['supplier_mobile'] = mb_str_replace($temp, '****', $item['supplier_mobile']);
}
if (!empty($item['supplier_qq'])) {
$temp = substr($item['supplier_qq'], 2, strlen($item['supplier_qq']));
$replace = str_pad('*', strlen($temp), '*');
$item['supplier_qq'] = str_replace($temp, $replace, $item['supplier_qq']);
$item['supplier_qq'] = mb_str_replace($temp, $replace, $item['supplier_qq']);
}
if (!empty($item['supplier_telephone'])) {
if (count(explode('-', $item['supplier_telephone'])) > 1) {
$temp = explode('-', $item['supplier_telephone'])[1];
$replace = str_pad('*', strlen($temp), '*');
$item['supplier_telephone'] = str_replace($temp, $replace, $item['supplier_telephone']);
$item['supplier_telephone'] = mb_str_replace($temp, $replace, $item['supplier_telephone']);
} else {
$replace = str_pad('*', strlen($item['supplier_telephone']), '*');
$item['supplier_telephone'] = str_replace($item['supplier_telephone'], $replace,
$item['supplier_telephone'] = mb_str_replace($item['supplier_telephone'], $replace,
$item['supplier_telephone']);
}
......@@ -52,4 +52,4 @@ class SupplierContactTransformer
return $list;
}
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment