Commit 353ef496 authored by zw's avatar zw

搜索控制

parent 9909f2a4
......@@ -57,7 +57,12 @@ class HomePageLog extends Basic
$vrs = new VerifyRepetitionService();
$is_check = $vrs->followUpClick($this->agentId);
if($params["pageNo"] == 1 && !$is_check){
return $this->response("101", "请勿频繁请求");
$is_bool = $vrs->getCurrTimeSection();
$msg = "请勿频繁请求";
if($is_bool) {
$msg = "高峰期间每10秒钟只能搜索一次(6.30-8.30)";
}
return $this->response("101", $msg);
}
......
......@@ -64,7 +64,7 @@ class VerifyRepetitionService
if (!$this->redis_) {
return true;
}
$time = 20;
/*$time = 20;
$record_click = $this->redis_->get("record_click_" .$agent_id);
if (!$record_click ) {
$this->redis_->set("record_click_" .$agent_id, 1, $time);
......@@ -74,8 +74,45 @@ class VerifyRepetitionService
//兼容出现永久请勿频繁请求问题
//$this->redis_->set("record_click_" .$agent_id, 3, 5);
return false;
}*/
$is_bool = $this->getCurrTimeSection();
if($is_bool){
$time = 10;
$record_click = $this->redis_->get("record_click_" .$agent_id);
if (!$record_click ) {
$this->redis_->set("record_click_" .$agent_id, 1, $time);
} else{
return false;
}
}else{
$time = 20;
$record_click = $this->redis_->get("record_click_" .$agent_id);
if (!$record_click ) {
$this->redis_->set("record_click_" .$agent_id, 1, $time);
} elseif( $record_click < 3) {
$this->redis_->incr("record_click_" .$agent_id);
}else{
//兼容出现永久请勿频繁请求问题
//$this->redis_->set("record_click_" .$agent_id, 3, 5);
return false;
}
}
return true;
}
public function getCurrTimeSection()
{
$checkDayStr = date('Y-m-d ', time());
$timeBegin1 = strtotime($checkDayStr . "18:30" . ":00");
$timeEnd1 = strtotime($checkDayStr . "20:30" . ":00");
$curr_time = time();
if ($curr_time >= $timeBegin1 && $curr_time <= $timeEnd1) {
return true;
}
return false;
}
}
\ No newline at end of file
......@@ -41,7 +41,12 @@ class Remark extends Basic
$vrs = new VerifyRepetitionService();
$is_check = $vrs->followUpClick($this->userId);
if($this->params['pageNo'] == 1 && !$is_check){
return $this->response("101", "请勿频繁请求");
$is_bool = $vrs->getCurrTimeSection();
$msg = "请勿频繁请求";
if($is_bool) {
$msg = "高峰期间每10秒钟只能搜索一次(6.30-8.30)";
}
return $this->response("101", $msg);
}
$u_phone_follow = new UPhoneFollowPp($this->siteId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment