exchange.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package exchange
  2. import (
  3. "bet24.com/servers/coreservice/client"
  4. item "bet24.com/servers/micros/item_inventory/proto"
  5. )
  6. const (
  7. _ = iota // 0=无效
  8. EXCHANGE_TYPE_FUKA // 1=奖券
  9. EXCHANGE_TYPE_TEACHER_CHIP // 2=代理收益兑元宝
  10. EXCHANGE_TYPE_TEACHER_TEL // 3=代理收益兑话费
  11. EXCHANGE_TYPE_TEACHER_CASH // 4=代理收益兑RP
  12. EXCHANGE_TYPE_GOLD // 5=金币提现
  13. EXCHANGE_TYPE_CASH // 6=现金卡提现
  14. )
  15. var em *exchangemgr
  16. func Run() {
  17. em = newExchangeManager()
  18. }
  19. type ExchangeInfo struct {
  20. Id int
  21. ExchangeType int // 兑换类型(1=奖券兑换金币 2=代理兑换元宝 3=代理兑换电话卡 4=代理兑换RP 5=金币提现)
  22. LeftCount int // 剩余数量,如果小于0,则表示缺货
  23. LimitOnce bool // 是否限制购买一次
  24. VipNeed int // 所需VIP等级
  25. VipShow int `json:"-"` // 显示所需vip
  26. GameCountShow int `json:"-"` // 显示所需游戏局数
  27. Price int // 价格
  28. Memo string // 描述
  29. Items []item.ItemPack
  30. }
  31. type ExchangeType struct {
  32. Id int
  33. ExchangeType int // 兑换类型(1=奖券兑换金币 2=代理兑换元宝 3=代理兑换电话卡 4=代理兑换RP 5=金币提现)
  34. Price int // 价格
  35. Memo string // 描述
  36. }
  37. func GetExchangeType() []ExchangeType {
  38. return em.getExchangeType()
  39. }
  40. func GetExchangeList(userId int) []ExchangeInfo {
  41. return em.getExchangeList(userId)
  42. }
  43. func GetExchangeHistory(userId, pageIndex, pageSize int) (int, []client.ExchangeHistory) {
  44. return em.getExchangeHistory(userId, pageIndex, pageSize)
  45. }
  46. func UserExchange(userId, exchangeId, num int, remark string) (int, string) {
  47. return em.userExchange(userId, exchangeId, num, remark)
  48. }