From 49bfd2dd188ce36bf5f682de79d28ca410aa90a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 22 Dec 2021 15:24:47 +0800 Subject: [PATCH] * adjust for vs code and php8.0. --- module/dept/model.php | 2 +- module/product/control.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/dept/model.php b/module/dept/model.php index 3a6a9eb89f..fe0996ca35 100644 --- a/module/dept/model.php +++ b/module/dept/model.php @@ -376,7 +376,7 @@ class deptModel extends model * @access public * @return array */ - public function getUsers($browseType = 'inside', $deptID, $pager = null, $orderBy = 'id') + public function getUsers($browseType = 'inside', $deptID = 0, $pager = null, $orderBy = 'id') { return $this->dao->select('*')->from(TABLE_USER) ->where('deleted')->eq(0) diff --git a/module/product/control.php b/module/product/control.php index 569a8ec0fa..a14047daf7 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -31,7 +31,8 @@ class product extends control /* Get all products, if no, goto the create page. */ $this->products = $this->product->getPairs('nocode|all'); - if(empty($this->products) and strpos(',create,index,showerrornone,ajaxgetdropmenu,kanban', $this->methodName) === false and $this->app->getViewType() != 'mhtml') $this->locate($this->createLink('product', 'create')); + $isAPI = (defined('RUN_MODE') && RUN_MODE == 'api'); + if(empty($this->products) and strpos(',create,index,showerrornone,ajaxgetdropmenu,kanban', $this->methodName) === false and $this->app->getViewType() != 'mhtml' and !$isAPI) $this->locate($this->createLink('product', 'create')); $this->view->products = $this->products; }