From 5f7f4bc37c78b349062d0ba62eafcc9580d8caf0 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Thu, 10 Mar 2022 15:54:55 +0800 Subject: [PATCH] *Fix API --- api/v1/entries/bug.php | 2 +- api/v1/entries/stories.php | 2 +- api/v1/entries/story.php | 9 +++++++-- config/config.php | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/api/v1/entries/bug.php b/api/v1/entries/bug.php index f3ae69aeb4..7146d2d879 100644 --- a/api/v1/entries/bug.php +++ b/api/v1/entries/bug.php @@ -92,7 +92,7 @@ class bugEntry extends entry $oldBug = $this->loadModel('bug')->getByID($bugID); /* Set $_POST variables. */ - $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task,module,steps,mailto'; + $fields = 'title,project,execution,openedBuild,assignedTo,pri,severity,type,story,resolvedBy,closedBy,resolution,product,plan,task,module,steps,mailto,keywords'; $this->batchSetPost($fields, $oldBug); $this->setPost('notifyEmail', implode(',', $this->request('notifyEmail', array()))); diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index fcffda17ca..863888aa3f 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -55,7 +55,7 @@ class storiesEntry extends entry if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product; if(!$productID) return $this->sendError(400, 'Need product id.'); - $fields = 'title,spec,verify,reviewer,type,plan,module,source,sourceNote,category,pri,estimate'; + $fields = 'title,spec,verify,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords'; $this->batchSetPost($fields); /* If reviewer is not post, set needNotReview. */ diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php index b9ed92df75..a22703a461 100644 --- a/api/v1/entries/story.php +++ b/api/v1/entries/story.php @@ -95,14 +95,19 @@ class storyEntry extends Entry $oldStory = $this->loadModel('story')->getByID($storyID); /* Set $_POST variables. */ - $fields = 'type'; + $fields = 'title,reviewer,type,plan,module,source,sourceNote,category,pri,estimate,mailto,keywords'; $this->batchSetPost($fields, $oldStory); $this->setPost('parent', 0); $control = $this->loadController('story', 'edit'); $control->edit($storyID); - $this->getData(); + + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + if(!isset($data->status)) return $this->sendError(400, 'error'); + $story = $this->story->getByID($storyID); $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/config/config.php b/config/config.php index 6271d1a45d..b6b562c975 100644 --- a/config/config.php +++ b/config/config.php @@ -23,7 +23,7 @@ $config->cookieLife = time() + 2592000; // Cookie的生存时间。The co $config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php. $config->webRoot = ''; // URL根目录。 The root path of the url. $config->customSession = false; // 是否开启自定义session的存储路径。Whether custom the session save path. -$config->edition = 'open'; // 设置系统的edition,可选值:open|biz|max。Set edition, optional: open|biz|max. +$config->edition = 'max'; // 设置系统的edition,可选值:open|biz|max。Set edition, optional: open|biz|max. /* 框架路由相关设置。Routing settings. */ $config->requestType = 'PATH_INFO'; // 请求类型:PATH_INFO|PATHINFO2|GET。 The request type: PATH_INFO|PATH_INFO2|GET.