Commit 2bab2e87 authored by clone's avatar clone

bug

parent c93dce7b
......@@ -2,6 +2,7 @@
namespace app\task\controller;
use app\extra\RedisExt;
use app\model\AAgents;
use app\model\GHouses;
use app\model\OBargainModel;
......@@ -29,6 +30,7 @@ class ResultsSummaryTask
private $reportModel;
private $marchInModel;
private $payLogModel;
private $redis_;
function __construct()
{
......@@ -40,30 +42,37 @@ class ResultsSummaryTask
$this->reportModel = new OReportModel();
$this->marchInModel = new OMarchInModel();
$this->payLogModel = new OPayLogModel();
$this->redis_ = RedisExt::getRedis();
}
public function totalAgentResults()
{
set_time_limit(0); // 取消脚本运行时间的超时上限
//todo 1.分页查询经纪人, 2遍历执行,判断一个经纪人在统计表最后一条统计数据的日期
//TODO 3.日期加一天并判断是否大于等于当前时间大于return 4.执行此日期的统计,5.当次日期小于当前日期,递归日期加一。继续统计
$total = $this->agentsModel->getAgentsCountByTask();
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$resultArr = $this->agentsModel->getAgentsListByTask($pageNo, $pageSize, "id,store_id,district_id");
$this->executeTotal($resultArr);
unset($resultArr);
}
unset($this->agentsModel);
unset($this->tAgentTotalModel);
unset($this->houseModel);
unset($this->userModel);
unset($this->bargainModel);
unset($this->reportModel);
unset($this->marchInModel);
unset($this->payLogModel);
$day = date("Y-m-d", time());
if ($this->redis_ && $this->redis_->get("run_total" . $day)) {
return false;
}
$this->redis_->set("run_total" . $day, 1, 24 * 3600);
//todo 1.分页查询经纪人, 2遍历执行,判断一个经纪人在统计表最后一条统计数据的日期
//TODO 3.日期加一天并判断是否大于等于当前时间大于return 4.执行此日期的统计,5.当次日期小于当前日期,递归日期加一。继续统计
$total = $this->agentsModel->getAgentsCountByTask();
$pageSize = 200;
$pageTotal = ceil($total / $pageSize);
for ($pageNo = 1; $pageNo <= $pageTotal; $pageNo++) {
$resultArr = $this->agentsModel->getAgentsListByTask($pageNo, $pageSize, "id,store_id,district_id");
$this->executeTotal($resultArr);
unset($resultArr);
}
unset($this->agentsModel);
unset($this->tAgentTotalModel);
unset($this->houseModel);
unset($this->userModel);
unset($this->bargainModel);
unset($this->reportModel);
unset($this->marchInModel);
unset($this->payLogModel);
}
......
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