@@ -0,0 +1,34 @@
|
||||
package contentmarkerctrl
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"91porn-server/app/appg"
|
||||
"91porn-server/app/service/contentmarkerser"
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/log"
|
||||
"91porn-server/common/stderr"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Get doc
|
||||
// @Summary 获取首页及亚模块内容更新时间
|
||||
// @Description 客户端根据更新时间与本地已读时间判断是否展示红点
|
||||
// @Tags 内容更新
|
||||
// @Produce json
|
||||
// @Success 200 {object} contentmarkerser.Response
|
||||
// @Router /api/app/content/update-markers [get]
|
||||
func Get(ctx *gin.Context) {
|
||||
var cache contentmarkerser.MarkerCache
|
||||
if appg.Redis != nil {
|
||||
cache = appg.Redis
|
||||
}
|
||||
data, err := contentmarkerser.GetCached(time.Now(), cache)
|
||||
if err != nil {
|
||||
log.Error("get content update markers failed", log.E(err))
|
||||
common.ServeJSON(ctx, stderr.ErrDbQueryError, nil)
|
||||
return
|
||||
}
|
||||
common.ServeJSON(ctx, stderr.Success, data)
|
||||
}
|
||||
Reference in New Issue
Block a user