作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server

@@ -996,14 +996,16 @@ class RelayInquiry extends Command @@ -996,14 +996,16 @@ class RelayInquiry extends Command
996 //按概率 996 //按概率
997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]); 997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]);
998 if($res == 1){ 998 if($res == 1){
999 - $this->output('非广告投放日第一封询盘 概率' . (100 - $task->second_push_rate) . '%延迟推送');  
1000 //随机分配到未投放广告日期 999 //随机分配到未投放广告日期
1001 $now = Carbon::now(); 1000 $now = Carbon::now();
1002 // 随机开始时间(本周四或现在) 1001 // 随机开始时间(本周四或现在)
1003 $startTime = max($now->timestamp, $now->startOfWeek(4)->timestamp); 1002 $startTime = max($now->timestamp, $now->startOfWeek(4)->timestamp);
1004 1003
1005 $random = mt_rand($startTime, $now->endOfWeek()->timestamp); 1004 $random = mt_rand($startTime, $now->endOfWeek()->timestamp);
1006 - return $random - $now->timestamp; 1005 +
  1006 + $delay = $random - time();
  1007 + $this->output('非广告投放日第一封询盘 概率' . (100 - $task->second_push_rate) . '%延迟推送' . $delay);
  1008 + return $delay;
1007 } 1009 }
1008 } 1010 }
1009 } 1011 }
@@ -249,13 +249,13 @@ class InquiryForwardLogic extends BaseLogic @@ -249,13 +249,13 @@ class InquiryForwardLogic extends BaseLogic
249 $num = $this->param['num'] ?? 3; 249 $num = $this->param['num'] ?? 3;
250 250
251 $model = new InquiryProjectRoute(); 251 $model = new InquiryProjectRoute();
252 - if ($this->param['type'] == 1) {  
253 - //使用全文索引搜索  
254 - $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);  
255 - } else { 252 +// if ($this->param['type'] == 1) {
  253 +// //使用全文索引搜索
  254 +// $routeQuery = $model->select(['project_id', 'route'])->whereRaw("MATCH(title) AGAINST(? IN BOOLEAN MODE)", [$this->param['keywords']]);
  255 +// } else {
256 //使用like查询 256 //使用like查询
257 $routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%'); 257 $routeQuery = $model->select(['project_id', 'route'])->where('title', 'like', '%' . $this->param['keywords'] . '%');
258 - } 258 +// }
259 259
260 $re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray(); 260 $re_route = $routeQuery->inRandomOrder()->take(100)->get()->toArray();
261 261
@@ -450,6 +450,21 @@ class SyncSubmitTaskService @@ -450,6 +450,21 @@ class SyncSubmitTaskService
450 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){ 450 if(empty($data['referer']) || empty($data['user_agent']) || empty($data['data'])){
451 throw new InquiryFilterException( '数据异常:' . $data['country']); 451 throw new InquiryFilterException( '数据异常:' . $data['country']);
452 } 452 }
  453 +
  454 + //关杰 全局过滤 满足 name、message 8-16 纯字母不含空格 ip 荷兰 mobile 10位纯数字 过滤
  455 + if(
  456 + strlen($data['data']['name']) <= 16 && strlen($data['data']['name']) >= 8 &&
  457 + strlen($data['data']['message']) <= 16 && strlen($data['data']['message']) >= 8 &&
  458 + preg_match('/^[a-zA-Z]+$/', $data['data']['name']) &&
  459 + preg_match('/^[a-zA-Z]+$/', $data['data']['message']) &&
  460 + preg_match('/^\d+$/', $data['data']['phone']) &&
  461 + strlen($data['data']['phone']) == 10 &&
  462 + in_array($data['country'], ['荷兰', '俄罗斯'])
  463 + ){
  464 + throw new InquiryFilterException( '全局过滤');
  465 + }
  466 +
  467 +
453 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); 468 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id);
454 //没配置 则默认开启且使用全局 469 //没配置 则默认开启且使用全局
455 if(!$config){ 470 if(!$config){