作者 赵彬吉

update

@@ -10,6 +10,7 @@ namespace App\Console\Commands\Inquiry; @@ -10,6 +10,7 @@ namespace App\Console\Commands\Inquiry;
10 use App\Helper\Common; 10 use App\Helper\Common;
11 use App\Helper\Gpt; 11 use App\Helper\Gpt;
12 use App\Helper\Translate; 12 use App\Helper\Translate;
  13 +use App\Helper\Validate;
13 use App\Models\Ai\AiCommand; 14 use App\Models\Ai\AiCommand;
14 use App\Models\Inquiry\ReInquiryConfig; 15 use App\Models\Inquiry\ReInquiryConfig;
15 use App\Models\Inquiry\ReInquiryDetail; 16 use App\Models\Inquiry\ReInquiryDetail;
@@ -329,7 +330,10 @@ class RelayInquiry extends Command @@ -329,7 +330,10 @@ class RelayInquiry extends Command
329 $val->save(); 330 $val->save();
330 continue; 331 continue;
331 } 332 }
332 - 333 + //验证手机号 无效 号码不推送
  334 + if(!Validate::phone($val->phone)){
  335 + $val->phone = '';
  336 + }
333 try { 337 try {
334 $res = false; 338 $res = false;
335 foreach ($ad_task as $task){ 339 foreach ($ad_task as $task){
@@ -382,6 +386,10 @@ class RelayInquiry extends Command @@ -382,6 +386,10 @@ class RelayInquiry extends Command
382 return '过滤邮箱:' . $filter_email; 386 return '过滤邮箱:' . $filter_email;
383 } 387 }
384 } 388 }
  389 + //邮箱有效性
  390 + if(!Validate::email($data['email'])){
  391 + return '邮箱无效';
  392 + }
385 } 393 }
386 //过滤电话 394 //过滤电话
387 if(!empty($data['phone']) && !empty($config['filter_mobiles'])){ 395 if(!empty($data['phone']) && !empty($config['filter_mobiles'])){
  1 +<?php
  2 +
  3 +
  4 +namespace App\Helper;
  5 +
  6 +use App\Utils\HttpUtils;
  7 +use GuzzleHttp\Exception\GuzzleException;
  8 +
  9 +
  10 +/**
  11 + * Class Validate
  12 + * @package App\Helper
  13 + * @author zbj
  14 + * @date 2025/2/27
  15 + */
  16 +class Validate
  17 +{
  18 + /**
  19 + * 邮箱有效性
  20 + * @param $email
  21 + * @return bool
  22 + * @author zbj
  23 + * @date 2025/2/27
  24 + */
  25 + public static function email($email)
  26 + {
  27 + try {
  28 + $res = HttpUtils::get('https://fob.ai.cc/api/check_email', ['email' => $email]);
  29 + $res = Arr::s2a($res);
  30 + $status = $res['data']['status'] ?? 0;
  31 + } catch (\Exception | GuzzleException $e) {
  32 + $status = 0;
  33 + }
  34 + return !($status == 4);
  35 + }
  36 +
  37 + /**
  38 + * 邮箱有效性
  39 + * @param $email
  40 + * @return bool
  41 + * @author zbj
  42 + * @date 2025/2/27
  43 + */
  44 + public static function phone($email)
  45 + {
  46 + try {
  47 + $res = HttpUtils::get('https://fob.ai.cc/api/check_phone', ['phone' => $email]);
  48 + $res = Arr::s2a($res);
  49 + $status = $res['data']['status'] ?? 0;
  50 + } catch (\Exception | GuzzleException $e) {
  51 + $status = 0;
  52 + }
  53 + return !($status == 2);
  54 + }
  55 +}