<?php
// +----------------------------------------------------------------------
// | 获取播放器 [ 世界上最好用的QQ秒赞系统 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014~2019 http://www.eirds.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 天方夜谭 <17404785@qq.com>
// +----------------------------------------------------------------------

//加载应用核心
require('../Includes/common.php');

//设置默认编码
header('Content-Type:application/json; charset=utf-8');

//获取ID
$id = GET('id');

//获取KEY
$only = GET('key');

//判断ID是否存在
if (!empty($id) && !empty($only)){
    if ($info=$TFYT_DB->get_row("select id,name,auto_play,play_mode from ".PREFIX."player where id='{$id}' and `only`='{$only}'")){
        $song_list = $TFYT_DB->get_results("select id,name,img from ".PREFIX."player_song where player_id='{$info->id}' and `only`='{$only}' order by sort asc");
        $music_list = $TFYT_DB->get_results("select music_id,music_name,music_artist,music_album,music_url_id,music_pic_id,music_lyric_id,music_source,music_sort from ".PREFIX."player_music where song_id='{$song_list[0]->id}' and `only`='{$only}'");
        $arr = array('state'=>'ok','msg'=>'获取播放器数据成功！','info'=>$info,'song_list'=>$song_list,'music_list'=>$music_list);
    }else{
        $arr = array('state'=>'no','msg'=>'找不到播放器！');
    }
}else{
    $arr = array('state'=>'no','msg'=>'缺少参数！');
}

//输出结果
exit(json_encode($arr));