demo_test.go 742 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package test
  2. import (
  3. "fmt"
  4. "gfast/app/system/dao"
  5. _ "gfast/boot"
  6. "gfast/library"
  7. "github.com/gogf/gf/os/glog"
  8. "testing"
  9. )
  10. func TestDemo(t *testing.T) {
  11. //t.Run("testEncryptPassword", testEncryptPassword)
  12. //t.Run("testIpToAddr", testIpToAddr)
  13. //t.Run("testDb", testDb)
  14. t.Run("test2", test2)
  15. }
  16. //测试加密函数
  17. func testEncryptPassword(t *testing.T) {
  18. fmt.Println(library.EncryptPassword("yxh402063397", "OoFtPv"))
  19. }
  20. func testIpToAddr(t *testing.T) {
  21. fmt.Println(library.GetCityByIp("223.210.17.184"))
  22. }
  23. func testDb(t *testing.T) {
  24. d := dao.SysUser.Fields("id,user_name,user_nickname")
  25. d = d.Where("user_name", "admin")
  26. d = d.Or("user_name", "zs")
  27. data, _ := d.All()
  28. glog.Debug(data)
  29. }
  30. func test2(t *testing.T) {
  31. }