golang 的 rabbitmq 消费项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

167 regels
3.3 KiB

  1. package enum
  2. // MallGoodsType 商品类型
  3. type MallGoodsType int
  4. const MallGoodsReal MallGoodsType = 1
  5. func (em MallGoodsType) String() struct {
  6. Name string
  7. Desc string
  8. } {
  9. switch em {
  10. case MallGoodsReal:
  11. return struct {
  12. Name string
  13. Desc string
  14. }{Name: "实物商品", Desc: "物流发货"}
  15. default:
  16. return struct {
  17. Name string
  18. Desc string
  19. }{Name: "未知类型", Desc: ""}
  20. }
  21. }
  22. // MallVipDiscountType 商品VIP折扣类型
  23. type MallVipDiscountType int
  24. const (
  25. MallDiscountTypeDiscount MallVipDiscountType = iota + 1
  26. MallDiscountTypeMinus
  27. MallDiscountTypeSpecify
  28. )
  29. func (em MallVipDiscountType) String() string {
  30. switch em {
  31. case MallDiscountTypeDiscount:
  32. return "打折"
  33. case MallDiscountTypeMinus:
  34. return "减价"
  35. case MallDiscountTypeSpecify:
  36. return "指定价格"
  37. default:
  38. return "未知类型"
  39. }
  40. }
  41. // MallShippingType 配送方式
  42. type MallShippingType int
  43. const MallShippingTypeExpress = 1
  44. func (em MallShippingType) String() string {
  45. switch em {
  46. case MallShippingTypeExpress:
  47. return "快递"
  48. default:
  49. return "未知类型"
  50. }
  51. }
  52. type MallShippingFeeType int
  53. const (
  54. MallShippingFeeTypeUnify MallShippingFeeType = iota + 1
  55. MallShippingFeeTypeTpl
  56. )
  57. func (em MallShippingFeeType) String() string {
  58. switch em {
  59. case MallShippingFeeTypeUnify:
  60. return "统一运费"
  61. case MallShippingFeeTypeTpl:
  62. return "运费模板"
  63. default:
  64. return "未知类型"
  65. }
  66. }
  67. type ShippingTemplateCalculateType int
  68. const (
  69. ShippingTemplateCalculateWeight ShippingTemplateCalculateType = iota + 1 // 重量计算
  70. ShippingTemplateCalculatePiece // 件计算
  71. )
  72. func (st ShippingTemplateCalculateType) String() string {
  73. switch st {
  74. case ShippingTemplateCalculatePiece:
  75. return "按件计算"
  76. case ShippingTemplateCalculateWeight:
  77. return "按重量计算"
  78. default:
  79. return "unkonwn"
  80. }
  81. }
  82. // MallGoodsSaleState 商品上架状态
  83. type MallGoodsSaleState int
  84. const (
  85. MallGoodsSaleStateOnShelf MallGoodsSaleState = iota + 1
  86. MallGoodsSaleStateTiming
  87. MallGoodsSaleStateOffShelf
  88. )
  89. func (em MallGoodsSaleState) String() string {
  90. switch em {
  91. case MallGoodsSaleStateOnShelf:
  92. return "立即开售"
  93. case MallGoodsSaleStateTiming:
  94. return "定时开售"
  95. case MallGoodsSaleStateOffShelf:
  96. return "放入仓库"
  97. default:
  98. return "未知类型"
  99. }
  100. }
  101. type MallGoodsActivityType int
  102. const (
  103. MallGoodsActivityGroup MallGoodsActivityType = iota + 1
  104. MallGoodsActivitySecKill
  105. MallGoodsActivityBargain
  106. MallGoodsActivitySuperGroup
  107. MallGoodsActivityUpdateLv
  108. )
  109. func (em MallGoodsActivityType) String() string {
  110. switch em {
  111. case MallGoodsActivityGroup:
  112. return "拼团活动"
  113. case MallGoodsActivitySecKill:
  114. return "秒杀活动"
  115. case MallGoodsActivityBargain:
  116. return "砍价活动"
  117. case MallGoodsActivitySuperGroup:
  118. return "超级拼团"
  119. case MallGoodsActivityUpdateLv:
  120. return "升级礼包"
  121. default:
  122. return "未参加活动"
  123. }
  124. }
  125. type MallGoodsServiceType int
  126. const (
  127. MallGoodsServiceShippingByManufacturer MallGoodsServiceType = iota + 1
  128. MallGoodsServiceSevenDayReturn
  129. MallGoodsServiceOfficialReal
  130. )
  131. func (em MallGoodsServiceType) String() string {
  132. switch em {
  133. case MallGoodsServiceShippingByManufacturer:
  134. return "厂家配送"
  135. case MallGoodsServiceSevenDayReturn:
  136. return "七天无理由退换"
  137. case MallGoodsServiceOfficialReal:
  138. return "官方保真"
  139. default:
  140. return "其他服务"
  141. }
  142. }