feat: 全站评论开关,并统一后台表单控件
关闭评论后前台隐藏评论能力;外观/设置/公告改用 AdminField 与 Stepper。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -151,6 +151,21 @@ func (h *Handlers) UserComments(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if allow, err := h.Setting.AllowComments(); err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "评论暂时不可用"})
|
||||
return
|
||||
} else if !allow {
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
size, _ := strconv.Atoi(c.DefaultQuery("size", "20"))
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"comments": []any{},
|
||||
"total": 0,
|
||||
"page": page,
|
||||
"size": size,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
page, _ := strconv.Atoi(c.DefaultQuery("page", "1"))
|
||||
size, _ := strconv.Atoi(c.DefaultQuery("size", "20"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user