From b239aba280f782a73b407448e7a84b1ac6454be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E9=87=91=E5=8B=87?= Date: Thu, 20 Apr 2023 05:11:26 +0000 Subject: [PATCH] * Fix bug#34420. --- module/compile/model.php | 7 ++++++- module/job/model.php | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/compile/model.php b/module/compile/model.php index 619de7cf6b..cc4e67e3ed 100644 --- a/module/compile/model.php +++ b/module/compile/model.php @@ -47,7 +47,7 @@ class compileModel extends model */ public function getList($repoID, $jobID, $orderBy = 'id_desc', $pager = null) { - return $this->dao->select('t1.id, t1.name, t1.job, t1.status, DATE_FORMAT(t1.createdDate, "%m-%d %H:%i") AS createdDate, t1.testtask, t2.pipeline, t2.triggerType, t2.comment, t2.atDay, t2.atTime, t2.engine, t3.name as repoName, t4.name as jenkinsName')->from(TABLE_COMPILE)->alias('t1') + $compiles = $this->dao->select('t1.id, t1.name, t1.job, t1.status, t1.createdDate, t1.testtask, t2.pipeline, t2.triggerType, t2.comment, t2.atDay, t2.atTime, t2.engine, t3.name as repoName, t4.name as jenkinsName')->from(TABLE_COMPILE)->alias('t1') ->leftJoin(TABLE_JOB)->alias('t2')->on('t1.job=t2.id') ->leftJoin(TABLE_REPO)->alias('t3')->on('t2.repo=t3.id') ->leftJoin(TABLE_PIPELINE)->alias('t4')->on('t2.server=t4.id') @@ -58,6 +58,11 @@ class compileModel extends model ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); + foreach($compiles as $key => $compile) + { + if(!empty($compile->createdDate)) $compiles[$key]->createdDate = substr($compile->createdDate, 5, 11); + } + return $compiles; } /** diff --git a/module/job/model.php b/module/job/model.php index d75c4417ae..b0ea654b0c 100644 --- a/module/job/model.php +++ b/module/job/model.php @@ -46,7 +46,7 @@ class jobModel extends model */ public function getList($repoID = 0, $orderBy = 'id_desc', $pager = null, $engine = '', $pipeline = '') { - return $this->dao->select('t1.*, DATE_FORMAT(t1.lastExec, "%m-%d %H:%i") AS lastExec, t2.name as repoName, t3.name as jenkinsName')->from(TABLE_JOB)->alias('t1') + $jobs = $this->dao->select('t1.*, t2.name as repoName, t3.name as jenkinsName')->from(TABLE_JOB)->alias('t1') ->leftJoin(TABLE_REPO)->alias('t2')->on('t1.repo=t2.id') ->leftJoin(TABLE_PIPELINE)->alias('t3')->on('t1.server=t3.id') ->where('t1.deleted')->eq('0') @@ -56,6 +56,13 @@ class jobModel extends model ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); + + /* Format datetime. */ + foreach($jobs as $key => $job) + { + if(!empty($job->lastExec)) $jobs[$key]->lastExec = substr($job->lastExec, 5, 11); + } + return $jobs; } /**