作者 yangfu

Merge branch 'dev' into test

@@ -102,7 +102,6 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) { @@ -102,7 +102,6 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) {
102 //设置内容概要 102 //设置内容概要
103 103
104 // 截取内容 50个字 104 // 截取内容 50个字
105 - runeNumber := 0 //字数  
106 stringIndex := 0 //字符串长度 105 stringIndex := 0 //字符串长度
107 content := "" 106 content := ""
108 for i := range sectionList { 107 for i := range sectionList {
@@ -112,12 +111,9 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) { @@ -112,12 +111,9 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) {
112 break 111 break
113 } 112 }
114 } 113 }
115 - for i := range content {  
116 - if runeNumber > 50 {  
117 - break  
118 - }  
119 - runeNumber += 1  
120 - stringIndex = i 114 + stringIndex = len(content)
  115 + if len(content) > 50 {
  116 + stringIndex = 50
121 } 117 }
122 m.Summary = content[0:stringIndex] 118 m.Summary = content[0:stringIndex]
123 } 119 }