panel.go 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. package model
  2. import "go-common/library/time"
  3. // VipPriceConfigPlat vip价格面版平台 1. 其他平台 2.IOS平台 3.IOS的HD平台
  4. type VipPriceConfigPlat int64
  5. // VipPriceConfigStatus vip价格面版配置状态 0. 有效 1. 失效 2.待生效
  6. type VipPriceConfigStatus int8
  7. const (
  8. // VipPriceConfigStatusON 有效
  9. VipPriceConfigStatusON VipPriceConfigStatus = iota
  10. // VipPriceConfigStatusOFF 失效
  11. VipPriceConfigStatusOFF
  12. // VipPriceConfigStatusFuture 待生效
  13. VipPriceConfigStatusFuture
  14. )
  15. // vip_price_config suit_type
  16. const (
  17. AllUser int8 = iota
  18. OldVIP
  19. NewVIP
  20. OldSubVIP
  21. NewSubVIP
  22. OldPackVIP
  23. NewPackVIP
  24. )
  25. // const .
  26. const (
  27. DefualtZeroTimeFromDB = 0
  28. TimeFormatDay = "2006-01-02 15:04:05"
  29. DefulatTimeFromDB = "1970-01-01 08:00:00"
  30. )
  31. // VipPriceConfig struct .
  32. type VipPriceConfig struct {
  33. ID int64 `gorm:"column:id" json:"id"`
  34. Plat VipPriceConfigPlat `gorm:"column:platform" json:"platform"`
  35. PdName string `gorm:"column:product_name" json:"product_name"`
  36. PdID string `gorm:"column:product_id" json:"product_id"`
  37. SuitType int8 `gorm:"column:suit_type" json:"suit_type"`
  38. Month int16 `gorm:"column:month" json:"month"`
  39. SubType int8 `gorm:"column:suit_type" json:"sub_type"`
  40. OPrice float64 `gorm:"column:original_price" json:"original_price"`
  41. NPrice float64 `json:"now_price"`
  42. Selected int8 `gorm:"column:selected" json:"selected"`
  43. Remark string `gorm:"column:remark" json:"remark"`
  44. Status VipPriceConfigStatus `gorm:"column:status" json:"status"`
  45. Operator string `gorm:"column:operator" json:"operator"`
  46. OpID int64 `gorm:"column:oper_id" json:"oper_id"`
  47. Superscript string `gorm:"column:superscript" json:"superscript"`
  48. CTime time.Time `gorm:"column:ctime" json:"ctime"`
  49. MTime time.Time `gorm:"column:mtime" json:"mtime"`
  50. StartBuild int64 `json:"start_build"`
  51. EndBuild int64 `json:"end_build"`
  52. }
  53. // VipPriceConfigV2 struct .
  54. type VipPriceConfigV2 struct {
  55. ID int64 `gorm:"column:id" json:"id" form:"id"`
  56. Platform int64 `gorm:"column:platform" json:"platform" form:"platform"`
  57. ProductName string `gorm:"column:product_name" json:"product_name" form:"product_name"`
  58. ProductID string `gorm:"column:product_id" json:"product_id" form:"product_id"`
  59. SuitType int64 `gorm:"column:suit_type" json:"suit_type" form:"suit_type"`
  60. Month int64 `gorm:"column:month" json:"month" form:"month"`
  61. SubType int64 `gorm:"column:sub_type" json:"sub_type" form:"sub_type"`
  62. OriginalPrice float64 `gorm:"column:original_price" json:"original_price" form:"original_price"`
  63. Selected int8 `gorm:"column:selected" json:"selected" form:"selected"`
  64. Remark string `gorm:"column:remark" json:"remark" form:"remark"`
  65. Status int8 `gorm:"column:status" json:"status" form:"status"`
  66. Operator string `gorm:"column:operator" json:"operator" form:"operator"`
  67. OperID int64 `gorm:"column:oper_id" json:"oper_id" form:"oper_id"`
  68. Ctime time.Time `gorm:"column:ctime" json:"ctime" form:"ctime"`
  69. Mtime time.Time `gorm:"column:mtime" json:"mtime" form:"mtime"`
  70. Superscript string `gorm:"column:superscript" json:"superscript" form:"superscript"`
  71. StartBuild int64 `json:"start_build"`
  72. EndBuild int64 `json:"end_build"`
  73. }
  74. // VipDPriceConfig price discount config.
  75. type VipDPriceConfig struct {
  76. DisID int64 `json:"discount_id"`
  77. ID int64 `json:"vpc_id"`
  78. PdID string `json:"product_id"`
  79. DPrice float64 `json:"discount_price"`
  80. STime time.Time `json:"stime"`
  81. ETime time.Time `json:"etime"`
  82. Remark string `json:"remark"`
  83. Operator string `json:"operator"`
  84. OpID int64 `json:"oper_id"`
  85. CTime time.Time `json:"ctime"`
  86. MTime time.Time `json:"mtime"`
  87. FirstPrice float64 `json:"first_price"`
  88. }
  89. // VipPriceDiscountConfigV2 table vip_price_discount_config_v2 struct .
  90. type VipPriceDiscountConfigV2 struct {
  91. ID int64 `gorm:"column:id" json:"id" form:"id"`
  92. VpcID int64 `gorm:"column:vpc_id" json:"vpc_id" form:"vpc_id"`
  93. ProductID string `gorm:"column:product_id" json:"product_id" form:"product_id"`
  94. DiscountPrice float64 `gorm:"column:discount_price" json:"discount_price" form:"discount_price"`
  95. Stime time.Time `gorm:"column:stime" json:"stime" form:"stime"`
  96. Etime time.Time `gorm:"column:etime" json:"etime" form:"etime"`
  97. Remark string `gorm:"column:remark" json:"remark" form:"remark"`
  98. Operator string `gorm:"column:operator" json:"operator" form:"operator"`
  99. OperID int64 `gorm:"column:oper_id" json:"oper_id" form:"oper_id"`
  100. Ctime time.Time `gorm:"column:ctime" json:"ctime" form:"ctime"`
  101. Mtime time.Time `gorm:"column:mtime" json:"mtime" form:"mtime"`
  102. }
  103. // ArgAddOrUpVipPrice .
  104. type ArgAddOrUpVipPrice struct {
  105. ID int64 `form:"id"`
  106. Plat VipPriceConfigPlat `form:"platform" validate:"required"`
  107. PdName string `form:"product_name" validate:"required"`
  108. PdID string `form:"product_id" validate:"required"`
  109. Month int16 `form:"month" validate:"required"`
  110. SubType int8 `form:"sub_type"`
  111. SuitType int8 `form:"suit_type"`
  112. OPrice float64 `form:"original_price" validate:"required"`
  113. Remark string `form:"remark"`
  114. Operator string `form:"operator" validate:"required"`
  115. OpID int64 `form:"oper_id" validate:"required"`
  116. Selected int8 `form:"selected"`
  117. Superscript string `form:"superscript"`
  118. StartBuild int64 `form:"start_build"`
  119. EndBuild int64 `form:"end_build"`
  120. }
  121. // ArgAddOrUpVipDPrice .
  122. type ArgAddOrUpVipDPrice struct {
  123. DisID int64 `form:"discount_id"`
  124. ID int64 `form:"vpc_id" validate:"required"`
  125. PdID string `form:"product_id" validate:"required"`
  126. DPrice float64 `form:"discount_price"`
  127. STime time.Time `form:"stime" validate:"required"`
  128. ETime time.Time `form:"etime"`
  129. Remark string `form:"remark"`
  130. Operator string `form:"operator" validate:"required"`
  131. OpID int64 `form:"oper_id" validate:"required"`
  132. FirstPrice float64 `form:"first_price"`
  133. }
  134. // CheckProductID .
  135. // func (vpc *VipPriceConfig) CheckProductID(arg *ArgAddOrUpVipDPrice) bool {
  136. // return (vpc.Plat == PlatVipPriceConfigIOS || vpc.Plat == PlatVipPriceConfigIOSHD || vpc.Plat == PlatVipPriceConfigIphoneB) && arg.PdID == ""
  137. // }
  138. // ExistPlat .
  139. // func (aavp *ArgAddOrUpVipPrice) ExistPlat() bool {
  140. // return aavp.Plat == PlatVipPriceConfigOther ||
  141. // aavp.Plat == PlatVipPriceConfigIOS ||
  142. // aavp.Plat == PlatVipPriceConfigIOSHD ||
  143. // aavp.Plat == PlatVipPriceConfigFriendsGift ||
  144. // aavp.Plat == PlatVipPriceConfigInternational ||
  145. // aavp.Plat == PlatVipPriceConfigIphoneB ||
  146. // aavp.Plat == PlatVipPriceConfigCheck
  147. // }
  148. // ArgVipPriceID .
  149. type ArgVipPriceID struct {
  150. ID int64 `form:"id" validate:"required"`
  151. }
  152. // ArgVipDPriceID .
  153. type ArgVipDPriceID struct {
  154. DisID int64 `form:"discount_id" validate:"required"`
  155. }
  156. // ArgVipPrice .
  157. type ArgVipPrice struct {
  158. Plat VipPriceConfigPlat `form:"platform" default:"-1"`
  159. Month int16 `form:"month" default:"-1"`
  160. SubType int8 `form:"sub_type" default:"-1"`
  161. SuitType int8 `form:"suit_type" default:"-1"`
  162. }