@@ -68,15 +68,17 @@ func (h *BaseHandler) TopicDetailPage(ctx *fasthttp.RequestCtx) {
68
68
evn .ShowAutoAd = true
69
69
}
70
70
71
+ evn .ReadMoreBreak = model .ReadMoreBreak
71
72
evn .NodeLst = model .NodeGetAll (h .App .Mc , db )
72
73
73
74
logoUrl := scf .MainDomain + "/static/logo_112.png"
74
75
var imgLst []string
75
76
76
77
var contentFmt string
77
78
// get from mc
79
+ var canRead bool
80
+ var isPublic bool
78
81
if topic .ReadAuthed || topic .ReadReply {
79
- var canRead bool
80
82
if curUser .ID > 0 && curUser .Flag > model .FlagReview {
81
83
if topic .ReadAuthed || curUser .Flag == model .FlagAdmin || curUser .ID == author .ID {
82
84
canRead = true
@@ -98,28 +100,31 @@ func (h *BaseHandler) TopicDetailPage(ctx *fasthttp.RequestCtx) {
98
100
contentFmt = util .ContentFmt (publicCon )
99
101
contentFmt = strings .ReplaceAll (contentFmt , `" alt="">` , `" alt="` + safeTitle + `">` )
100
102
// read more tip
101
- imgLen := util .CountAllImgInContent (privateCon )
102
- actName := "登录"
103
- if curUser .ID > 0 {
104
- if curUser .Flag == model .FlagForbidden {
105
- actName = "解禁"
106
- } else if curUser .Flag == model .FlagReview {
107
- actName = "等待审核"
108
- } else {
109
- if topic .ReadReply {
110
- actName = "回复"
103
+ if len (privateCon ) > 0 {
104
+ imgLen := util .CountAllImgInContent (privateCon )
105
+ actName := "登录"
106
+ if curUser .ID > 0 {
107
+ if curUser .Flag == model .FlagForbidden {
108
+ actName = "解禁"
109
+ } else if curUser .Flag == model .FlagReview {
110
+ actName = "等待审核"
111
+ } else {
112
+ if topic .ReadReply {
113
+ actName = "回复"
114
+ }
111
115
}
112
116
}
117
+ contentFmt += `<p>为了防止爬虫,本主题 "` + topic .Title + `" 的发布者已设置浏览权限,需要“` + actName + `”才能继续浏览,剩余的内容包含个` + strconv .Itoa (len (privateCon )) + `字`
118
+ if imgLen > 0 {
119
+ contentFmt += `,其中包含` + strconv .Itoa (imgLen ) + `张图片`
120
+ }
121
+ contentFmt += `</p>`
113
122
}
114
- contentFmt += `<p>为了防止爬虫,本主题 "` + topic .Title + `" 的发布者已设置浏览权限,需要“` + actName + `”才能继续浏览,剩余的内容包含个` + strconv .Itoa (len (privateCon )) + `字`
115
- if imgLen > 0 {
116
- contentFmt += `,其中包含` + strconv .Itoa (imgLen ) + `张图片`
117
- }
118
- contentFmt += `</p>`
119
123
// find img
120
124
imgLst = util .FindAllImgInContent (publicCon )
121
125
}
122
126
} else {
127
+ isPublic = true
123
128
mcKey := []byte ("ContentFmt:" + tid )
124
129
if mcValue , exist := util .ObjCachedGet (h .App .Mc , mcKey , nil , true ); exist {
125
130
contentFmt = sdb .B2s (mcValue )
@@ -146,7 +151,7 @@ func (h *BaseHandler) TopicDetailPage(ctx *fasthttp.RequestCtx) {
146
151
// 帖子评论数
147
152
topic .Comments = db .HgetInt (model .CommentNumTbName , tidByte )
148
153
if topic .Comments > 0 {
149
- evn .CommentLst = model .GetAllTopicComment (h .App .Mc , db , topic )
154
+ evn .CommentLst = model .GetAllTopicComment (h .App .Mc , db , topic , isPublic , canRead )
150
155
}
151
156
152
157
evn .TopicFmt = model.TopicFmt {
0 commit comments