Commit 1e76303b authored by clone's avatar clone

bug

parent 7b44afb0
......@@ -16,35 +16,44 @@ class ClientService
{
private $uPhoneFollowUpModel;
private $redis;
private $day;
private $num;
const SAVE_CALL_NUM = "save_call_num_";
public function __construct()
{
$this->uPhoneFollowUpModel = new UPhoneFollowPp();
$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)
{
$day = 1;
$num = 5;
if ($this->redis) {
$day = $this->redis->get("s_agent_call_day");
$num = $this->redis->get("s_agent_call_number");
}
$start_time = date("Y-m-d H:i:s", strtotime("-$day day"));
$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) {
/* $start_time = date("Y-m-d H:i:s", strtotime("-$day day"));
$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);*/
$call_num = empty($this->redis->get(self::SAVE_CALL_NUM . $user_id)) ? 0 : $this->redis->get(self::SAVE_CALL_NUM . $user_id);
if ($call_num >= $this->num) {
return false;
} else {
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
{
protected $rule = [
'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',
];
......
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