数据处理

This commit is contained in:
todaywindy 2025-06-27 17:09:43 +08:00
parent 403ff850e8
commit ad95e1d721

View File

@ -134,7 +134,13 @@ class Worker extends Backend
$worker_ids = [];
foreach ($list->items() as $item){
$dt = $item->toArray();
$dt['tel'] = substr($dt['tel'], 0, 3) . '****' . substr($dt['tel'], -4);
$tel = $dt['tel'];
if (preg_match('/^\d{7,}$/', $tel)) {
$dt['tel'] = mb_substr($tel, 0, 3, 'UTF-8') . '****' . mb_substr($tel, -4, null, 'UTF-8');
} else {
// 不处理非手机号,比如中文名称
$dt['tel'] = $tel;
}
$data[] = $dt;
$worker_ids [] = $item['id'];
}
@ -159,8 +165,8 @@ class Worker extends Backend
$result = array("total" => $list->total(), "rows" => $data);
return json($result);
// dd($result);
return $result;
}