仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<?php
2/**
3 * API 日志页视图。
4 *
5 * @package MnbtWp
6 */
7
8if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10}
11?>
12<div class="wrap">
13 <h1><?php esc_html_e( 'MNBT API 日志', 'wp-seller-plugin' ); ?></h1>
14 <?php if ( empty( $logs ) ) : ?>
15 <p class="description"><?php esc_html_e( '暂无日志。配置节点并测试连接后,这里会记录每次 API 调用(密钥已脱敏)。', 'wp-seller-plugin' ); ?></p>
16 <?php else : ?>
17 <table class="widefat striped">
18 <thead>
19 <tr>
20 <th><?php esc_html_e( 'ID', 'wp-seller-plugin' ); ?></th>
21 <th><?php esc_html_e( '节点', 'wp-seller-plugin' ); ?></th>
22 <th><?php esc_html_e( '动作', 'wp-seller-plugin' ); ?></th>
23 <th><?php esc_html_e( '参数', 'wp-seller-plugin' ); ?></th>
24 <th><?php esc_html_e( 'Code', 'wp-seller-plugin' ); ?></th>
25 <th><?php esc_html_e( '消息', 'wp-seller-plugin' ); ?></th>
26 <th><?php esc_html_e( '耗时(s)', 'wp-seller-plugin' ); ?></th>
27 <th><?php esc_html_e( '时间', 'wp-seller-plugin' ); ?></th>
28 </tr>
29 </thead>
30 <tbody>
31 <?php foreach ( $logs as $mnbtwp_log ) : ?>
32 <tr>
33 <td><?php echo (int) $mnbtwp_log['id']; ?></td>
34 <td><?php echo (int) $mnbtwp_log['provider_id']; ?></td>
35 <td><code><?php echo esc_html( $mnbtwp_log['action'] ); ?></code></td>
36 <td style="max-width:300px;word-break:break-all;">
37 <code style="font-size:11px;"><?php echo esc_html( $mnbtwp_log['params_json'] ); ?></code>
38 </td>
39 <td>
40 <?php if ( 200 === (int) $mnbtwp_log['code'] ) : ?>
41 <span style="color:#00a32a;"><?php echo (int) $mnbtwp_log['code']; ?></span>
42 <?php else : ?>
43 <span style="color:#d63638;"><?php echo (int) $mnbtwp_log['code']; ?></span>
44 <?php endif; ?>
45 </td>
46 <td style="max-width:240px;"><?php echo esc_html( $mnbtwp_log['msg'] ); ?></td>
47 <td><?php echo esc_html( $mnbtwp_log['duration'] ); ?></td>
48 <td><?php echo esc_html( $mnbtwp_log['created_at'] ); ?></td>
49 </tr>
50 <?php endforeach; ?>
51 </tbody>
52 </table>
53 <?php endif; ?>
54</div>