default_test.go 1.5 KB

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