feat(wxwork): refactor truncateRunes function to be a method of wxWorkNotifyService
This commit is contained in:
@@ -117,11 +117,11 @@ func (s *wxWorkNotifyService) buildTextContent(title, body string) string {
|
|||||||
case title == "" && body == "":
|
case title == "" && body == "":
|
||||||
return ""
|
return ""
|
||||||
case title == "":
|
case title == "":
|
||||||
return truncateRunes(body, 1024)
|
return s.truncateRunes(body, 1024)
|
||||||
case body == "":
|
case body == "":
|
||||||
return truncateRunes(title, 1024)
|
return s.truncateRunes(title, 1024)
|
||||||
default:
|
default:
|
||||||
return truncateRunes(title+"\n\n"+body, 1024)
|
return s.truncateRunes(title+"\n\n"+body, 1024)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ func (s *wxWorkNotifyService) normalizeDuplicateCheckInterval(value int) int {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
func truncateRunes(value string, max int) string {
|
func (s *wxWorkNotifyService) truncateRunes(value string, max int) string {
|
||||||
if max <= 0 {
|
if max <= 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user