+ Finish task#41826

This commit is contained in:
zenggang
2021-08-27 15:44:56 +08:00
parent b97e80568e
commit bf598f288f
2 changed files with 40 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
<?php
/**
* 禅道API的executionStories资源类
* 版本V1
*
* The executionStories entry point of zentaopms
* Version 1
*/
class executionStoriesEntry extends entry
{
public function get($executionID)
{
$control = $this->loadController('execution', 'story');
$control->story($executionID, $this->param('order', ''), $this->param('type', 'all'), 0, $this->param('total', 0), $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
{
$stories = $data->data->stories;
$pager = $data->data->pager;
$result = array();
foreach($stories as $story)
{
$result[] = $this->format($story, 'openedDate:time,assignedDate:time,reviewedDate:time,lastEditedDate:time,closedDate:time');
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'executionStories' => $result));
}
if(isset($data->status) and $data->status == 'fail')
{
return $this->sendError(400, $data->message);
}
return $this->sendError(400, 'error');
}
}
+4 -3
View File
@@ -14,9 +14,10 @@ $routes['/products/:id'] = 'product';
$routes['/productlines'] = 'productLines';
$routes['/productlines/:id'] = 'productLine';
$routes['/products/:id/stories'] = 'stories';
$routes['/stories/:id'] = 'story';
$routes['/stories/:id/change'] = 'storyChange';
$routes['/products/:id/stories'] = 'stories';
$routes['/executions/:id/stories'] = 'executionStories';
$routes['/stories/:id'] = 'story';
$routes['/stories/:id/change'] = 'storyChange';
$routes['/products/:id/bugs'] = 'bugs';
$routes['/bugs/:id'] = 'bug';