From 3ee4c5fe449c48e490fc8bb8fcfe5d107c756759 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Mon, 25 Nov 2024 13:59:53 +0800 Subject: [PATCH] * [task#133002,doing,0.1h] refactor. --- module/pivot/control.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/module/pivot/control.php b/module/pivot/control.php index c581d791be..cd61c9d3ef 100644 --- a/module/pivot/control.php +++ b/module/pivot/control.php @@ -79,6 +79,11 @@ class pivot extends control */ public function versions(int $groupID, int $pivotID, string $version = 'newest') { + $pivot = $this->pivot->getByID($pivotID); + + if($version == 'newest') $version = $this->pivot->getMaxVersion($pivotID); + if($version == 'current') $version = $pivot->version; + $versionSpecs = $this->pivot->getPivotVersions($pivotID); if(empty($versionSpecs)) $this->sendError($this->lang->pivot->tipNoVersions); @@ -88,11 +93,10 @@ class pivot extends control if($result) $this->sendSuccess(array('closeModal' => true, 'message' => $this->lang->saveSuccess, 'load' => true)); } - $pivot = $this->pivot->getByID($pivotID); $this->pivotZen->show($groupID, $pivotID, '', $version); $this->view->versionSpecs = $versionSpecs; - $this->view->version = $version == 'newest' ? $this->pivot->getMaxVersion($pivotID) : $version; + $this->view->version = $version; $this->view->pivot = $pivot; $this->view->groupID = $groupID; $this->view->pivotID = $groupID;