Преглед на файлове

more than 8 articles will be dropped

master
Patrick Peng Sun преди 8 години
родител
ревизия
3962f8adc6
променени са 1 файла, в които са добавени 7 реда и са изтрити 7 реда
  1. +7
    -7
      outMsg.go

+ 7
- 7
outMsg.go Целия файл

@@ -150,17 +150,17 @@ func musicMsgTemplate() string {
}

func buildNewsMsg(ToUserName, title, description string, articles []Article) (msg string) {
count := len(articles)
if count <= 0 {
log.Fatal("using empty article to build NewsMsg")
msg = ""
return
}

count := 0
items := []string{}
for _, a := range articles {
if count >= 8 {
err := errors.New("too many articles, only take first 8")
log.Fatal(err)
break
}
s := buildArticleItem(a)
items = append(items, s)
count++
}
strItems := strings.Join(items, "")


Loading…
Отказ
Запис