|
...
|
...
|
@@ -13,6 +13,7 @@ use App\Models\Inquiry\ReInquiryDetailLog; |
|
|
|
use App\Models\Inquiry\ReInquiryForm;
|
|
|
|
use App\Models\Inquiry\ReInquiryTask;
|
|
|
|
use App\Models\Inquiry\ReInquiryText;
|
|
|
|
use App\Models\Project\InquiryFilterConfig;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\WebSetting\WebLanguage;
|
|
|
|
use Illuminate\Console\Command;
|
|
...
|
...
|
@@ -177,10 +178,10 @@ class RelayInquiry extends Command |
|
|
|
$this->output('开始处理本轮询盘!');
|
|
|
|
foreach ($inquiry as $key=>$val) {
|
|
|
|
$this->output('询盘ID:' . $val->id);
|
|
|
|
//询盘时间超过90分钟 就不处理了
|
|
|
|
if(time() - strtotime($val->inquiry_date) > 90 * 60){
|
|
|
|
//询盘时间超过2小时 就不处理了
|
|
|
|
if(time() - strtotime($val->inquiry_date) > 7200){
|
|
|
|
$val->status = ReInquiryForm::STATUS_FORGO;
|
|
|
|
$val->remark = '超时90分钟未处理!';
|
|
|
|
$val->remark = '超时2小时未处理!';
|
|
|
|
$val->save();
|
|
|
|
continue;
|
|
|
|
}
|
|
...
|
...
|
@@ -200,6 +201,14 @@ class RelayInquiry extends Command |
|
|
|
$val->save();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//是否要过滤
|
|
|
|
$filter_res = $this->filter($val);
|
|
|
|
if($filter_res !== true){
|
|
|
|
$val->status = ReInquiryForm::STATUS_FORGO;
|
|
|
|
$val->remark = $filter_res;
|
|
|
|
$val->save();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
$this->relayDetail($ad_task, $val);
|
|
...
|
...
|
@@ -213,6 +222,46 @@ class RelayInquiry extends Command |
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function filter($data)
|
|
|
|
{
|
|
|
|
//通用过滤规则
|
|
|
|
$config = InquiryFilterConfig::getCacheInfoByProjectId(Project::DEMO_PROJECT_ID);
|
|
|
|
//过滤内容
|
|
|
|
if(!empty($data['message']) && !empty($config['filter_contents'])) {
|
|
|
|
foreach ($config['filter_contents'] as $filter_content) {
|
|
|
|
if (Str::contains(strtolower($data['message']), strtolower($filter_content))) {
|
|
|
|
return '过滤内容:' . $filter_content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//过滤邮箱
|
|
|
|
if(!empty($data['email']) && !empty($config['filter_emails'])){
|
|
|
|
foreach ($config['filter_emails'] as $filter_email){
|
|
|
|
if(Str::contains(strtolower($data['email']), strtolower($filter_email))){
|
|
|
|
return '过滤邮箱:' . $filter_email;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//过滤电话
|
|
|
|
if(!empty($data['phone']) && !empty($config['filter_mobiles'])){
|
|
|
|
foreach ($config['filter_mobiles'] as $filter_mobile){
|
|
|
|
if(Str::contains(strtolower($data['phone']), strtolower($filter_mobile))){
|
|
|
|
return '过滤电话:' . $filter_mobile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//过滤姓名
|
|
|
|
if(!empty($data['full_name'] && !empty($config['filter_names']))){
|
|
|
|
foreach ($config['filter_names'] as $filter_name){
|
|
|
|
if(Str::contains(strtolower($data['full_name']), strtolower($filter_name))){
|
|
|
|
return '过滤姓名:' . $filter_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 创建转发详情
|
|
|
|
* TODO 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录
|
|
...
|
...
|
@@ -326,6 +375,11 @@ class RelayInquiry extends Command |
|
|
|
$pre = 0;
|
|
|
|
$start_time = time();
|
|
|
|
$seconds = rand(300, 3000); // 开始时间 从5-50分钟后开始
|
|
|
|
$exists = ReInquiryDetail::where('re_website', $domain)->where('email', $form->email)->first();
|
|
|
|
if($exists){
|
|
|
|
$this->output('转发站点邮件已存在');
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
// 写入推送详情
|
|
|
|
$re_detail = ReInquiryDetail::createInquiry($task['id'], $form->id, $domain, $country_name, $ip, $form->full_name, $form->email, $form->phone, $message, $message_id, $device_port,
|
|
|
|
$user_agent, $referrer, $urls, $is_v6, date('Y-m-d H:i:s', $start_time + $seconds));
|
...
|
...
|
|