shop.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. package msg
  2. import (
  3. "encoding/json"
  4. "leafstalk/covenant/model"
  5. )
  6. // const (
  7. // PayMethodForbid = 0 // 禁止
  8. // PayMethodNormal = 1 // 正常
  9. // PayMethodClientService = 2 // 客服
  10. // )
  11. // const (
  12. // PhoneAndroid = 1 // 安卓
  13. // PhoneIos = 2 // 苹果
  14. // )
  15. // GetShops 获取商店商品
  16. type GetShops struct {
  17. PlayerId int64 `json:"userId"`
  18. ClientPlat string `json:"clientPlat"`
  19. PlayerLevel int64 `json:"-"`
  20. UnlockDiscountGoods map[int64]struct{} `json:"-"` // 解锁的特惠商店商品id
  21. OwnedExchangeGoods map[int64]struct{} `json:"-"` // 已经拥有的兑换商店商品id
  22. }
  23. type GetShopsData struct {
  24. StoreDiscount map[int64]int64 `json:"storeDiscount"` // 特惠商店商品信息 {礼包id:购买次数}
  25. StoreDaily *StoreDailyDetail `json:"storeDaily"` // 每日商店商品信息 {槽位id}
  26. StoreGold map[int64]int64 `json:"storeGold"` // 金币商店商品信息 {礼包id:购买次数}
  27. StoreDiamond map[int64]int64 `json:"storeDiamond"` // 钻石商店商品信息 {礼包id:购买次数}
  28. StoreExchange map[int64]*StoreExchangeDetail `json:"storeExchange"` // 兑换商店商品信息
  29. }
  30. type StoreExchangeDetail struct {
  31. BuyNum int64 `json:"buyNum"` // 购买次数
  32. Owned int64 `json:"owned"` // 0:未拥有 1:已拥有
  33. }
  34. type StoreDailyDetail struct {
  35. RefreshCountdown int64 `json:"refreshCountdown"` // 下次自动刷新倒计时
  36. RefreshFreeNum int64 `json:"refreshFreeNum"` // 免费刷新次数
  37. RefreshCoinNum int64 `json:"refreshCoinNum"` // 金币刷新次数
  38. RefreshAdNum int64 `json:"refreshAdNum"` // 广告刷新次数
  39. Goods map[int64]*model.DailyGood `json:"goods"` // 商品列表 {槽位id:{}}
  40. }
  41. type ResponseGetShops struct {
  42. ErrCode int `json:"errCode"`
  43. Msg string `json:"msg,omitempty"`
  44. Data *GetShopsData `json:"data"`
  45. }
  46. // RefreshStore 刷新商店
  47. const (
  48. RefreshStoreTypeFree = 1 // 1:免费刷新
  49. RefreshStoreTypeGold = 2 // 2:金币刷新
  50. RefreshStoreTypeAd = 3 // 3:广告刷新
  51. RefreshStoreTypeAuto = 4 // 4:自动刷新
  52. )
  53. type RefreshStore struct {
  54. PlayerId int64 `json:"userId"`
  55. Type int64 `json:"type"`
  56. PlayerLevel int64 `json:"-"`
  57. }
  58. type RefreshStoreData struct {
  59. Cost map[int64]int64 `json:"cost"` // 消耗
  60. ShopsData *GetShopsData `json:"shopsData"`
  61. }
  62. type ResponseRefreshStore struct {
  63. ErrCode int `json:"errCode"`
  64. Msg string `json:"msg,omitempty"`
  65. Data *RefreshStoreData `json:"data"`
  66. }
  67. // StoreBuyItem 商店内购买道具
  68. const (
  69. // 商店类型
  70. StoreTypeDiscount = 1 // 1:特惠商店
  71. StoreTypeDaily = 2 // 2:每日商店
  72. StoreTypeGold = 3 // 3:金币商店
  73. StoreTypeDiamond = 4 // 4:钻石商店
  74. StoreTypeExchange = 5 // 5:兑换商店
  75. )
  76. type StoreBuyItem struct {
  77. PlayerId int64 `json:"userId"`
  78. ClientPlat string `json:"clientPlat"`
  79. StoreType int64 `json:"storeType"` // 商店类型 1:特惠商店 2:每日商店 3:金币商店 4:钻石商店 5:兑换商店
  80. GoodsId int64 `json:"goodsId"` // 每日商店传槽位id,其余商店都是商品id
  81. BuyNum int64 `json:"buyNum"` // 购买次数
  82. UnlockDiscountGoods map[int64]struct{} `json:"-"` // 解锁的特惠商店商品id
  83. OwnedExchangeGoods map[int64]struct{} `json:"-"` // 已经拥有的兑换商店商品id
  84. PlayerLevel int64 `json:"-"`
  85. }
  86. func (d *StoreBuyItem) String() string {
  87. b, _ := json.Marshal(d)
  88. return string(b)
  89. }
  90. type StoreBuyItemData struct {
  91. Cost map[int64]int64 `json:"cost"` // 消耗
  92. Bundles *model.DropedBundle `json:"bundles"` // 得到
  93. ShopsData *GetShopsData `json:"shopsData"`
  94. }
  95. type ResponseStoreBuyItem struct {
  96. ErrCode int `json:"errCode"`
  97. Msg string `json:"msg,omitempty"`
  98. Data *StoreBuyItemData `json:"data"`
  99. }
  100. //type StoreSummary struct {
  101. // PlayerId int64 `json:"userId"`
  102. // ClientPlat string `json:"clientPlat"`
  103. //}
  104. //
  105. //type ResponseStoreSummary struct {
  106. // ErrCode int `json:"errCode"`
  107. // Msg string `json:"msg,omitempty"`
  108. // Data *StoreSummaryData `json:"data"`
  109. //}
  110. //
  111. //type StoreSummaryData struct {
  112. // Buys map[int64]int `json:"dailyBuys"` //已购商品
  113. // Refresh map[int64]*model.RefreshGoods `json:"refresh"` //商品ID列表
  114. //}
  115. // BuyItem gou
  116. type BuyItem struct {
  117. PlayerId int64 `json:"userId"`
  118. PayType int64 `json:"payType"`
  119. GoodsId int64 `json:"id"`
  120. Num int64 `json:"num"`
  121. ClientPlat string `json:"clientPlat"`
  122. }
  123. type ResponseBuyItem struct {
  124. ErrCode int `json:"errCode"`
  125. Msg string `json:"msg,omitempty"`
  126. Data int `json:"data"`
  127. }
  128. // PayMethod int `json:"payMethod"` //1:正常虚拟支付 2:微信游戏外支付 3:抖音游戏内苹果机支付
  129. // 创建订单
  130. type NewOrder struct {
  131. PlayerId int64 `json:"userId"`
  132. GoodsId int64 `json:"goodsId"`
  133. Phone int64 `json:"phone"` // 1: 安卓; 2: 苹果
  134. ClientPlat string `json:"clientPlat"`
  135. OpenId string `json:"openId"` //下面服务端用,客户端不用
  136. SessionKey string `json:"sessionKey"`
  137. Level int64 `json:"level"`
  138. GdtVid string `json:"gdtVid"`
  139. ADSrc string `json:"adsrc"`
  140. }
  141. type ResponseNewOrder struct {
  142. ErrCode int `json:"errCode"`
  143. Msg string `json:"msg,omitempty"`
  144. Data *NewOrderData `json:"data"`
  145. }
  146. type NewOrderData struct {
  147. OrderID string `json:"orderID"`
  148. PayMethod int `json:"payMethod"` //0: 禁止; 1: 正常; 2: 客服;
  149. SignData string `json:"signData"` //微信直购用
  150. Sign string `json:"sign"` //微信直购用
  151. UserSign string `json:"userSign"` //用户态签名 微信直购用
  152. // Url string `json:"callUrl"`
  153. }
  154. type MidasPayItem struct {
  155. Mode string `json:"mode"`
  156. OfferId string `json:"offerId"`
  157. BuyQuantity int `json:"buyQuantity"`
  158. Env int `json:"env"` // 0:正式 1:沙箱
  159. CurrencyType string `json:"currencyType"`
  160. ZoneId string `json:"zoneId"`
  161. ProductId string `json:"productId"`
  162. GoodsPrice int64 `json:"goodsPrice"`
  163. OutTradeNo string `json:"outTradeNo"`
  164. Attach string `json:"attach"`
  165. }
  166. // 检查商品购买限制
  167. type CheckGoodsBuyLimit struct {
  168. PlayerId int64 `json:"playerId"`
  169. GoodsId int64 `json:"goodsId"`
  170. OutTradeNo string `json:"outTradeNo"`
  171. PayMethod int `json:"payMethod"`
  172. Platform string `json:"platform"`
  173. UseType int64 `json:"useType"`
  174. }
  175. type ResponseCheckGoodsBuyLimit struct {
  176. *CheckGoodsBuyLimit
  177. Result int `json:"result"` // 0:通过 其他:未通过的原因
  178. }
  179. // 取消订单
  180. type CancleOrder struct {
  181. PlayerID int64 `json:"userId"`
  182. OrderID string `json:"orderID"`
  183. Reason int64 `json:"reason"`
  184. ClientPlat string `json:"clientPlat"`
  185. }
  186. type ResponseCancleOrder struct {
  187. ErrCode int `json:"errCode"`
  188. Data string `json:"data"`
  189. }
  190. // type QueryOrder struct {
  191. // PlayerId int64 `json:"userId"`
  192. // OrderId string `json:"orderID"`
  193. // Num int64 `json:"num"`
  194. // // MidasPay int `json:"midasPay"`
  195. // }
  196. // type ResponseQueryOrderResult struct {
  197. // ErrCode int `json:"errCode"`
  198. // Msg string `json:"msg,omitempty"`
  199. // Data PayWaitData `json:"data"`
  200. // }
  201. // type PayWaitData struct {
  202. // Num int64 `json:"num"`
  203. // Cd int64 `json:"cd"`
  204. // }
  205. // type ResponseQueryOrder struct {
  206. // ErrCode int `json:"errCode"`
  207. // Msg string `json:"msg,omitempty"`
  208. // Data int64 `json:"data"`
  209. // }
  210. // type ResponseQueryOrder struct {
  211. // ErrCode int `json:"errCode"`
  212. // //Data *PayBuyData `json:"data"`
  213. // }
  214. type AndroidPayedNotify struct {
  215. GoodsID int64 `json:"goodsId"`
  216. OrderID string `json:"orderID"`
  217. }
  218. // 支付购买
  219. type PayBuy struct {
  220. PlayerId int64 `json:"userId"`
  221. OutTradeNo string `json:"outTradeNo"`
  222. PayMethod int64 `json:"payMethod"` // 1: 游戏内支付; 2: 客服;
  223. Num int64 `json:"num"` //发送本消息次数
  224. ClientPlat string `json:"clientPlat"`
  225. }
  226. type ResponsePayBuy struct {
  227. ErrCode int `json:"errCode"`
  228. Msg string `json:"msg,omitempty"`
  229. Data *PayBuyData `json:"data"`
  230. }
  231. type PayBuyData struct {
  232. PayId int64 `json:"payId"` //计费点ID
  233. OutTradeNo string `json:"outTradeNo"`
  234. Type int64 `json:"type"` //1:等待 2:成功 3:取消
  235. Bundles *model.DropedBundle `json:"bundles,omitempty"`
  236. CD int64 `json:"cd,omitempty"`
  237. }
  238. // type ResponsePayBuyWait struct {
  239. // ErrCode int `json:"errCode"`
  240. // Msg string `json:"msg,omitempty"`
  241. // Data int64 `json:"data"`
  242. // }
  243. // type PayBuyData struct {
  244. // GoodsId int64 `json:"goodsId"`
  245. // Diamond int `json:"diamond"`
  246. // Materials []*model.DropMaterial `json:"materials"`
  247. // Equipments []*model.DropEquipment `json:"equipments"`
  248. // Buffs *VipBuffData `json:"buffs"`
  249. // }
  250. // ItemBuy 游戏内通过货币购买道具
  251. type ItemBuy struct {
  252. PlayerID int64 `json:"userId"`
  253. ItemID int64 `json:"itemId"` // 道具id
  254. Num int64 `json:"num"` // 购买数量
  255. }
  256. type ItemBuyData struct {
  257. Cost map[int64]int64 `json:"cost"` // 消耗
  258. Gets map[int64]int64 `json:"gets"` // 得到
  259. }
  260. type ResponseItemBuy struct {
  261. ErrCode int `json:"errCode"`
  262. Msg string `json:"msg,omitempty"`
  263. Data *ItemBuyData `json:"data"`
  264. }
  265. type ServerPayNotify struct {
  266. Plat string `json:"plat"` //
  267. OutOrderNo string `json:"outOrderNo"` // 游戏厂商下单传入的订单号
  268. OpenId string `json:"openId"` // 美团侧玩家角色号
  269. Price int64 `json:"price"` // 美团侧收到的游戏下单金额,单位:分.
  270. GoodsId string `json:"goodsId"` //购买的商品
  271. }
  272. // ios 支付 默认 关闭(0),5级
  273. type GmIosPay struct {
  274. MsgId string `json:"msgId"`
  275. IosPayOpenLevel int64 `json:"iosPay"`
  276. OperatorId int64 `json:"operatorId"`
  277. }
  278. type ResponseGmIosPay struct {
  279. ErrCode int `json:"errCode"`
  280. MsgId string `json:"msgId"`
  281. }