From fc0677d8f52b36aeefd1768eaca7e0e89a8c0ab5 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Tue, 20 Jul 2021 09:29:30 +0800 Subject: [PATCH] * Fix list of entry points. --- api/v1/entries/bugs.php | 3 ++- api/v1/entries/executions.php | 6 +++++- api/v1/entries/products.php | 5 +++-- api/v1/entries/program.php | 11 +++++++++++ api/v1/entries/programs.php | 9 ++++++++- api/v1/entries/projects.php | 3 ++- api/v1/entries/stories.php | 4 +++- api/v1/entries/tasks.php | 3 ++- api/v1/entries/users.php | 14 +++++--------- 9 files changed, 41 insertions(+), 17 deletions(-) diff --git a/api/v1/entries/bugs.php b/api/v1/entries/bugs.php index a227cbf2a1..aa3d101122 100644 --- a/api/v1/entries/bugs.php +++ b/api/v1/entries/bugs.php @@ -17,12 +17,13 @@ class bugsEntry extends entry if(isset($data->status) and $data->status == 'success') { $bugs = $data->data->bugs; + $pager = $data->data->pager; $result = array(); foreach($bugs as $bug) { $result[] = $bug; } - return $this->send(200, $result); + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => $result)); } if(isset($data->status) and $data->status == 'fail') { diff --git a/api/v1/entries/executions.php b/api/v1/entries/executions.php index 45c7730f7c..d5a26aac08 100644 --- a/api/v1/entries/executions.php +++ b/api/v1/entries/executions.php @@ -14,7 +14,11 @@ class executionsEntry extends entry $control->all($this->param('status', 'all'), $this->param('project', $projectID)); $data = $this->getData(); - if(isset($data->status) and $data->status == 'success') return $this->send(200, $data->data->executionStats); + if(isset($data->status) and $data->status == 'success') + { + $pager = $data->data->pager; + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'executions' => $data->data->executionStats)); + } if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); return $this->sendError(400, 'error'); diff --git a/api/v1/entries/products.php b/api/v1/entries/products.php index 0703b7c131..de4aa0d01d 100644 --- a/api/v1/entries/products.php +++ b/api/v1/entries/products.php @@ -12,11 +12,12 @@ class productsEntry extends entry { $control = $this->loadController('product', 'all'); $control->all(); - $data = $this->getData(); + $data = $this->getData(); + $pager = $data->data->pager; if(isset($data->status) and $data->status == 'success') { - return $this->send(200, $data->data->productStats); + return $this->send(200, array('products' => $data->data->productStats)); } if(isset($data->status) and $data->status == 'fail') { diff --git a/api/v1/entries/program.php b/api/v1/entries/program.php index e69de29bb2..6916a80784 100644 --- a/api/v1/entries/program.php +++ b/api/v1/entries/program.php @@ -0,0 +1,11 @@ +send(200, $result); + return $this->send(200, array('programs' => $result)); } if(isset($data->status) and $data->status == 'fail') { diff --git a/api/v1/entries/projects.php b/api/v1/entries/projects.php index 2248f50a98..aedd9c0467 100644 --- a/api/v1/entries/projects.php +++ b/api/v1/entries/projects.php @@ -16,7 +16,8 @@ class projectsEntry extends entry if(isset($data->status) and $data->status == 'success') { - return $this->send(200, $data->data->projectStats); + $pager = $data->data->pager; + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'projects' => $data->data->projectStats)); } if(isset($data->status) and $data->status == 'fail') { diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index a2a3da5a12..c4d3eea3f7 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -17,13 +17,15 @@ class storiesEntry extends entry if(isset($data->status) and $data->status == 'success') { $stories = $data->data->stories; + $pager = $data->data->pager; $result = array(); foreach($stories as $story) { $result[] = $story; } - return $this->send(200, $result); + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result)); } + if(isset($data->status) and $data->status == 'fail') { return $this->sendError(400, $data->message); diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index 64f2678ead..27fdd83d13 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -17,12 +17,13 @@ class tasksEntry extends entry if(isset($data->status) and $data->status == 'success') { $tasks = $data->data->tasks; + $pager = $data->data->pager; $result = array(); foreach($tasks as $task) { $result[] = $task; } - return $this->send(200, $result); + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'tasks' => $result)); } if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); diff --git a/api/v1/entries/users.php b/api/v1/entries/users.php index e5ab96cfbc..3bf25eae58 100644 --- a/api/v1/entries/users.php +++ b/api/v1/entries/users.php @@ -17,18 +17,14 @@ class usersEntry extends entry if(isset($data->status) and $data->status == 'success') { $users = $data->data->users; + $pager = $data->data->pager; $result = array(); - foreach($users as $user) - { - $result[] = $user; - } - return $this->send(200, $result); - } - if(isset($data->status) and $data->status == 'fail') - { - return $this->sendError(400, $data->message); + foreach($users as $user) $result[] = $user; + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'users' => $result)); } + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + return $this->sendError(400, 'error'); }