...
|
...
|
@@ -121,3 +121,27 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) { |
|
|
}
|
|
|
m.Summary = content[0:stringIndex]
|
|
|
}
|
|
|
|
|
|
func (m *Article) WhoCanRead(userId int64) bool {
|
|
|
if len(m.WhoRead) == 0 {
|
|
|
return true
|
|
|
}
|
|
|
for _, val := range m.WhoRead {
|
|
|
if userId == val {
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
func (m *Article) WhoCanReview(userId int64) bool {
|
|
|
if len(m.WhoReview) == 0 {
|
|
|
return true
|
|
|
}
|
|
|
for _, val := range m.WhoReview {
|
|
|
if userId == val {
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
|
return false
|
|
|
} |
...
|
...
|
|