From 84d1aafb94e7da885d2e5718f0372916b1b50b31 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Fri, 25 Mar 2022 13:27:02 +0800 Subject: [PATCH] * Get products by projectID. --- api/v1/entries/products.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/v1/entries/products.php b/api/v1/entries/products.php index 2a11c2ea6d..41ae54055c 100644 --- a/api/v1/entries/products.php +++ b/api/v1/entries/products.php @@ -24,6 +24,7 @@ class productsEntry extends entry if(strpos(strtolower(",{$fields},"), ',dropmenu,') !== false) return $this->getDropMenu(); if(!$programID) $programID = $this->param('program', 0); + if(!$projectID) $projectID = $this->param('project', 0); $mergeChildren = $this->param('mergeChildren', ''); if($programID) @@ -39,6 +40,18 @@ class productsEntry extends entry $products = $data->data->products; } + elseif($projectID) + { + $control = $this->loadController('project', 'manageProducts'); + $control->manageProducts($projectID); + + /* Response */ + $data = $this->getData(); + if(!$data or !isset($data->status)) return $this->sendError(400, 'error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $products = $data->data->linkedProducts; + } else { $control = $this->loadController('product', 'all');