dao.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package order
  2. import (
  3. "go-common/app/interface/main/creative/conf"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. const (
  7. // --- from chaodian v2
  8. _executeOrders = "/api/open_api/v2/execute_orders"
  9. _ups = "/api/open_api/v2/ups"
  10. _getOrderByAid = "/api/open_api/v2/execute_orders/by_av_id"
  11. _archiveStatus = "/api/open_api/v2/execute_orders/video/status"
  12. _oasis = "/api/open_api/v2/ups/up_execute_order_statistics" //绿洲计划
  13. _launchtime = "/api/open_api/v2/execute_orders/launch_time"
  14. // ----
  15. _upValidate = "/meet/api/openApi/v1/up/validate"
  16. _accountState = "/allowance/api/x/admin/growup/up/account/state"
  17. )
  18. // Dao define
  19. type Dao struct {
  20. c *conf.Config
  21. // http
  22. client *bm.Client
  23. chaodian *bm.Client
  24. // uri
  25. executeOrdersURI string
  26. upsURI string
  27. getOrderByAidURI string
  28. archiveStatusURI string
  29. oasisURI string
  30. launchTimeURI string
  31. upValidateURI string
  32. accountStateURI string
  33. }
  34. // New init dao
  35. func New(c *conf.Config) (d *Dao) {
  36. d = &Dao{
  37. c: c,
  38. client: bm.NewClient(c.HTTPClient.UpMng),
  39. chaodian: bm.NewClient(c.HTTPClient.Chaodian),
  40. executeOrdersURI: c.Host.Chaodian + _executeOrders,
  41. upsURI: c.Host.Chaodian + _ups,
  42. getOrderByAidURI: c.Host.Chaodian + _getOrderByAid,
  43. archiveStatusURI: c.Host.Chaodian + _archiveStatus,
  44. oasisURI: c.Host.Chaodian + _oasis,
  45. launchTimeURI: c.Host.Chaodian + _launchtime,
  46. upValidateURI: c.Host.UpMng + _upValidate,
  47. accountStateURI: c.Host.Profit + _accountState,
  48. }
  49. return
  50. }