|
@@ -15,7 +15,7 @@ class handler
|
|
{
|
|
{
|
|
private $task_id = '';
|
|
private $task_id = '';
|
|
|
|
|
|
- public function __construct($task_id)
|
|
|
|
|
|
+ public function setTask_id($task_id)
|
|
{
|
|
{
|
|
$this->task_id = $task_id;
|
|
$this->task_id = $task_id;
|
|
}
|
|
}
|
|
@@ -206,6 +206,9 @@ class handler
|
|
$task_id = $this->task_id;
|
|
$task_id = $this->task_id;
|
|
$total_stage = (($end - $start) / 3600);
|
|
$total_stage = (($end - $start) / 3600);
|
|
$cur_stage = 0;
|
|
$cur_stage = 0;
|
|
|
|
+ $expected_curtime = time();
|
|
|
|
+ $mod_task = Model('task');
|
|
|
|
+
|
|
for ($cur_start = $start; $cur_start < $end; $cur_start += 3600)
|
|
for ($cur_start = $start; $cur_start < $end; $cur_start += 3600)
|
|
{
|
|
{
|
|
if($cur_start + 3600 >= $end) {
|
|
if($cur_start + 3600 >= $end) {
|
|
@@ -218,7 +221,6 @@ class handler
|
|
$cond = array_merge($normal_cond,$tmcond);
|
|
$cond = array_merge($normal_cond,$tmcond);
|
|
|
|
|
|
$mod = Model();
|
|
$mod = Model();
|
|
- $mod_task = Model('task');
|
|
|
|
|
|
|
|
$len = 1000;
|
|
$len = 1000;
|
|
$i = 0;
|
|
$i = 0;
|
|
@@ -240,9 +242,15 @@ class handler
|
|
yield $item;
|
|
yield $item;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- $cur_stage++;
|
|
|
|
- $stage = "{$cur_stage}/{$total_stage}";
|
|
|
|
- $mod_task->where(['task_id' => $task_id])->update(['stage' => $stage]);
|
|
|
|
|
|
+ if(!empty($task_id)){
|
|
|
|
+ if($cur_stage === 0) {
|
|
|
|
+ $expected_time = (time()-$expected_curtime) * $total_stage;
|
|
|
|
+ $expected_time = date("Y-m-d H:i", $expected_time);
|
|
|
|
+ }
|
|
|
|
+ $cur_stage++;
|
|
|
|
+ $stage = "导出进度:{$cur_stage}/{$total_stage}, 预计完成时间:{$expected_time}";
|
|
|
|
+ $mod_task->where(['task_id' => $task_id])->update(['stage' => $stage]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -408,4 +416,4 @@ class handler
|
|
{
|
|
{
|
|
return md5("refill_balance_stat_all-".serialize($condition));
|
|
return md5("refill_balance_stat_all-".serialize($condition));
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|