fix: don't record log if staff

This commit is contained in:
ericprd 2025-03-20 11:19:41 +08:00
parent d8f6968f64
commit 0c8133c802

View File

@ -34,12 +34,13 @@ func GetBySlug(
return return
} }
userDetail, _ := utils.GetTokenDetail(r)
if userDetail.Role != "staff" {
var specReq logsdomain.LogsSpec var specReq logsdomain.LogsSpec
specReq.ContentID = news.ID specReq.ContentID = news.ID
userDetail, _ := utils.GetTokenDetail(r)
if userDetail.ID != "" { if userDetail.ID != "" {
specReq.UserID = &userDetail.ID specReq.UserID = &userDetail.ID
} }
@ -69,6 +70,7 @@ func GetBySlug(
) )
return return
} }
}
response.RespondJsonSuccess(ctx, w, news) response.RespondJsonSuccess(ctx, w, news)
}) })