Accept Merge Request #193: (feature/hant -> develop)

Merge Request: 数据处理

Created By: @todayswind
Accepted By: @todayswind
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/193?initial=true
This commit is contained in:
todayswind 2025-06-27 17:11:00 +08:00 committed by Coding
commit 8e382b3cbc

View File

@ -134,7 +134,13 @@ class Worker extends Backend
$worker_ids = []; $worker_ids = [];
foreach ($list->items() as $item){ foreach ($list->items() as $item){
$dt = $item->toArray(); $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; $data[] = $dt;
$worker_ids [] = $item['id']; $worker_ids [] = $item['id'];
} }
@ -159,8 +165,8 @@ class Worker extends Backend
$result = array("total" => $list->total(), "rows" => $data); $result = array("total" => $list->total(), "rows" => $data);
// dd($result);
return json($result); return $result;
} }