pendant.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package model
  2. import xtime "go-common/library/time"
  3. // const .
  4. const (
  5. // pendant type
  6. PendantCoinPrice = int8(0)
  7. PendantBCoinPrice = int8(1)
  8. PendantIntegralPrice = int8(2)
  9. // order plat
  10. PendantOrderPlatDefault = int8(-1)
  11. PendantOrderPlatPCAndH5 = int8(0)
  12. PendantOrderPlatPhone = int8(1)
  13. // pkg status
  14. PendantPKGInvalid = int8(0)
  15. PendantPKGValid = int8(1)
  16. PendantPKGOnEquip = int8(2)
  17. // pendant add style
  18. PendantAddStyleDay = int8(1)
  19. PendantAddStyleDate = int8(2)
  20. // sourceType
  21. PendantSourceTypeAdmin = int8(1)
  22. PendantSourceTypePGC = int8(2)
  23. )
  24. // var .
  25. var (
  26. PriceTypes = []int8{PendantCoinPrice, PendantBCoinPrice, PendantIntegralPrice}
  27. )
  28. // PendantGroup .
  29. type PendantGroup struct {
  30. ID int64 `json:"id"`
  31. Name string `json:"name"`
  32. Rank int16 `json:"rank"`
  33. Status int8 `json:"status"`
  34. }
  35. // PendantPrice .
  36. type PendantPrice struct {
  37. PID int64 `json:"pid"`
  38. TP int8 `json:"type"`
  39. Price int `json:"price"`
  40. }
  41. // PendantInfo .
  42. type PendantInfo struct {
  43. ID int64 `json:"id"`
  44. Name string `json:"name"`
  45. Image string `json:"image"`
  46. ImageModel string `json:"image_model"`
  47. Status int8 `json:"status"`
  48. Rank int16 `json:"rank"`
  49. GID int64 `json:"gid"`
  50. GroupName string `json:"group_name"`
  51. GroupRank int16 `json:"group_rank"`
  52. Prices []*PendantPrice `json:"prices"`
  53. }
  54. // PendantGroupRef .
  55. type PendantGroupRef struct {
  56. GID int64 `json:"gid"`
  57. PID int64 `json:"pid"`
  58. }
  59. // PendantOrder .
  60. type PendantOrder struct {
  61. BuyTime int64 `json:"buy_time"`
  62. OrderID string `json:"order_id"`
  63. PayID string `json:"pay_id"`
  64. UID int64 `json:"uid"`
  65. PID int64 `json:"-"`
  66. PName string `json:"pendant_name"`
  67. TimeLength int64 `json:"time_length"`
  68. Cost string `json:"cost"`
  69. PayType int8 `json:"pay_type"`
  70. Status int8 `json:"status"`
  71. AppID int8 `json:"appid"`
  72. Platform string `json:"platform"`
  73. }
  74. // CoverToPlatform .
  75. func (p *PendantOrder) CoverToPlatform() {
  76. switch p.AppID {
  77. case PendantOrderPlatDefault:
  78. p.Platform = "默认"
  79. case PendantOrderPlatPCAndH5:
  80. p.Platform = "PC/H5"
  81. case PendantOrderPlatPhone:
  82. p.Platform = "手机客户端"
  83. }
  84. }
  85. // PendantPKG .
  86. type PendantPKG struct {
  87. ID int64 `json:"id"`
  88. UID int64 `json:"uid"`
  89. PID int64 `json:"pid"`
  90. Expires int64 `json:"expires"`
  91. TP int8 `json:"type"`
  92. Status int8 `json:"status"`
  93. IsVip int8 `json:"is_vip"`
  94. }
  95. // PendantOperLog .
  96. type PendantOperLog struct {
  97. OID int64 `json:"oper_id"`
  98. Action string `json:"action"`
  99. CTime xtime.Time `json:"ctime"`
  100. MTime xtime.Time `json:"mtime"`
  101. OperName string `json:"oper_name"`
  102. UID int64 `json:"uid"`
  103. PID int64 `json:"pid"`
  104. SourceType int8 `json:"source_type"`
  105. }
  106. // BulidPendantPrice .
  107. func (pp *PendantPrice) BulidPendantPrice(arg *ArgPendantInfo, tp int8) {
  108. switch tp {
  109. case PendantCoinPrice:
  110. pp.Price = arg.CoinPrice
  111. case PendantBCoinPrice:
  112. pp.Price = arg.BcoinPrice
  113. case PendantIntegralPrice:
  114. pp.Price = arg.IntegralPrice
  115. }
  116. pp.TP = tp
  117. pp.PID = arg.PID
  118. }