feat: 新增 IndexNow 批量提交接口(主页 + 专题)

POST /api/web/seopush/indexnow/bulk?limit=10
- 组装主页 "/" 和前 N-1 个专题(playlet_theme 按 Rank 降序)URL
- 调用 pub/seo/indexnow.BatchIndexNowSubmitter 提交到 api.indexnow.org
- 返回提交的 URL 列表 + IndexNow 回执(含各引擎 HTTP 状态码)
- Admin 鉴权(走 /api/web/* 的 auth 中间件)

部署前提:
- web.yaml 配置 indexNow.key
- Web 根目录可访问 /{key}.txt(内容为 key 本身)作为 IndexNow 域名验证

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 16:35:24 +08:00
co-authored by Claude Opus 4.7
parent e7179da072
commit e9f1b8b4c3
4 changed files with 121 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package web_seopush
import (
"strconv"
"hkdj-web-server/pub/common"
"hkdj-web-server/pub/common/srvdef"
"hkdj-web-server/web/service/srv_seopush"
"github.com/gin-gonic/gin"
)
// @Tags SEO推送
// @Summary IndexNow 批量提交(主页 + 专题)
// @Description 组装主页和前 N 个专题(按 Rank 降序)地址,提交到 IndexNow(Bing / Yandex 等)。
// @Produce json
// @Param limit query int false "URL 总数,含主页,默认 10"
// @Success 200 {object} srv_seopush.BulkIndexNowResult
// @Router /api/web/seopush/indexnow/bulk [POST]
func SubmitHomeAndThemes(ctx *gin.Context) {
limit, _ := strconv.Atoi(ctx.Query("limit"))
if limit <= 0 {
limit = 10
}
resp, serr := srv_seopush.SubmitHomeAndThemes(ctx, limit)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Msg)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}