From 5aea0c9ac79ef9c38fe4b6a9b3b4f0d18fdf18db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Mon, 28 Mar 2022 17:17:13 +0800 Subject: [PATCH] *Optimize the code. --- module/product/control.php | 2 +- module/product/model.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 08fe655607..5427438fee 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1291,7 +1291,7 @@ class product extends control $this->view->position[] = $this->lang->product->line; $this->view->programs = array('') + $this->loadModel('program')->getTopPairs(); - $this->view->lines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->orderBy('`order`')->fetchAll(); + $this->view->lines = $this->product->getLines(); $this->display(); } diff --git a/module/product/model.php b/module/product/model.php index c894a61992..1742b3e17b 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1786,7 +1786,7 @@ class productModel extends model * * @param int $programID * @access public - * @return void + * @return array */ public function getLinePairs($programID = 0) { @@ -1797,6 +1797,16 @@ class productModel extends model ->fetchPairs(); } + /* + * Get all lines. + * @access public + * @return array + */ + public function getLines() + { + return $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('deleted')->eq(0)->orderBy('`order`')->fetchAll(); + } + /** * Get the summary of product's stories. *