<?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>
// +----------------------------------------------------------------------

//页面标题
define('Title', 'QQ挂机管理');

//删除挂机
if (POST('action')=='del'){
    header('Content-Type:application/json; charset=utf-8');
    $id = POST('id');
    if (empty($id)){
        $arr = array('state'=>'no','msg'=>'系统找不到要删除的挂机！');
    }else{
        $arr = json_decode(curl_get(TFYT('terminal_api').'?key='.TFYT('terminal_key').'&cron='.TFYT('terminal_cron').'&action=del&only='.$GLOBALS['users']['only'].'&qid='.$id));
    }
    exit(json_encode($arr));
}elseif (POST('action')=='info'){
    header('Content-Type:application/json; charset=utf-8');
    $id = POST('id');
    if (empty($id)){
        $arr = array('state'=>'no','msg'=>'系统找不到要获取信息的挂机！');
    }else{
        setcookie("tfyt_qid",$id,time()+3600*24*14,'/');
        $arr = json_decode(curl_get(TFYT('terminal_api').'?key='.TFYT('terminal_key').'&cron='.TFYT('terminal_cron').'&action=info&only='.$GLOBALS['users']['only'].'&qid='.$id));
    }
    exit(json_encode($arr));
}

//获取QQ列表
$list = json_decode(curl_get(TFYT('terminal_api').'?key='.TFYT('terminal_key').'&cron='.TFYT('terminal_cron').'&action=list&only='.$GLOBALS['users']['only']));

//获取QQ数量
$count = json_decode(curl_get(TFYT('terminal_api').'?key='.TFYT('terminal_key').'&cron='.TFYT('terminal_cron').'&action=count&only='.$GLOBALS['users']['only']));

//加载头部
Load_Template(Mains.'head.php');

//加载视图
Load_Template(Mains.'qqlist.php');

//加载底部
Load_Template(Mains.'foot.php');