order_test.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/vip/model"
  6. xtime "go-common/library/time"
  7. "time"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestDao_AddPayOrder(t *testing.T) {
  11. Convey("add pay order", t, func() {
  12. d.AddPayOrder(context.TODO(), &model.VipPayOrder{Mid: 123})
  13. })
  14. }
  15. func TestDao_UpdatePayOrderStatus(t *testing.T) {
  16. Convey("update order", t, func() {
  17. r := new(model.VipPayOrder)
  18. r.OrderType = 1
  19. r.PayType = 6
  20. r.Status = 2
  21. r.Ver = 2
  22. r.OrderNo = "1807021929153562939"
  23. r.Mtime = xtime.Time(time.Now().Unix())
  24. _, err := d.UpdatePayOrderStatus(context.TODO(), r)
  25. So(err, ShouldBeNil)
  26. })
  27. }
  28. func TestDao_SelPayOrderByMid(t *testing.T) {
  29. Convey("SelPayOrderByMid", t, func() {
  30. _, err := d.SelPayOrderByMid(context.TODO(), 7593623, 1, 1)
  31. So(err, ShouldBeNil)
  32. })
  33. }
  34. func TestDao_SSelOrderByOrderNo(t *testing.T) {
  35. Convey("SelOrderByOrderNo", t, func() {
  36. _, err := d.SelOrderByOrderNo(context.TODO(), "7593623")
  37. So(err, ShouldBeNil)
  38. })
  39. }
  40. func TestDao_SelPayOrderLog(t *testing.T) {
  41. Convey("SelPayOrderLog", t, func() {
  42. _, err := d.SelPayOrderLog(context.TODO(), 7593623, 1)
  43. So(err, ShouldBeNil)
  44. })
  45. }
  46. func TestDao_SelPayOrder(t *testing.T) {
  47. Convey("SelPayOrder", t, func() {
  48. _, err := d.SelPayOrder(context.TODO(), 1, 1)
  49. So(err, ShouldBeNil)
  50. })
  51. }
  52. func TestDao_SelOldPayOrder(t *testing.T) {
  53. Convey("SelOldPayOrder", t, func() {
  54. _, err := d.SelOldPayOrder(context.TODO(), 1, 1)
  55. So(err, ShouldBeNil)
  56. })
  57. }
  58. func TestDao_SelOldRechargeOrder(t *testing.T) {
  59. Convey("SelOldRechargeOrder", t, func() {
  60. _, err := d.SelOldRechargeOrder(context.TODO(), []string{"test"})
  61. So(err, ShouldBeNil)
  62. })
  63. }