coupon.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. package model
  2. import (
  3. "encoding/json"
  4. xtime "go-common/library/time"
  5. )
  6. // coupon state.
  7. const (
  8. NotUsed = iota
  9. InUse
  10. Used
  11. Expire
  12. )
  13. // coupon type.
  14. const (
  15. BangumiVideo = iota + 1
  16. Cartoon
  17. )
  18. // call back status
  19. const (
  20. Unpaid = iota
  21. PaidSuccess
  22. )
  23. // coupon state.
  24. const (
  25. WaitPay = iota
  26. InPay
  27. PaySuccess
  28. PayFaild
  29. )
  30. // blance change type
  31. const (
  32. VipSalary int8 = iota + 1
  33. SystemAdminSalary
  34. Consume
  35. ConsumeFaildBack
  36. )
  37. //allowance origin
  38. const (
  39. AllowanceNone = iota
  40. AllowanceSystemAdmin
  41. AllowanceBusinessReceive
  42. AllowanceBusinessNewYear
  43. )
  44. // CouponInfo coupon info.
  45. type CouponInfo struct {
  46. ID int64 `json:"_"`
  47. CouponToken string `json:"coupon_token"`
  48. Mid int64 `json:"mid"`
  49. State int64 `json:"state"`
  50. StartTime int64 `json:"start_time"`
  51. ExpireTime int64 `json:"expire_time"`
  52. Origin int64 `json:"origin"`
  53. CouponType int64 `json:"coupon_type"`
  54. OrderNO string `json:"order_no"`
  55. Ver int64 `json:"ver"`
  56. Oid int64 `json:"oid"`
  57. Remark string `json:"remark"`
  58. UseVer int64 `json:"use_ver"`
  59. CTime xtime.Time `json:"-"`
  60. MTime xtime.Time `json:"-"`
  61. }
  62. // MsgCanal canal message struct.
  63. type MsgCanal struct {
  64. Action string `json:"action"`
  65. Table string `json:"table"`
  66. New json.RawMessage `json:"new"`
  67. Old json.RawMessage `json:"old"`
  68. }
  69. // CallBackRet .
  70. type CallBackRet struct {
  71. Ver int64 `json:"ver"`
  72. IsPaid int8 `json:"is_paid"`
  73. }
  74. // NotifyParam notify param.
  75. type NotifyParam struct {
  76. CouponToken string `json:"coupon_token"`
  77. Mid int64 `json:"mid"`
  78. NotifyURL string `json:"notify_url"`
  79. NotifyCount int `json:"count"`
  80. Type int64 `json:"type"`
  81. }
  82. // CouponChangeLog coupon change log.
  83. type CouponChangeLog struct {
  84. ID int64 `json:"-"`
  85. CouponToken string `json:"coupon_token"`
  86. Mid int64 `json:"mid"`
  87. State int8 `json:"state"`
  88. Ctime xtime.Time `json:"ctime"`
  89. Mtime xtime.Time `json:"mtime"`
  90. }
  91. // CouponOrder coupon order info.
  92. type CouponOrder struct {
  93. ID int64 `json:"id"`
  94. OrderNo string `json:"order_no"`
  95. Mid int64 `json:"mid"`
  96. Count int64 `json:"count"`
  97. State int8 `json:"state"`
  98. CouponType int8 `json:"coupon_type"`
  99. ThirdTradeNo string `json:"third_trade_no"`
  100. Remark string `json:"remark"`
  101. Tips string `json:"tips"`
  102. UseVer int64 `json:"use_ver"`
  103. Ver int64 `json:"ver"`
  104. Ctime xtime.Time `json:"-"`
  105. Mtime xtime.Time `json:"-"`
  106. }
  107. // CouponOrderLog coupon order log.
  108. type CouponOrderLog struct {
  109. ID int64 `json:"id"`
  110. OrderNo string `json:"order_no"`
  111. Mid int64 `json:"mid"`
  112. State int8 `json:"state"`
  113. Ctime xtime.Time `json:"ctime"`
  114. Mtime xtime.Time `json:"mtime"`
  115. }
  116. // CouponBalanceChangeLog coupon balance change log.
  117. type CouponBalanceChangeLog struct {
  118. ID int64 `json:"id"`
  119. OrderNo string `json:"order_no"`
  120. Mid int64 `json:"mid"`
  121. BatchToken string `json:"batch_token"`
  122. Balance int64 `json:"balance"`
  123. ChangeBalance int64 `json:"change_balance"`
  124. ChangeType int8 `json:"change_type"`
  125. Ctime xtime.Time `json:"ctime"`
  126. Mtime xtime.Time `json:"mtime"`
  127. }
  128. // CouponBalanceInfo def.
  129. type CouponBalanceInfo struct {
  130. ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"_"`
  131. BatchToken string `protobuf:"bytes,2,opt,name=BatchToken,proto3" json:"batch_token"`
  132. Mid int64 `protobuf:"varint,3,opt,name=Mid,proto3" json:"mid"`
  133. Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"balance"`
  134. StartTime int64 `protobuf:"varint,5,opt,name=StartTime,proto3" json:"start_time"`
  135. ExpireTime int64 `protobuf:"varint,6,opt,name=ExpireTime,proto3" json:"expire_time"`
  136. Origin int64 `protobuf:"varint,7,opt,name=Origin,proto3" json:"origin"`
  137. CouponType int64 `protobuf:"varint,8,opt,name=CouponType,proto3" json:"coupon_type"`
  138. Ver int64 `protobuf:"varint,9,opt,name=Ver,proto3" json:"ver"`
  139. CTime xtime.Time `protobuf:"varint,10,opt,name=CTime,proto3,casttype=go-common/library/time.Time" json:"-"`
  140. MTime xtime.Time `protobuf:"varint,11,opt,name=MTime,proto3,casttype=go-common/library/time.Time" json:"-"`
  141. }
  142. // CouponAllowanceInfo struct .
  143. type CouponAllowanceInfo struct {
  144. ID int64 `gorm:"column:id" json:"id" form:"id"`
  145. CouponToken string `gorm:"column:coupon_token" json:"coupon_token" form:"coupon_token"`
  146. MID int64 `gorm:"column:mid" json:"mid" form:"mid"`
  147. State int8 `gorm:"column:state" json:"state" form:"state"`
  148. StartTime int64 `gorm:"column:start_time" json:"start_time" form:"start_time"`
  149. ExpireTime int64 `gorm:"column:expire_time" json:"expire_time" form:"expire_time"`
  150. Origin int8 `gorm:"column:origin" json:"origin" form:"origin"`
  151. Ver int64 `gorm:"column:ver" json:"ver" form:"ver"`
  152. BatchToken string `gorm:"column:batch_token" json:"batch_token" form:"batch_token"`
  153. OrderNo string `gorm:"column:order_no" json:"order_no" form:"order_no"`
  154. Amount float64 `gorm:"column:amount" json:"amount" form:"amount"`
  155. FullAmount float64 `gorm:"column:full_amount" json:"full_amount" form:"full_amount"`
  156. Ctime xtime.Time `gorm:"column:ctime" json:"-" form:"ctime"`
  157. Mtime xtime.Time `gorm:"column:mtime" json:"-" form:"mtime"`
  158. Remark string `gorm:"column:remark" json:"remark" form:"remark"`
  159. AppID int64 `gorm:"column:app_id" json:"app_id" form:"app_id"`
  160. }