diff --git a/app/controller/CustomerController.php b/app/controller/CustomerController.php index 2cccac4..1763baa 100644 --- a/app/controller/CustomerController.php +++ b/app/controller/CustomerController.php @@ -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']); } } diff --git a/app/process/Task.php b/app/process/Task.php index 97ae0fe..f8162ac 100644 --- a/app/process/Task.php +++ b/app/process/Task.php @@ -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(){ diff --git a/app/util/Util.php b/app/util/Util.php index 5e3d6a5..ec8e637 100644 --- a/app/util/Util.php +++ b/app/util/Util.php @@ -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; + } + } \ No newline at end of file