default_test.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package test
  2. import (
  3. "ColdVerify_server/lib"
  4. "ColdVerify_server/logs"
  5. "fmt"
  6. "testing"
  7. "time"
  8. )
  9. func TestBeego(t *testing.T) {
  10. formatTimeStr := "2022-05-25 18:58"
  11. formatTime, err := time.Parse("2006-01-02 15:04", formatTimeStr)
  12. if err != nil {
  13. logs.Error(lib.FuncName(), err)
  14. }
  15. fmt.Println(formatTime) //打印结果:2017-04-11 13:33:37 +0000 UTC
  16. //// Read from docx file
  17. //r, err := docx.ReadDocxFile("./template.docx")
  18. //// Or read from memory
  19. //// r, err := docx.ReadDocxFromMemory(data io.ReaderAt, size int64)
  20. //
  21. //// Or read from a filesystem object:
  22. //// r, err := docx.ReadDocxFromFS(file string, fs fs.FS)
  23. //
  24. //if err != nil {
  25. // panic(err)
  26. //}
  27. //docx1 := r.Editable()
  28. //// Replace like https://golang.org/pkg/strings/#Replace
  29. //docx1.Replace("old_1_1", "new_1_1", -1)
  30. //docx1.Replace("old_1_2", "new_1_2", -1)
  31. ////docx1.ReplaceLink("http://example.com/", "https://github.com/nguyenthenguyen/docx", 1)
  32. ////docx1.ReplaceHeader("out with the old", "in with the new")
  33. ////docx1.ReplaceFooter("Change This Footer", "new footer")
  34. //docx1.WriteToFile("./new_result_1.docx")
  35. //
  36. //docx2 := r.Editable()
  37. //docx2.Replace("old_2_1", "new_2_1", -1)
  38. //docx2.Replace("old_2_2", "new_2_2", -1)
  39. //docx2.WriteToFile("./new_result_2.docx")
  40. //// Or write to ioWriter
  41. //// docx2.Write(ioWriter io.Writer)
  42. //docx3 := r.Editable()
  43. ////Currently only swaps apples for apples i.e. png to png, and not png to jpeg etc.
  44. ////d.ReplaceImage("word/media/image1.png", "./new.png")
  45. //docx3.WriteToFile("./new_result_3.docx")
  46. }