互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package test
  2. import (
  3. "fmt"
  4. "github.com/chanxuehong/wechat/mch/core"
  5. pay_service "hudongzhuanjia/services/pay"
  6. "testing"
  7. "time"
  8. )
  9. var openId = "o9XM41s_NN8Y0QK6_MbM-aYMV3TE"
  10. func TestTransfer(t *testing.T) {
  11. res, err := pay_service.Transfer("欧轩互动-转账测试", "127.0.0.1", openId, 0.30*10)
  12. fmt.Println(err)
  13. fmt.Printf("%+v\n", res)
  14. }
  15. func TestSendRedPack(t *testing.T) {
  16. res, err := pay_service.SendRedPack("欧轩互动-红包测试", openId, "你好测试", "192.168.1.103", "tommy",
  17. "哈哈哈哈哈", 1, 1, 1)
  18. fmt.Println(err)
  19. fmt.Printf("%+v\n", res)
  20. }
  21. func TestQueryOrder(t *testing.T) {
  22. //outTradeNo := "Dn13Gl6A6dB6aOae7syqtXSwUvCZ3mta"
  23. outTradeNo := "jGrqipGJdcxQz4uwSTQqrtnJ4rJE6Mx9"
  24. res, err := pay_service.OrderQuery(outTradeNo)
  25. fmt.Println(err)
  26. fmt.Printf("%+v\n", res)
  27. }
  28. func TestClose(t *testing.T) {
  29. pay_service.Close("jGrqipGJdcxQz4uwSTQqrtnJ4rJE6Mx9")
  30. }
  31. func TestTimeExpire(t *testing.T) {
  32. now := time.Now()
  33. t1 := "202004174430"
  34. t2 := core.FormatTime(time.Now())
  35. t3, _ := core.ParseTime(t1)
  36. fmt.Println(t1, t2)
  37. fmt.Println(t1 > t2)
  38. fmt.Println(t3.Unix() > now.Unix())
  39. fmt.Println(t1, t2, core.FormatTime(t3))
  40. fmt.Println(t3.Unix(), now.Unix())
  41. }