Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
fix: ver 1.6 fix music page.
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Jun 26, 2019
1 parent edbbfa9 commit 51bca29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Pual.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,25 @@ static function get_163_music($par, $key, $token, $cookie)

$result = file_get_contents($url, false, $context);
$json = json_decode($result, true);
$num = 0;

$num = 1;
$week_data = array();
foreach ($json['weekData'] as $key => $item) {
if ($num < 10):
$playTime = date('H:i:s', $item['song']['song']['playTime']);
if ($num <= 10):
$playTime = date('i:s', $item['song']['dt'] / 1000);
$week_data[] = ['name' => $item['song']['name'], 'id' => $item['song']['song']['id'], 'time' => $playTime, 'num' => $num++];
else:break;
endif;
}
$num = 0;
$num = 1;
$all_data = array();
foreach ($json['allData'] as $key => $item) {
if ($num < 10):
$playTime = date('H:i:s', $item['song']['song']['playTime']);
$all_data[] = ['name' => $item['song']['name'], 'id' => $item['song']['song']['id'], 'time' => $playTime, 'num' => $num++];
if ($num <= 10):
$playTime = date('i:s', $item['song']['dt'] / 1000);
$all_data[] = ['name' => $item['song']['name'], 'id' => $item['song']['song']['id'], 'time' => $playTime, 'seq' => $num++, 'num' => $item['playCount']];
else:break;
endif;
}

return [$week_data, $all_data];
}

Expand Down
4 changes: 2 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}
require_once 'pages.php';
?>

<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title><?php $this->archiveTitle(array(
Expand Down Expand Up @@ -70,7 +70,7 @@
$GLOBALS['note'] ? print_r('<a href="' . $GLOBALS['note'] . '"><i class="fa fa-book"></i><span>日记</span></a>') : print_r('');
$GLOBALS['project'] ? print_r('<a href="' . $GLOBALS['project'] . '"><i class="fa fa-flask"></i><span>项目</span></a>') : print_r('');
$GLOBALS['archive'] ? print_r('<a href="' . $GLOBALS['archive'] . '"><i class="fa fa-archive"></i><span>归档</span></a>') : print_r('');
$GLOBALS['bangumi'] ? print_r('<a href="' . $GLOBALS['bangumi'] . '"><i class="fa fa-star"></i><span>爱好</span></a>') : ($GLOBALS['music'] ? print_r('<a href="' . $GLOBALS['music'] . '"><i class="fa fa-star"></i><span>爱好</span></a>') : print_r(''));
$GLOBALS['music'] ? print_r('<a href="' . $GLOBALS['music'] . '"><i class="fa fa-star"></i><span>爱好</span></a>') : ($GLOBALS['bangumi'] ? print_r('<a href="' . $GLOBALS['bangumi'] . '"><i class="fa fa-star"></i><span>爱好</span></a>') : print_r(''));
$GLOBALS['link'] ? print_r('<a href="' . $GLOBALS['link'] . '"><i class="fa fa-link"></i><span>朋友们</span></a>') : print_r('');
?>
<?php if ($this->user->hasLogin()): ?>
Expand Down
4 changes: 1 addition & 3 deletions page-music.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@
try {
paul_music.setList();
} catch (e) {
window.onload = () => {
paul_music.setList();
}
document.addEventListener('load', () => paul_music.setList())
}
})();
</script>
Expand Down

0 comments on commit 51bca29

Please sign in to comment.