Commit 7f43582d authored by clone's avatar clone

bug

parent 38bf647d
......@@ -4,8 +4,6 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\api_broker\service\BargainService;
use app\extra\RedisExt;
use app\model\AliYunSecretReport;
use think\Request;
/**
......@@ -52,14 +50,4 @@ class Bargain extends Basic
return $this->response("200", "success", $result);
}
public function test()
{
$model = new AliYunSecretReport();
$redis = RedisExt::getRedis();
$userList = $model->getCallUserId();
foreach ($userList as $item) {
$redis->set("save_call_num_" . $item["users_id"], 1, 3600 * 24);
}
}
}
\ No newline at end of file
......@@ -55,8 +55,7 @@ class Basic extends Controller
'broker/editDecFeedClick',
'broker/sendSms',
'broker/getNewsInfo',
'broker/getComment',
'broker/bargainTest',
'broker/getComment'
);
/**
......
......@@ -18,6 +18,7 @@ class ClientService
private $redis;
private $day;
private $num;
private $nowTime;
const SAVE_CALL_NUM = "save_call_num_";
public function __construct()
......@@ -25,34 +26,29 @@ class ClientService
$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");
$this->day = $this->redis->get("s_agent_call_day");
$this->num = $this->redis->get("s_agent_call_number");
$this->nowTime = date("Y-m-d", time());
}
public function dialTotal($user_id)
{
/* $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);
$call_num = empty($this->redis->get(self::SAVE_CALL_NUM . $this->nowTime . $user_id))
? 0 : $this->redis->get(self::SAVE_CALL_NUM . $this->nowTime . $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);
$call_num = $this->redis->get(self::SAVE_CALL_NUM . $this->nowTime . $user_id);
if ($call_num) {
$this->redis->incr(self::SAVE_CALL_NUM . $user_id);
$this->redis->incr(self::SAVE_CALL_NUM . $this->nowTime . $user_id);
} else {
$this->redis->set(self::SAVE_CALL_NUM . $user_id, 1, $this->day * 3600 * 24);
$this->redis->set(self::SAVE_CALL_NUM . $this->nowTime . $user_id, 1, $this->day * 3600 * 24);
}
}
......
......@@ -585,8 +585,6 @@ Route::group('broker', [
'bargainMain' => [ 'api_broker/Bargain/bargainList', [ 'method' => 'POST|GET' ] ],
'bargainTest' => [ 'api_broker/Bargain/test', [ 'method' => 'POST|GET' ] ],
]);
......
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