This commit is contained in:
mei 2024-11-03 12:54:31 +08:00
parent c8a93ddf65
commit 23bda4a56f
4 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@ if ($api_class == 'admin') {
// 处理管理员请求 // 处理管理员请求
// ... // ...
} else { } else {
http_response_code(401) http_response_code(401);
echo json_encode(['error' => 'Unauthorized', 'code' => 401]); echo json_encode(['error' => 'Unauthorized', 'code' => 401]);
exit; exit;
} }
@ -16,7 +16,7 @@ elseif ($api_class != 'admin') {
// 处理已登录用户请求 // 处理已登录用户请求
// ... // ...
} else { } else {
http_response_code(401) http_response_code(401);
echo json_encode(['error' => 'Unauthorized', 'code' => 401]); echo json_encode(['error' => 'Unauthorized', 'code' => 401]);
exit; exit;
} }

View File

@ -28,6 +28,7 @@ if ($article) {
'article' => [ 'article' => [
'title' => $article['title'], 'title' => $article['title'],
'author' => 'admin', // TODO: 'author' => 'admin', // TODO:
'auth_avatarUrl' => 'TODO',
'publishDate' => $article['publishDate'], 'publishDate' => $article['publishDate'],
'content' => $article['content'] 'content' => $article['content']
], ],
@ -35,7 +36,7 @@ if ($article) {
return [ return [
'id' => $comment['id'], 'id' => $comment['id'],
'author' => $comment['author'], 'author' => $comment['author'],
'avatarUrl' => $comment['avatarUrl'] ? $comment['avatarUrl'] : '/placeholder.svg?height=40&width=40', 'avatarUrl' => $comment['avatarUrl'] ? $comment['avatarUrl'] : '',
'content' => $comment['content'] 'content' => $comment['content']
]; ];
}, $comments) }, $comments)

View File

@ -1,5 +1,6 @@
<?php <?php
include 'core/db.php'; // 这个玩意,写着写着就发现其实根本就没什么人用,不管你用了什么新技术,新架构,多么快速,多么方便,学生还是更愿意给人力驱动的表白墙投稿,所以后面写的就放飞自我了,写着玩~~
include 'core/config.php';
include 'core/clean.php'; include 'core/clean.php';
// TODO: cookie management // TODO: cookie management