restrict v8

This commit is contained in:
tamakyi
2026-10-18 23:32:38 +08:00
parent 317c96ca17
commit 7a6417c33d
21 changed files with 626 additions and 21 deletions
+12
View File
@@ -363,6 +363,18 @@ func QuestionList(ctx context.Context) {
ctx.Data["SelectedType"] = typeParam
ctx.Data["SelectedReported"] = reportedParam
// 处置期条幅:箱主必须能持续看到自己处在限制里。
// 只靠回答后那条一闪而过的提示是不够的 —— 线上实测过箱主完全没意识到 L2 已生效。
// 查询失败不阻断页面,只是少一条提示。
if level, active, rErr := db.Restrictions.ActiveLevel(ctx.Request().Context(), ctx.User.ID); rErr != nil {
logrus.WithContext(ctx.Request().Context()).WithError(rErr).Error("Failed to query active restriction")
} else if level != "" {
ctx.Data["RestrictionLevel"] = string(level)
if active != nil {
ctx.Data["RestrictionExpiresAt"] = active.ExpiresAt.Format("2006-01-02")
}
}
// 我发起的私聊 — 同样使用批量查询与分页(复用 chat_cursor 游标)
askerConvs, err := db.Conversations.ListByAsker(ctx.Request().Context(), ctx.User.ID, chatPageSize, int(chatOffset))
if err != nil {