公海数据脱敏

This commit is contained in:
2025-07-25 15:31:30 +08:00
parent 494e66488a
commit e84be2be04
3 changed files with 18 additions and 57 deletions
+6 -1
View File
@@ -217,15 +217,20 @@ class CustomerController
}
$recycle = Util::getParam($request,'recycle', '');
if ($recycle == 'recycle' || $seas == 'seas') {
if ($recycle == 'recycle') {
$query->onlyTrashed();
}
if ($seas == 'seas') {
$query->withTrashed()();
}
$data = $query->paginate($perPage, ['*'], 'page', $page);
foreach ($data->items() as &$value) {
$value = Customer::getCustomer($value, $request);
if($seas == 'seas'){
$value['phone'] = Util::mask($value['phone']);
$value['email'] = Util::mask($value['email']);
$value['seas_time'] = time()-strtotime($value['deleted_at']);
}
}
-56
View File
@@ -16,62 +16,6 @@ class Task
public function onWorkerStart()
{
// 每半小时执行一次
new Crontab('0 */30 * * * *', function(){
echo date('Y-m-d H:i:s') . "\n";
Log::info('send follow start',[time()]);
// FeishuController::send('xinyouhe','ou_e33bb3017ada6c4781398a68e55a4696', '跟进提醒', '您有新的跟进提醒', '');
// $customer = Customer::where(['follow_next', '<=', time() + 3600])
// ->where(['follow_next', '>', time()])
// ->where(['warn', '<', 1])
// ->get();
// foreach ($customer as $item) {
// $feishuUser = FeishuUser::where(['user_id' => $item->user_id])->first();
// if ($feishuUser) {
// // 获取凭证
// $certificate = config($this->config);
// // 使用parse_url解析URL
// $parsedUrl = parse_url($certificate['rUrl']);
// // 获取域名和端口
// $host = $parsedUrl['host'];
// $port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
// $url = $host .$port. '/pages/customer/detile?id='.$customer->id;
// $item->warn = 1;
// $item->update();
// $user = User::first()->where('id', $item->user_id);
// Log::info('send',['open_id'=>$item['open_id'],'url'=>$url]);
// // FeishuController::send('xinyouhe','ou_e33bb3017ada6c4781398a68e55a4696', '跟进提醒', '您有新的跟进提醒', $url);
// FeishuController::send($user->sign,$feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
// }
// }
$where = [
['follow_next', '<=', time() + 3600],
['follow_next', '>', time()],
['warn', '<', 1]
];
$customer = Customer::where($where)->get();
foreach ($customer as $item) {
$feishuUser = FeishuUser::where(['user_id' => $item->user_id])->first();
if ($feishuUser) {
// 获取凭证
$certificate = config('feishu.'.$feishuUser->sign);
// 使用parse_url解析URL
$parsedUrl = parse_url($certificate['rUrl']);
// 获取域名和端口
$host = $parsedUrl['host'];
$port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
$url = 'http://'. $host .$port. '/pages/customer/detile?id='.$item->id;
$item->warn = 1;
$item->update();
Log::info('send',['open_id'=>$item['open_id'],'url'=>$url]);
FeishuController::send($feishuUser->sign, $feishuUser->open_id, '跟进提醒', '您有新的跟进提醒', $url);
}
}
Log::info('send follow start',[time()]);
});
// 每小时执行一次
new Crontab('0 10 * * * *', function(){
+12
View File
@@ -118,4 +118,16 @@ class Util
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;
}
}