File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -161,8 +161,12 @@ func (TopicController) Detail(ctx echo.Context) error {
161
161
}
162
162
163
163
me , ok := ctx .Get ("user" ).(* model.Me )
164
- // 当前用户是否对付费内容可见
165
- if topic ["permission" ] == model .PermissionPay {
164
+ if topic ["permission" ] == model .PermissionOnlyMe {
165
+ if ! ok || (topic ["uid" ].(int ) != me .Uid && ! me .IsRoot ) {
166
+ return ctx .Redirect (http .StatusSeeOther , "/topics" )
167
+ }
168
+ } else if topic ["permission" ] == model .PermissionPay {
169
+ // 当前用户是否对付费内容可见
166
170
if ! ok || (! me .IsVip && ! me .IsRoot && topic ["uid" ].(int ) != me .Uid ) {
167
171
data ["can_view" ] = false
168
172
}
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ const (
25
25
PermissionLogin // 登录可见
26
26
PermissionFollow // 关注可见(暂未实现)
27
27
PermissionPay // 知识星球或其他方式付费可见
28
+ PermissionOnlyMe // 自己可见
28
29
)
29
30
30
31
// 社区主题信息
You can’t perform that action at this time.
0 commit comments