正在显示
1 个修改的文件
包含
52 行增加
和
3 行删除
| @@ -13,6 +13,7 @@ use App\Models\Inquiry\ReInquiryDetailLog; | @@ -13,6 +13,7 @@ use App\Models\Inquiry\ReInquiryDetailLog; | ||
| 13 | use App\Models\Inquiry\ReInquiryForm; | 13 | use App\Models\Inquiry\ReInquiryForm; |
| 14 | use App\Models\Inquiry\ReInquiryTask; | 14 | use App\Models\Inquiry\ReInquiryTask; |
| 15 | use App\Models\Inquiry\ReInquiryText; | 15 | use App\Models\Inquiry\ReInquiryText; |
| 16 | +use App\Models\Project\InquiryFilterConfig; | ||
| 16 | use App\Models\Project\Project; | 17 | use App\Models\Project\Project; |
| 17 | use App\Models\WebSetting\WebLanguage; | 18 | use App\Models\WebSetting\WebLanguage; |
| 18 | use Illuminate\Console\Command; | 19 | use Illuminate\Console\Command; |
| @@ -177,10 +178,10 @@ class RelayInquiry extends Command | @@ -177,10 +178,10 @@ class RelayInquiry extends Command | ||
| 177 | $this->output('开始处理本轮询盘!'); | 178 | $this->output('开始处理本轮询盘!'); |
| 178 | foreach ($inquiry as $key=>$val) { | 179 | foreach ($inquiry as $key=>$val) { |
| 179 | $this->output('询盘ID:' . $val->id); | 180 | $this->output('询盘ID:' . $val->id); |
| 180 | - //询盘时间超过90分钟 就不处理了 | ||
| 181 | - if(time() - strtotime($val->inquiry_date) > 90 * 60){ | 181 | + //询盘时间超过2小时 就不处理了 |
| 182 | + if(time() - strtotime($val->inquiry_date) > 7200){ | ||
| 182 | $val->status = ReInquiryForm::STATUS_FORGO; | 183 | $val->status = ReInquiryForm::STATUS_FORGO; |
| 183 | - $val->remark = '超时90分钟未处理!'; | 184 | + $val->remark = '超时2小时未处理!'; |
| 184 | $val->save(); | 185 | $val->save(); |
| 185 | continue; | 186 | continue; |
| 186 | } | 187 | } |
| @@ -200,6 +201,14 @@ class RelayInquiry extends Command | @@ -200,6 +201,14 @@ class RelayInquiry extends Command | ||
| 200 | $val->save(); | 201 | $val->save(); |
| 201 | continue; | 202 | continue; |
| 202 | } | 203 | } |
| 204 | + //是否要过滤 | ||
| 205 | + $filter_res = $this->filter($val); | ||
| 206 | + if($filter_res !== true){ | ||
| 207 | + $val->status = ReInquiryForm::STATUS_FORGO; | ||
| 208 | + $val->remark = $filter_res; | ||
| 209 | + $val->save(); | ||
| 210 | + continue; | ||
| 211 | + } | ||
| 203 | 212 | ||
| 204 | try { | 213 | try { |
| 205 | $this->relayDetail($ad_task, $val); | 214 | $this->relayDetail($ad_task, $val); |
| @@ -213,6 +222,46 @@ class RelayInquiry extends Command | @@ -213,6 +222,46 @@ class RelayInquiry extends Command | ||
| 213 | return true; | 222 | return true; |
| 214 | } | 223 | } |
| 215 | 224 | ||
| 225 | + | ||
| 226 | + public function filter($data) | ||
| 227 | + { | ||
| 228 | + //通用过滤规则 | ||
| 229 | + $config = InquiryFilterConfig::getCacheInfoByProjectId(Project::DEMO_PROJECT_ID); | ||
| 230 | + //过滤内容 | ||
| 231 | + if(!empty($data['message']) && !empty($config['filter_contents'])) { | ||
| 232 | + foreach ($config['filter_contents'] as $filter_content) { | ||
| 233 | + if (Str::contains(strtolower($data['message']), strtolower($filter_content))) { | ||
| 234 | + return '过滤内容:' . $filter_content; | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + //过滤邮箱 | ||
| 239 | + if(!empty($data['email']) && !empty($config['filter_emails'])){ | ||
| 240 | + foreach ($config['filter_emails'] as $filter_email){ | ||
| 241 | + if(Str::contains(strtolower($data['email']), strtolower($filter_email))){ | ||
| 242 | + return '过滤邮箱:' . $filter_email; | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + //过滤电话 | ||
| 247 | + if(!empty($data['phone']) && !empty($config['filter_mobiles'])){ | ||
| 248 | + foreach ($config['filter_mobiles'] as $filter_mobile){ | ||
| 249 | + if(Str::contains(strtolower($data['phone']), strtolower($filter_mobile))){ | ||
| 250 | + return '过滤电话:' . $filter_mobile; | ||
| 251 | + } | ||
| 252 | + } | ||
| 253 | + } | ||
| 254 | + //过滤姓名 | ||
| 255 | + if(!empty($data['full_name'] && !empty($config['filter_names']))){ | ||
| 256 | + foreach ($config['filter_names'] as $filter_name){ | ||
| 257 | + if(Str::contains(strtolower($data['full_name']), strtolower($filter_name))){ | ||
| 258 | + return '过滤姓名:' . $filter_name; | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + return true; | ||
| 263 | + } | ||
| 264 | + | ||
| 216 | /** | 265 | /** |
| 217 | * 创建转发详情 | 266 | * 创建转发详情 |
| 218 | * TODO 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录 | 267 | * TODO 通过任务生成转发对象, 更具转发对象获取对应数据, 写入着陆记录 |
-
请 注册 或 登录 后发表评论