plan add last_runtime

This commit is contained in:
qianhy
2023-04-26 15:51:52 +08:00
committed by lccsw
parent 9c6e232d1e
commit a5b5fb6cb1
+12
View File
@@ -11,6 +11,7 @@ class Plan extends CI_Controller
{
private $plan;
private $key_last_runtime = 'lc_plan_last_runtime';
protected $log_dir;
@@ -64,6 +65,14 @@ class Plan extends CI_Controller
$this->plan = $plan;
}
public function last_runtime(){
$redis = &load_cache('redis');
$value = $redis->get($this->key_last_runtime);
!$value && $value = 0;
$dts = $value ? date("Y-m-d H:i:s", $value) : '';
echo json_encode(array('last_runtime'=>$value, 'datetime' => $dts), JSON_UNESCAPED_UNICODE);
}
public function index()
{
$plan = $this->plan;
@@ -88,6 +97,9 @@ class Plan extends CI_Controller
echo "Finished " . date("Y-m-d H:i:s") . "\n";
}
$redis = &load_cache('redis');
$redis->save($this->key_last_runtime, time());
}
/*