Skip to content

Commit

Permalink
暂无bug,睡觉
Browse files Browse the repository at this point in the history
  • Loading branch information
qbhy committed Jul 23, 2017
1 parent 4ab38cf commit eb4a7b2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/FindMovies.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ public function handler(Collection $message)

public static function render($movies)
{
$count = count($movies);
$str = '为您找到以下 ' . $count . ' 部电影' . PHP_EOL;
$count = count($movies) - 1;
$str = '为您找到以下 ' . ($count + 1) . ' 部电影' . PHP_EOL;
foreach ($movies as $key => $movie) {
$str .= ($key + 1) . ' ' . $movie['title'] . PHP_EOL;
$str .= ' 下载列表: ' . PHP_EOL;
foreach ($movie['downloads'] as $download) {
$str .= '' . $download['title'] . '' . $download['url'] . PHP_EOL;
$downloadCount = count($movie['downloads']) - 1;
foreach ($movie['downloads'] as $i => $download) {
$str .= '' . $download['title'] . '' . $download['url'];
if ($i < $downloadCount) {
$str .= PHP_EOL;
}
}
if ($key < $count) {
$str .= PHP_EOL;
Expand Down

0 comments on commit eb4a7b2

Please sign in to comment.