package third_party import ( "bytes" "fmt" "text/template" "time" ) func TextContentParse(content string, nickname string) string { t, _ := template.New("text").Parse(content) buf := new(bytes.Buffer) err := t.Execute(buf, map[string]interface{}{ "DateTime": time.Now().Format("1月2日"), "Nickname": nickname, }) if err != nil { fmt.Printf("格式转换出错了,content:%s,err:%s", content, err) return content } return string(buf.Bytes()) }