增加接口,增加index
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
编码猿
2024-12-12 11:10:07 +08:00
parent 443d248cb4
commit 4dd0c5d928
10 changed files with 92 additions and 20 deletions

View File

@@ -5,7 +5,7 @@ import Config from '../config/config.js'
const router = express.Router();
// 搜索页面的 热门关键词 & 推荐
// http://192.168.31.101:3030/v1/api/search/hot
// http://192.168.31.101:9940/v1/api/search/hot
router.get('/hot', async (req, res) => {
let $ = await Util.get(`${Config.baseUrl}/wp-admin/admin-ajax.php?action=search_box`)
let result = {
@@ -36,7 +36,7 @@ router.get('/hot', async (req, res) => {
// 搜索接口
// http://192.168.31.101:3030/v1/api/search/key?keyword=杨晨晨&page=1
// http://192.168.31.101:9940/v1/api/search/key?keyword=杨晨晨&page=1
router.get('/key', async (req, res) => {
let { keyword, page } = req.query
page = page || 1
@@ -44,7 +44,7 @@ router.get('/key', async (req, res) => {
let $ = await Util.get(`${Config.baseUrl}/page/${page}?s=${encodeURI(keyword)}&type=post`)
let result = {
currentPage: page,
totalPage: Number($(".pagenav .dots+a").text()),
totalPage: utils.maxPage(".pagenav a", $),
message: $(".search-content .badg .focus-color").text(),
list: [],
}