Commit 1e76303b authored by clone's avatar clone

bug

parent 7b44afb0
...@@ -16,35 +16,44 @@ class ClientService ...@@ -16,35 +16,44 @@ class ClientService
{ {
private $uPhoneFollowUpModel; private $uPhoneFollowUpModel;
private $redis; private $redis;
private $day;
private $num;
const SAVE_CALL_NUM = "save_call_num_";
public function __construct() public function __construct()
{ {
$this->uPhoneFollowUpModel = new UPhoneFollowPp(); $this->uPhoneFollowUpModel = new UPhoneFollowPp();
$this->redis = RedisExt::getRedis(); $this->redis = RedisExt::getRedis();
$this->day = $this->redis->get("s_agent_call_day");
$this->num = $this->redis->get("s_agent_call_number");
} }
public function dialTotal($user_id) public function dialTotal($user_id)
{ {
$day = 1; /* $start_time = date("Y-m-d H:i:s", strtotime("-$day day"));
$num = 5; $end_time = date("Y-m-d H:i:s", time());
if ($this->redis) { $params["create_time"] = array( "between", array( $start_time, $end_time ) );
$day = $this->redis->get("s_agent_call_day"); $params["user_id"] = $user_id;
$num = $this->redis->get("s_agent_call_number");
} $total = $this->uPhoneFollowUpModel->getCount($params);*/
$call_num = empty($this->redis->get(self::SAVE_CALL_NUM . $user_id)) ? 0 : $this->redis->get(self::SAVE_CALL_NUM . $user_id);
$start_time = date("Y-m-d H:i:s", strtotime("-$day day")); if ($call_num >= $this->num) {
$end_time = date("Y-m-d H:i:s", time());
$params["create_time"] = array( "between", array( $start_time, $end_time ) );
$params["user_id"] = $user_id;
$total = $this->uPhoneFollowUpModel->getCount( $params);
if ($total >= $num) {
return false; return false;
} else { } else {
return true; return true;
} }
}
public function saveCallNumByUserId($user_id)
{
$call_num = $this->redis->get(self::SAVE_CALL_NUM . $user_id);
if ($call_num > 0) {
$this->redis->set(self::SAVE_CALL_NUM . $user_id, $call_num + 1);
} else {
$this->redis->set(self::SAVE_CALL_NUM . $user_id, 1, $this->day * 3600);
}
} }
} }
\ No newline at end of file
...@@ -15,7 +15,7 @@ class BargainValidate extends Validate ...@@ -15,7 +15,7 @@ class BargainValidate extends Validate
{ {
protected $rule = [ protected $rule = [
'submit_agent_id' => 'require|number', 'submit_agent_id' => 'require|number',
'status' => 'require|number|in:0,1,2,3', 'status' => 'require|number|in:0,1,2,3,4',
'is_my_correlation' => 'require|number|in:0,1', 'is_my_correlation' => 'require|number|in:0,1',
]; ];
......
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