<?php
require __DIR__.'/../src/bootstrap.php';require_admin();$rows=captures();$usage=array_sum(array_column($rows,'bytes'));$state=settings();page_start('采集记录');
?><section class="stats"><article><span>采集批次</span><strong><?=count($rows)?></strong></article><article><span>截图总数</span><strong><?=count($rows)*20?></strong></article><article><span>存储占用</span><strong><?=number_format($usage/1048576,1)?> <small>MB / 2 GB</small></strong></article><article><span>上传状态</span><strong class="<?= $state['enabled']?'good':'error' ?>"><?= $state['enabled']?'接收中':'已暂停' ?></strong></article></section><section class="card"><div class="section-title"><h2>最近采集</h2><p class="muted">每批20张 · 设备端明确确认后上传</p></div><?php if(!$rows):?><p class="empty">尚无上传记录。先在“上传管理”下载设备配置。</p><?php else:?><form method="post" action="/delete.php"><input type="hidden" name="csrf" value="<?=h(csrf())?>"><div class="table-wrap"><table><thead><tr><th>选择</th><th>预览</th><th>时间 / 批次</th><th>内容</th><th>操作</th></tr></thead><tbody><?php foreach($rows as $row):?><tr><td><input type="checkbox" name="ids[]" value="<?=h($row['id'])?>"></td><td><a href="/view.php?id=<?=h($row['id'])?>"><img class="thumb" loading="lazy" src="/image.php?id=<?=h($row['id'])?>&n=1" alt="首张截图"></a></td><td><?=h(date('Y-m-d H:i:s',$row['created']))?><div class="muted mono"><?=h(substr($row['id'],0,12))?></div></td><td><?=h($row['label'])?><div class="muted">20张 · <?=number_format($row['bytes']/1048576,1)?> MB</div></td><td><a class="pill" href="/view.php?id=<?=h($row['id'])?>">查看</a> <a class="pill" href="/download.php?id=<?=h($row['id'])?>">下载ZIP</a></td></tr><?php endforeach?></tbody></table></div><div class="actions"><button class="danger" name="confirm" value="yes">删除选中记录</button><span class="muted">同时删除截图和ZIP文件。</span></div></form><?php endif?></section><?php page_end();
