ThirdPartyServiceController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. <?php
  2. namespace App\Module\ThirdParty\AdminControllers;
  3. use UCore\DcatAdmin\AdminController;
  4. use App\Module\ThirdParty\Models\ThirdPartyService;
  5. use App\Module\ThirdParty\Repositorys\ThirdPartyServiceRepository;
  6. use App\Module\ThirdParty\Enums\SERVICE_TYPE;
  7. use App\Module\ThirdParty\Enums\AUTH_TYPE;
  8. use App\Module\ThirdParty\Enums\SERVICE_STATUS;
  9. use Dcat\Admin\Form;
  10. use Dcat\Admin\Grid;
  11. use Dcat\Admin\Show;
  12. use Dcat\Admin\Layout\Content;
  13. use Dcat\Admin\Layout\Row;
  14. use Dcat\Admin\Layout\Column;
  15. use App\Module\ThirdParty\Metrics\ServiceOverviewCard;
  16. use Spatie\RouteAttributes\Attributes\Resource;
  17. use Spatie\RouteAttributes\Attributes\Get;
  18. /**
  19. * 第三方服务管理控制器
  20. *
  21. * 路由: /admin/thirdparty/services
  22. */
  23. #[Resource('thirdparty/services', names: 'dcat.admin.thirdparty.services')]
  24. class ThirdPartyServiceController extends AdminController
  25. {
  26. /**
  27. * 页面标题
  28. *
  29. * @var string
  30. */
  31. protected $title = '第三方服务管理';
  32. /**
  33. * 数据仓库
  34. *
  35. * @return string
  36. */
  37. protected function repository()
  38. {
  39. return ThirdPartyServiceRepository::class;
  40. }
  41. /**
  42. * 列表页面
  43. *
  44. * @return Grid
  45. */
  46. protected function grid(): Grid
  47. {
  48. return Grid::make(new ThirdPartyServiceRepository(), function (Grid $grid) {
  49. // 基础设置
  50. $grid->column('id', 'ID')->sortable();
  51. $grid->column('name', '服务名称')->sortable();
  52. $grid->column('code', '服务代码')->sortable();
  53. // 服务类型
  54. $grid->column('type', '服务类型')->display(function ($type) {
  55. $serviceType = SERVICE_TYPE::tryFrom($type);
  56. if ($serviceType) {
  57. $label = $serviceType->getLabel();
  58. $color = $serviceType->getColor();
  59. return "<span class='badge badge-{$color}'>{$label}</span>";
  60. }
  61. return $type;
  62. });
  63. // 服务提供商
  64. $grid->column('provider', '服务提供商')->sortable();
  65. // 认证类型
  66. $grid->column('auth_type', '认证类型')->display(function ($authType) {
  67. $auth = AUTH_TYPE::tryFrom($authType);
  68. if ($auth) {
  69. $label = $auth->getLabel();
  70. $level = $auth->getSecurityLevel();
  71. $color = $auth->getSecurityLevelColor();
  72. return "<span class='badge badge-{$color}' title='安全级别: {$level}'>{$label}</span>";
  73. }
  74. return $authType;
  75. });
  76. // 服务状态
  77. $grid->column('status', '状态')->display(function ($status) {
  78. $serviceStatus = SERVICE_STATUS::tryFrom($status);
  79. if ($serviceStatus) {
  80. $label = $serviceStatus->getLabel();
  81. $color = $serviceStatus->getColor();
  82. $icon = $serviceStatus->getIcon();
  83. return "<span class='badge badge-{$color}'><i class='{$icon}'></i> {$label}</span>";
  84. }
  85. return $status;
  86. });
  87. // 优先级
  88. $grid->column('priority', '优先级')->sortable();
  89. // 健康状态
  90. $grid->column('health_status', '健康状态')->display(function ($healthStatus) {
  91. $colors = [
  92. 'HEALTHY' => 'success',
  93. 'WARNING' => 'warning',
  94. 'ERROR' => 'danger',
  95. 'UNKNOWN' => 'secondary',
  96. ];
  97. $color = $colors[$healthStatus] ?? 'secondary';
  98. return "<span class='badge badge-{$color}'>{$healthStatus}</span>";
  99. });
  100. // 最后健康检查时间
  101. $grid->column('last_health_check', '最后检查')->display(function ($time) {
  102. return $time ? $time : '未检查';
  103. });
  104. // 创建时间
  105. $grid->column('created_at', '创建时间')->sortable();
  106. // 过滤器
  107. $grid->filter(function (Grid\Filter $filter) {
  108. $filter->equal('type', '服务类型')->select(SERVICE_TYPE::getOptions());
  109. $filter->equal('status', '状态')->select(SERVICE_STATUS::getOptions());
  110. $filter->equal('auth_type', '认证类型')->select(AUTH_TYPE::getOptions());
  111. $filter->like('name', '服务名称');
  112. $filter->like('code', '服务代码');
  113. $filter->like('provider', '服务提供商');
  114. });
  115. // 批量操作
  116. $grid->batchActions(function (Grid\Tools\BatchActions $batch) {
  117. // TODO: 创建批量操作类
  118. // $batch->add('批量激活', new \App\Module\ThirdParty\AdminActions\BatchActivateServiceAction());
  119. // $batch->add('批量停用', new \App\Module\ThirdParty\AdminActions\BatchDeactivateServiceAction());
  120. });
  121. // 工具栏
  122. $grid->tools(function (Grid\Tools $tools) {
  123. $tools->append('<a href="/admin/thirdparty/services/health-check" class="btn btn-sm btn-success"><i class="fa fa-heartbeat"></i> 健康检查</a>');
  124. $tools->append('<a href="/admin/thirdparty/services/stats" class="btn btn-sm btn-info"><i class="fa fa-chart-bar"></i> 统计报告</a>');
  125. });
  126. // 行操作
  127. $grid->actions(function (Grid\Displayers\Actions $actions) {
  128. $actions->append('<a href="/admin/thirdparty/credentials?service_id=' . $actions->getKey() . '" class="btn btn-xs btn-primary"><i class="fa fa-key"></i> 凭证</a>');
  129. $actions->append('<a href="/admin/thirdparty/logs?service_id=' . $actions->getKey() . '" class="btn btn-xs btn-info"><i class="fa fa-list"></i> 日志</a>');
  130. if ($actions->row->status === SERVICE_STATUS::ACTIVE->value) {
  131. $actions->append('<a href="/admin/thirdparty/services/' . $actions->getKey() . '/test" class="btn btn-xs btn-warning"><i class="fa fa-flask"></i> 测试</a>');
  132. }
  133. });
  134. // 默认排序
  135. $grid->model()->orderBy('priority')->orderBy('name');
  136. });
  137. }
  138. /**
  139. * 详情页面
  140. *
  141. * @return Show
  142. */
  143. protected function detail($id): Show
  144. {
  145. return Show::make($id, new ThirdPartyServiceRepository(), function (Show $show) {
  146. $show->field('id', 'ID');
  147. $show->field('name', '服务名称');
  148. $show->field('code', '服务代码');
  149. $show->field('type', '服务类型')->as(function ($type) {
  150. $serviceType = SERVICE_TYPE::tryFrom($type);
  151. return $serviceType ? $serviceType->getLabel() : $type;
  152. });
  153. $show->field('provider', '服务提供商');
  154. $show->field('description', '服务描述');
  155. $show->field('base_url', '基础URL');
  156. $show->field('version', 'API版本');
  157. $show->field('auth_type', '认证类型')->as(function ($authType) {
  158. $auth = AUTH_TYPE::tryFrom($authType);
  159. return $auth ? $auth->getLabel() : $authType;
  160. });
  161. $show->field('status', '状态')->as(function ($status) {
  162. $serviceStatus = SERVICE_STATUS::tryFrom($status);
  163. return $serviceStatus ? $serviceStatus->getLabel() : $status;
  164. });
  165. $show->field('priority', '优先级');
  166. $show->field('timeout', '超时时间')->as(function ($timeout) {
  167. return $timeout . ' 秒';
  168. });
  169. $show->field('retry_times', '重试次数');
  170. $show->field('retry_delay', '重试延迟')->as(function ($delay) {
  171. return $delay . ' 毫秒';
  172. });
  173. $show->field('config', '服务配置')->json();
  174. $show->field('headers', '默认请求头')->json();
  175. $show->field('params', '默认参数')->json();
  176. $show->field('webhook_url', 'Webhook URL');
  177. $show->field('health_check_url', '健康检查URL');
  178. $show->field('health_check_interval', '健康检查间隔')->as(function ($interval) {
  179. return $interval . ' 秒';
  180. });
  181. $show->field('health_status', '健康状态');
  182. $show->field('last_health_check', '最后健康检查时间');
  183. $show->field('created_at', '创建时间');
  184. $show->field('updated_at', '更新时间');
  185. // 关联信息
  186. $show->relation('credentials', '认证凭证', function ($model) {
  187. $grid = new Grid(new \App\Module\ThirdParty\Models\ThirdPartyCredential());
  188. $grid->model()->where('service_id', $model->id);
  189. $grid->column('name', '凭证名称');
  190. $grid->column('type', '认证类型');
  191. $grid->column('environment', '环境');
  192. $grid->column('is_active', '状态')->display(function ($active) {
  193. return $active ? '<span class="badge badge-success">激活</span>' : '<span class="badge badge-secondary">未激活</span>';
  194. });
  195. $grid->column('expires_at', '过期时间');
  196. $grid->disableCreateButton();
  197. $grid->disableActions();
  198. return $grid;
  199. });
  200. });
  201. }
  202. /**
  203. * 表单页面
  204. *
  205. * @return Form
  206. */
  207. protected function form(): Form
  208. {
  209. return Form::make(new ThirdPartyServiceRepository(), function (Form $form) {
  210. $form->display('id', 'ID');
  211. $form->text('name', '服务名称')->required()->help('第三方服务的显示名称');
  212. $form->text('code', '服务代码')->help('唯一标识符,留空自动生成');
  213. $form->select('type', '服务类型')->options(SERVICE_TYPE::getOptions())->required();
  214. $form->text('provider', '服务提供商')->required();
  215. $form->textarea('description', '服务描述');
  216. $form->url('base_url', '基础URL')->help('第三方服务的API基础地址');
  217. $form->text('version', 'API版本')->default('v1');
  218. $form->select('auth_type', '认证类型')->options(AUTH_TYPE::getOptions())->required();
  219. $form->select('status', '状态')->options(SERVICE_STATUS::getOptions())->default(SERVICE_STATUS::INACTIVE->value);
  220. $form->number('priority', '优先级')->default(0)->help('数字越小优先级越高');
  221. $form->number('timeout', '超时时间(秒)')->default(30)->min(1)->max(300);
  222. $form->number('retry_times', '重试次数')->default(3)->min(0)->max(10);
  223. $form->number('retry_delay', '重试延迟(毫秒)')->default(1000)->min(100)->max(60000);
  224. $form->keyValue('config', '服务配置')
  225. ->help('服务特定配置,键值对形式输入')
  226. ->default([]);
  227. $form->keyValue('headers', '默认请求头')
  228. ->help('默认HTTP请求头,键值对形式输入')
  229. ->default([]);
  230. $form->keyValue('params', '默认参数')
  231. ->help('默认请求参数,键值对形式输入')
  232. ->default([]);
  233. $form->url('webhook_url', 'Webhook URL')->help('接收第三方服务回调的地址');
  234. $form->text('webhook_secret', 'Webhook密钥')->help('用于验证Webhook请求的密钥');
  235. $form->url('health_check_url', '健康检查URL')->help('用于检查服务健康状态的URL');
  236. $form->number('health_check_interval', '健康检查间隔(秒)')->default(300)->min(60)->max(86400);
  237. $form->display('created_at', '创建时间');
  238. $form->display('updated_at', '更新时间');
  239. // 保存前处理
  240. $form->saving(function (Form $form) {
  241. // 处理keyValue字段,转换为JSON存储
  242. $keyValueFields = ['config', 'headers', 'params'];
  243. foreach ($keyValueFields as $field) {
  244. if (isset($form->$field)) {
  245. if (is_array($form->$field) && !empty($form->$field)) {
  246. // 过滤空值
  247. $filtered = array_filter($form->$field, function($value, $key) {
  248. return !empty($key) && $value !== null && $value !== '';
  249. }, ARRAY_FILTER_USE_BOTH);
  250. // 转换为JSON存储
  251. $form->$field = !empty($filtered) ? json_encode($filtered, JSON_UNESCAPED_UNICODE) : null;
  252. } else {
  253. $form->$field = null;
  254. }
  255. }
  256. }
  257. });
  258. });
  259. }
  260. /**
  261. * 综合报告页面
  262. *
  263. * @param Content $content
  264. * @return Content
  265. */
  266. #[Get('reports/overview')]
  267. public function overview(Content $content)
  268. {
  269. return $content
  270. ->title('第三方服务综合报告')
  271. ->description('查看第三方服务的整体运行状况和统计数据')
  272. ->body(function (Row $row) {
  273. $row->column(12, function (Column $column) {
  274. $column->row(new ServiceOverviewCard());
  275. });
  276. $row->column(6, function (Column $column) {
  277. $column->row($this->buildQuickActionsCard());
  278. });
  279. $row->column(6, function (Column $column) {
  280. $column->row($this->buildRecentLogsCard());
  281. });
  282. });
  283. }
  284. /**
  285. * 测试页面 - 改为API接口
  286. *
  287. * @return \Illuminate\Http\JsonResponse
  288. */
  289. #[Get('test')]
  290. public function test()
  291. {
  292. return response()->json([
  293. 'success' => true,
  294. 'message' => 'ThirdParty模块测试接口',
  295. 'data' => [
  296. 'module' => 'ThirdParty',
  297. 'version' => '1.0.0',
  298. 'status' => 'active',
  299. 'timestamp' => now()->toISOString(),
  300. ]
  301. ]);
  302. }
  303. /**
  304. * 健康检查API接口
  305. *
  306. * @return \Illuminate\Http\JsonResponse
  307. */
  308. #[Get('health-check')]
  309. public function healthCheck()
  310. {
  311. // 获取所有服务的健康状态
  312. $services = ThirdPartyService::with(['credentials', 'quotas'])
  313. ->orderBy('priority')
  314. ->get()
  315. ->map(function ($service) {
  316. return [
  317. 'id' => $service->id,
  318. 'name' => $service->name,
  319. 'status' => $service->status,
  320. 'health_status' => $service->health_status,
  321. 'last_health_check' => $service->last_health_check?->toISOString(),
  322. 'credentials_count' => $service->credentials->count(),
  323. 'quotas_count' => $service->quotas->count(),
  324. ];
  325. });
  326. return response()->json([
  327. 'success' => true,
  328. 'message' => '服务健康检查数据',
  329. 'data' => $services
  330. ]);
  331. }
  332. /**
  333. * 统计报告API接口
  334. *
  335. * @return \Illuminate\Http\JsonResponse
  336. */
  337. #[Get('stats')]
  338. public function stats()
  339. {
  340. // 获取统计数据
  341. $stats = $this->getServiceStats();
  342. return response()->json([
  343. 'success' => true,
  344. 'message' => '服务统计报告数据',
  345. 'data' => $stats
  346. ]);
  347. }
  348. /**
  349. * 健康报告API接口
  350. *
  351. * @return \Illuminate\Http\JsonResponse
  352. */
  353. #[Get('reports/health')]
  354. public function healthReport()
  355. {
  356. // 获取健康状态统计
  357. $healthStats = $this->getHealthStats();
  358. return response()->json([
  359. 'success' => true,
  360. 'message' => '服务健康报告数据',
  361. 'data' => $healthStats
  362. ]);
  363. }
  364. /**
  365. * 使用统计报告API接口
  366. *
  367. * @return \Illuminate\Http\JsonResponse
  368. */
  369. #[Get('reports/usage')]
  370. public function usageReport()
  371. {
  372. // 获取使用统计数据
  373. $usageStats = $this->getUsageStats();
  374. return response()->json([
  375. 'success' => true,
  376. 'message' => '服务使用统计报告数据',
  377. 'data' => $usageStats
  378. ]);
  379. }
  380. /**
  381. * 获取综合报告统计数据
  382. *
  383. * @return array
  384. */
  385. protected function getOverviewStats(): array
  386. {
  387. $totalServices = ThirdPartyService::count();
  388. $activeServices = ThirdPartyService::where('status', SERVICE_STATUS::ACTIVE->value)->count();
  389. $healthyServices = ThirdPartyService::where('health_status', 'HEALTHY')->count();
  390. $totalCredentials = \App\Module\ThirdParty\Models\ThirdPartyCredential::count();
  391. $activeCredentials = \App\Module\ThirdParty\Models\ThirdPartyCredential::where('is_active', true)->count();
  392. $totalLogs = \App\Module\ThirdParty\Models\ThirdPartyLog::count();
  393. $todayLogs = \App\Module\ThirdParty\Models\ThirdPartyLog::whereDate('created_at', today())->count();
  394. $errorLogs = \App\Module\ThirdParty\Models\ThirdPartyLog::where('level', 'ERROR')->count();
  395. return [
  396. 'services' => [
  397. 'total' => $totalServices,
  398. 'active' => $activeServices,
  399. 'healthy' => $healthyServices,
  400. 'inactive' => $totalServices - $activeServices,
  401. 'unhealthy' => $totalServices - $healthyServices,
  402. ],
  403. 'credentials' => [
  404. 'total' => $totalCredentials,
  405. 'active' => $activeCredentials,
  406. 'inactive' => $totalCredentials - $activeCredentials,
  407. ],
  408. 'logs' => [
  409. 'total' => $totalLogs,
  410. 'today' => $todayLogs,
  411. 'errors' => $errorLogs,
  412. ],
  413. ];
  414. }
  415. /**
  416. * 获取服务统计数据
  417. *
  418. * @return array
  419. */
  420. protected function getServiceStats(): array
  421. {
  422. // 按服务类型统计
  423. $typeStats = ThirdPartyService::selectRaw('type, count(*) as count')
  424. ->groupBy('type')
  425. ->get()
  426. ->mapWithKeys(function ($item) {
  427. $serviceType = SERVICE_TYPE::tryFrom($item->type);
  428. $label = $serviceType ? $serviceType->getLabel() : $item->type;
  429. return [$label => $item->count];
  430. });
  431. // 按服务提供商统计
  432. $providerStats = ThirdPartyService::selectRaw('provider, count(*) as count')
  433. ->groupBy('provider')
  434. ->orderByDesc('count')
  435. ->limit(10)
  436. ->get()
  437. ->pluck('count', 'provider');
  438. // 按状态统计
  439. $statusStats = ThirdPartyService::selectRaw('status, count(*) as count')
  440. ->groupBy('status')
  441. ->get()
  442. ->mapWithKeys(function ($item) {
  443. $status = SERVICE_STATUS::tryFrom($item->status);
  444. $label = $status ? $status->getLabel() : $item->status;
  445. return [$label => $item->count];
  446. });
  447. return [
  448. 'by_type' => $typeStats,
  449. 'by_provider' => $providerStats,
  450. 'by_status' => $statusStats,
  451. ];
  452. }
  453. /**
  454. * 获取健康状态统计
  455. *
  456. * @return array
  457. */
  458. protected function getHealthStats(): array
  459. {
  460. $healthStats = ThirdPartyService::selectRaw('health_status, count(*) as count')
  461. ->groupBy('health_status')
  462. ->get()
  463. ->pluck('count', 'health_status');
  464. $recentChecks = ThirdPartyService::whereNotNull('last_health_check')
  465. ->where('last_health_check', '>=', now()->subHours(24))
  466. ->count();
  467. return [
  468. 'status_distribution' => $healthStats,
  469. 'recent_checks' => $recentChecks,
  470. 'total_services' => ThirdPartyService::count(),
  471. ];
  472. }
  473. /**
  474. * 获取使用统计数据
  475. *
  476. * @return array
  477. */
  478. protected function getUsageStats(): array
  479. {
  480. // 最近7天的API调用统计
  481. $dailyStats = \App\Module\ThirdParty\Models\ThirdPartyLog::selectRaw('DATE(created_at) as date, count(*) as count')
  482. ->where('created_at', '>=', now()->subDays(7))
  483. ->groupBy('date')
  484. ->orderBy('date')
  485. ->get()
  486. ->pluck('count', 'date');
  487. // 按服务统计调用次数
  488. $serviceStats = \App\Module\ThirdParty\Models\ThirdPartyLog::join('kku_thirdparty_services', 'kku_thirdparty_logs.service_id', '=', 'kku_thirdparty_services.id')
  489. ->selectRaw('kku_thirdparty_services.name, count(*) as count')
  490. ->groupBy('kku_thirdparty_services.id', 'kku_thirdparty_services.name')
  491. ->orderByDesc('count')
  492. ->limit(10)
  493. ->get()
  494. ->pluck('count', 'name');
  495. return [
  496. 'daily_calls' => $dailyStats,
  497. 'service_calls' => $serviceStats,
  498. ];
  499. }
  500. /**
  501. * 构建快速操作卡片
  502. *
  503. * @return string
  504. */
  505. protected function buildQuickActionsCard()
  506. {
  507. return <<<HTML
  508. <div class="card">
  509. <div class="card-header">
  510. <h4 class="card-title">
  511. <i class="fa fa-tools"></i> 快速操作
  512. </h4>
  513. </div>
  514. <div class="card-body">
  515. <div class="btn-group-vertical w-100" role="group">
  516. <a href="/admin/thirdparty/services" class="btn btn-primary mb-2">
  517. <i class="fa fa-server"></i> 服务管理
  518. </a>
  519. <a href="/admin/thirdparty/credentials" class="btn btn-success mb-2">
  520. <i class="fa fa-key"></i> 凭证管理
  521. </a>
  522. <a href="/admin/thirdparty/logs" class="btn btn-info mb-2">
  523. <i class="fa fa-list-alt"></i> 调用日志
  524. </a>
  525. <a href="/admin/thirdparty/quotas" class="btn btn-warning mb-2">
  526. <i class="fa fa-tachometer-alt"></i> 配额管理
  527. </a>
  528. <a href="/admin/thirdparty/monitors" class="btn btn-secondary">
  529. <i class="fa fa-heartbeat"></i> 监控记录
  530. </a>
  531. </div>
  532. </div>
  533. </div>
  534. HTML;
  535. }
  536. /**
  537. * 构建最近日志卡片
  538. *
  539. * @return string
  540. */
  541. protected function buildRecentLogsCard()
  542. {
  543. $recentLogs = \App\Module\ThirdParty\Models\ThirdPartyLog::with('service')
  544. ->orderBy('created_at', 'desc')
  545. ->limit(5)
  546. ->get();
  547. $logsHtml = '';
  548. foreach ($recentLogs as $log) {
  549. $levelClass = $log->level === 'ERROR' ? 'danger' : ($log->level === 'WARNING' ? 'warning' : 'info');
  550. $serviceName = $log->service ? $log->service->name : 'Unknown';
  551. $timeAgo = $log->created_at->diffForHumans();
  552. $logsHtml .= <<<HTML
  553. <div class="d-flex justify-content-between align-items-center border-bottom py-2">
  554. <div>
  555. <span class="badge badge-{$levelClass}">{$log->level}</span>
  556. <span class="ml-2">{$serviceName}</span>
  557. </div>
  558. <small class="text-muted">{$timeAgo}</small>
  559. </div>
  560. HTML;
  561. }
  562. return <<<HTML
  563. <div class="card">
  564. <div class="card-header">
  565. <h4 class="card-title">
  566. <i class="fa fa-clock"></i> 最近日志
  567. </h4>
  568. </div>
  569. <div class="card-body">
  570. {$logsHtml}
  571. <div class="text-center mt-3">
  572. <a href="/admin/thirdparty/logs" class="btn btn-sm btn-outline-primary">
  573. 查看更多日志
  574. </a>
  575. </div>
  576. </div>
  577. </div>
  578. HTML;
  579. }
  580. }