forked from Innei/Typecho-Theme-Paul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-music.php
78 lines (75 loc) · 2.49 KB
/
page-music.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
/**
* 音乐页面
*
* @author innei
* @package custom
*/
require_once 'pages.php';
require_once 'functions.php';
$this->need('header.php');
$json = json_decode($this->text,true);
$par = $json['par'];
$cookie = $json['cookie'];
$token = $json['token'];
$key = $json['key'];
$data = Paul::get_163_music($par, $key, $token, $cookie);
$week_data = $data['0'];
$all_data = $data['1'];
?>
<main>
<nav class="navigation">
<a href="<?php $this->options->siteUrl(); ?>">首页</a>
<a href="<?php echo $GLOBALS['music'] ?>" class="active">歌单</a>
<a href="<?php echo $GLOBALS['bangumi'] ?>">追番</a>
</nav>
<section class="paul-music">
<div class="music-cover">
<div class="fixed-cover">
<img src="https://p3.music.126.net/4HGEnXVexEfBACKi7wbq8A==/3390893860854924.jpg"/>
<h3>周排行</h3>
</div>
</div>
<div class="music-list">
<ul class="clear">
<?php $i = 0;
foreach ($week_data as $key => $item): if ($i++ < 10): ?>
<li data-sid="<?php echo $item['id'] ?>">
<span class="num"><?php echo ($key + 1) ?></span><?php echo $item['name']; ?>
<time><?php echo $item['time'] ?></time>
</li>
<?php endif;endforeach; unset($key, $item); ?>
</ul>
</div>
</section>
<section class="paul-music">
<div class="music-cover">
<div class="fixed-cover">
<img src="https://p1.music.126.net/xTCCKfCJuEh2ohPZDNMDLw==/19193074975054252.jpg"/>
<h3>总排行</h3>
</div>
</div>
<div class="music-list">
<ul class="clear">
<?php
foreach ($all_data as $key => $item): ?>
<li data-sid="<?php echo $item['id'] ?>">
<span class="num"><?php echo ($key + 1) ?></span><?php echo $item['name']; ?>
<time><?php echo $item['time'] ?></time>
</li>
<?php endforeach; ?>
</ul>
</div>
</section>
<script>
(function () {
try {
paul_music.setList();
} catch (e) {
document.addEventListener('load', () => paul_music.setList())
}
})();
</script>
</main>
<?php $this->need('footer.php') ?>