From fb8fe3526b5081285a21651fdaddb8e1ba6ede33 Mon Sep 17 00:00:00 2001 From: net909 Date: Tue, 6 May 2025 12:16:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=81=E4=B9=A6API?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/Cert.php | 11 +++++++++++ route/app.php | 2 ++ 2 files changed, 13 insertions(+) diff --git a/app/controller/Cert.php b/app/controller/Cert.php index 5f69e54..9a1b104 100644 --- a/app/controller/Cert.php +++ b/app/controller/Cert.php @@ -244,6 +244,17 @@ class Cert extends BaseController return json(['total' => $total, 'rows' => $list]); } + public function order_info() + { + if (!checkPermission(2)) return $this->alert('error', '无权限'); + $id = input('post.id/d'); + $row = Db::name('cert_order')->where('id', $id)->find(); + if (!$row) return json(['code' => -1, 'msg' => '证书订单不存在']); + $pfx = CertHelper::getPfx($row['fullchain'], $row['privatekey']); + $row['pfx'] = base64_encode($pfx); + return json(['code' => 0, 'data' => ['id' => $row['id'], 'crt' => $row['fullchain'], 'key' => $row['privatekey'], 'pfx' => $row['pfx'], 'issuetime' => $row['issuetime'], 'expiretime' => $row['expiretime'], 'domains' => Db::name('cert_domain')->where('oid', $row['id'])->order('sort','ASC')->column('domain')]]); + } + public function order_op() { if (!checkPermission(2)) return $this->alert('error', '无权限'); diff --git a/route/app.php b/route/app.php index 06dc587..86092a1 100644 --- a/route/app.php +++ b/route/app.php @@ -136,6 +136,8 @@ Route::group('api', function () { Route::post('/record/remark/:id', 'domain/record_remark'); Route::post('/record/batch/:id', 'domain/record_batch'); + Route::post('/cert/order', 'cert/order_info'); + })->middleware(AuthApi::class); Route::miss(function() {