Esempio n. 1
0
 public function actionIndex()
 {
     $kw = trim($this->get("kw", ""));
     $music_list = [];
     if ($kw) {
         $songs = QQMusicService::search($kw, false, ['page_size' => 20]);
         if ($songs) {
             foreach ($songs as $_song) {
                 $music_list[] = $_song;
             }
         }
     }
     $this->setTitle("QQ音乐资源获取");
     $this->setSubTitle("QQ音乐资源获取");
     return $this->render("index", ["music_list" => $music_list, "kw" => $kw]);
 }
Esempio n. 2
0
 private function searchMusicByKw($kw)
 {
     $songs = QQMusicService::search($kw);
     $list = [];
     if ($songs) {
         foreach ($songs as $_song_info) {
             $list[] = ["title" => $_song_info['song_author'] . " -- " . $_song_info['song_title'], "description" => '', "picurl" => $_song_info['cover_image'], "url" => $_song_info['view_url']];
         }
     }
     $data = $list ? $this->getRichXml($list) : "抱歉没有搜索到关于 {$kw} 的歌曲";
     $type = $list ? "rich" : "text";
     return ['type' => $type, "data" => $data];
 }