<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class plugin_appad{
function info() {
$cache_key = 'plugin_appad_contents';
loadcache($cache_key);
global $_G;
if (isset($_G['cache'][$cache_key]) && $_G['cache'][$cache_key]['time'] > time() - 600 && ($json_data = json_decode($_G['cache'][$cache_key]['data'], true))) {
return $json_data;
} else {
$cache_data = $_G['cache'][$cache_key];
$ch = curl_init();
$url="http://asadasdaspp.sfgj.org/api/market/rookie_list?channel=web&lang=zh-CN®ion=cn&sign=a60c099fb09264f010f1a822bd7973f3";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$cache_data['data']=$result;
$cache_data['time']=time();
savecache($cache_key, $cache_data);
return json_decode($result, true);
}
}
}
class plugin_appad_forum extends plugin_appad{
public function viewthread_appad_output(){
global $_G;
$cache_key = 'plugin_appad_contents';
loadcache($cache_key);
if (!$_G['cache'][$cache_key]) {
return array();
}
$dataTmp=$this->info();
$data=array();
for($i=0;$i<8;$i++){
$data[]=$dataTmp[$i];
}
include template('appad:appad');
return $html;
}
}
|