From b060117c187260ce38c7a3b4f0edeeab27917882 Mon Sep 17 00:00:00 2001 From: zhaoke Date: Tue, 20 Dec 2022 03:24:37 +0000 Subject: [PATCH] * Update log style. --- api/v1/entries/ztfsubmit.php | 6 ++++-- module/testtask/model.php | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/api/v1/entries/ztfsubmit.php b/api/v1/entries/ztfsubmit.php index 8ccbcb2da7..2ab16df314 100644 --- a/api/v1/entries/ztfsubmit.php +++ b/api/v1/entries/ztfsubmit.php @@ -39,10 +39,13 @@ class ztfSubmitEntry extends baseEntry $this->loadModel('testresult'); - if($post->task) + if(!empty($post->task)) { + $post->log = !empty($post->data->log) ? $post->data->log: $post->error; + $this->app->user = new stdClass; $this->app->user->account = ''; + if(!empty($post->data->funcResult)) { $result = $this->loadModel('testtask')->parseZTFFuncResult($post->data->funcResult, "", 0, 0, 0); @@ -51,7 +54,6 @@ class ztfSubmitEntry extends baseEntry { $result = array(); } - $post->log = !empty($post->data->log) ? $post->data->log: ''; unset($post->data); if(!empty($result['results'][0])) diff --git a/module/testtask/model.php b/module/testtask/model.php index a2fccb6c1e..11c07e5f8e 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1497,7 +1497,11 @@ class testtaskModel extends model $log = preg_replace("/^[\d\-:.\x20]+/", '', $log); $log = trim($log); if(empty($log)) continue; - $log = preg_replace(array("/:\x20失败/", "/:\x20fail/", "/:\x20成功/", "/:\x20pass/"), array(': 失败',': fail',': 成功',': pass'), $log); + + $failHtml = ': ' . $this->lang->testtask->fail . ''; + $passHtml = ': ' . $this->lang->testtask->pass . ''; + + $log = preg_replace(array("/:\x20失败/", "/:\x20fail/", "/:\x20成功/", "/:\x20pass/"), array($failHtml, $failHtml, $passHtml, $passHtml), $log); $logHtml .= "
  • " . $log . "
  • "; }