FusionCharts.
</td>
</tr>
</table>
</body>
</html>```
cachemoni/lib/cachemoni.pm中相关函数如下:
```perl
use Time::Local;
get '/cdncharts' => sub {
my $type = params->{chartstype};
my $begin = unix_time_format(params->{timefrom});
my $end = unix_time_format(params->{timeto});
my $req_url = "/xml?begin=${begin}&end=${end}&type=${type}";
my $line = 1 if $type eq 'time';
template 'charts', { line => $line, url => "$req_url", };
};
sub unix_time_format {
my $time = shift;
if ( $time =~ m/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})/ ) {
return timelocal('00',$5,$4,$3,$2-1,$1-1900);
};
};```
这里比较怪的是,如果setDataURL里传的arg是直接2011-08-01 11:00的格式,fusionchart.js不会发起请求,只有1311111111才行,所以只能在用Time::Local模块转换时间了。
最终访问结果如下:
|