shout.go 695 B

123456789101112131415161718192021222324
  1. package controller
  2. import (
  3. "fmt"
  4. "github.com/wenstudio/gofly/models"
  5. "github.com/wenstudio/gofly/tools"
  6. "log"
  7. "strconv"
  8. )
  9. func SendServerJiang(content string) string {
  10. noticeServerJiang, err := strconv.ParseBool(models.FindConfig("NoticeServerJiang"))
  11. serverJiangAPI := models.FindConfig("ServerJiangAPI")
  12. if err != nil || !noticeServerJiang || serverJiangAPI == "" {
  13. log.Println("do not notice serverjiang:", serverJiangAPI, noticeServerJiang)
  14. return ""
  15. }
  16. sendStr := fmt.Sprintf("%s,访客来了", content)
  17. desp := "[登录](https://gofly.sopans.com/main)"
  18. url := serverJiangAPI + "?text=" + sendStr + "&desp=" + desp
  19. //log.Println(url)
  20. res := tools.Get(url)
  21. return res
  22. }