storm_test.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package dao
  2. import (
  3. "fmt"
  4. "testing"
  5. "time"
  6. "go-common/app/service/live/xlottery/model"
  7. xsql "go-common/library/database/sql"
  8. xtime "go-common/library/time"
  9. )
  10. var db *xsql.DB
  11. func init() {
  12. c := &xsql.Config{
  13. Addr: "172.16.38.117:3312",
  14. DSN: "live:oWni@ElNs0P0C(dphdj*F1y4@tcp(172.16.38.117:3312)/live-app?timeout=2000ms&readTimeout=2000ms&writeTimeout=2000ms&parseTime=true&loc=Local&charset=utf8,utf8mb4",
  15. Active: 10,
  16. Idle: 5,
  17. IdleTimeout: xtime.Duration(time.Minute),
  18. QueryTimeout: xtime.Duration(time.Minute),
  19. ExecTimeout: xtime.Duration(time.Minute),
  20. TranTimeout: xtime.Duration(time.Minute),
  21. }
  22. db = xsql.NewMySQL(c)
  23. }
  24. func TestDao_InsertSpecialGift(t *testing.T) {
  25. d := &Dao{
  26. db: db,
  27. }
  28. got, err := d.InsertSpecialGift(&model.SpecialGift{
  29. UID: 333,
  30. RoomID: 33,
  31. GiftID: 33,
  32. GiftNum: 1,
  33. CreateTime: time.Now(),
  34. CustomField: "{\"content\":\"真是无法无天了。\" }",
  35. })
  36. fmt.Println(got, err)
  37. }
  38. func TestDao_FindBeatByBeatIDAndUID(t *testing.T) {
  39. d := &Dao{
  40. db: db,
  41. }
  42. got, err := d.FindBeatByBeatIDAndUID(123, 10666892)
  43. fmt.Println(got, err)
  44. }
  45. func TestDao_FindShieldKeyWorkByUID(t *testing.T) {
  46. d := &Dao{
  47. db: db,
  48. }
  49. got, err := d.FindShieldKeyWorkByUID(12209)
  50. fmt.Println(got, err)
  51. }