脱敏优化

This commit is contained in:
2025-07-25 16:59:26 +08:00
parent 8ef4abded4
commit 4080bfca42
3 changed files with 3 additions and 9 deletions
+1 -4
View File
@@ -225,9 +225,6 @@ class CustomerController
$query->withTrashed(); $query->withTrashed();
} }
$sql = str_replace(['?'], ['\'%s\''], $query->toSql());
$fullSql = vsprintf($sql, $query->getBindings());
var_dump($fullSql);
$data = $query->paginate($perPage, ['*'], 'page', $page); $data = $query->paginate($perPage, ['*'], 'page', $page);
foreach ($data->items() as &$value) { foreach ($data->items() as &$value) {
@@ -236,7 +233,7 @@ class CustomerController
$value['phone'] = Util::mask($value['phone']); $value['phone'] = Util::mask($value['phone']);
$value['email'] = Util::mask($value['email']); $value['email'] = Util::mask($value['email']);
$value['WhatsApp'] = Util::mask($value['WhatsApp']); $value['WhatsApp'] = Util::mask($value['WhatsApp']);
$value['seas_time'] = time()-strtotime($value['deleted_at']); $value['seas_time'] = time()-(empty($value['deleted_at'])?strtotime($value['updated_at']):strtotime($value['deleted_at']));
} }
} }
+1
View File
@@ -99,6 +99,7 @@ class Customer extends Model
$customer = Util::formatDate($customer,['follow_last']); $customer = Util::formatDate($customer,['follow_last']);
$nameLang = $language=='en'?'name_en':($language=='ru'?'name_ru':'name'); $nameLang = $language=='en'?'name_en':($language=='ru'?'name_ru':'name');
$nameLang = 'name';
$countryLang = $language=='en'?'en_addr':'cn_addr'; $countryLang = $language=='en'?'en_addr':'cn_addr';
$customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value($nameLang); $customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value($nameLang);
$customer['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value($countryLang); $customer['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value($countryLang);
-4
View File
@@ -123,11 +123,7 @@ class Util
if(empty($str)){ if(empty($str)){
return ''; return '';
} }
// 只对 11 位手机号进行脱敏,中间 4 位用 * 替换
if (preg_match('/^1[3-9]\d{9}$/', $str)) {
return substr($str, 0, 3) . '****' . substr($str, -4); return substr($str, 0, 3) . '****' . substr($str, -4);
} }
return $str;
}
} }