model_test.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. "testing"
  5. "time"
  6. "github.com/stretchr/testify/assert"
  7. )
  8. func TestRestrictDate(t *testing.T) {
  9. xt1 := xtime.Time(-62169580800)
  10. t1 := xt1.Time()
  11. assert.True(t, t1.Year() < 0)
  12. xt2 := RestrictDate(xt1)
  13. t2 := xt2.Time()
  14. assert.Equal(t, 0, t2.Year())
  15. assert.Equal(t, t1.Month(), t2.Month())
  16. assert.Equal(t, t1.Day(), t2.Day())
  17. }
  18. func TestRealname(t *testing.T) {
  19. realnameIMG := RealnameApplyImgMessage{
  20. AddTimeStr: "2018-05-11 15:07:00",
  21. AddTimeDB: time.Now(),
  22. }
  23. t.Log("addtime", realnameIMG.AddTime().Local())
  24. realnameApply := RealnameApplyMessage{
  25. CardDataCanal: "dGMyNUhTcXN1NS9MYkF1bGdoKzNkTGs0eHI5UlM4SS9NY2VQa25xV3czU2grY1Q3R0JiSjlaQWhPZ294TTlEQVV0ZFhuYzIrUnlXTVN3NWk5THFWdkpmTEJaYXJhSlFHWUQ3bVlWZ3liNU1IS1hQTXZ0RE9pR1d6UnpYcUtRUEFYTHZCcXIzZVFoVURwT3VieXJzV0c1Z0dJS2dQNEdYbUV0T1B3MXV6bEE4PQ==",
  26. }
  27. t.Log("card data", realnameApply.CardData())
  28. var (
  29. card = "340702199110120012"
  30. )
  31. md5 := cardMD5(card, 0, 0)
  32. t.Log("card md5", md5)
  33. }