protocol.go 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723
  1. package protocol
  2. import (
  3. item "bet24.com/servers/micros/item_inventory/proto"
  4. )
  5. /*
  6. getShopList
  7. 上行 : ShopItem_req
  8. 下行 : []*Shop_Item
  9. ShopType_Gold // 0 = 金币
  10. ShopType_Diamond // 1 = 钻石
  11. ShopType_Cannon // 2 = 炮台
  12. ShopType_Gift // 3 = 礼包
  13. ShopType_Max
  14. type Shop_Item struct {
  15. ProductID string
  16. ProductName string
  17. Amount int
  18. Price int // 单位为钻石数量或者人民币分
  19. IsHot int
  20. Bonus int // 多送百分比
  21. Extra string // 扩展信息
  22. }
  23. */
  24. type GetShopList_req struct {
  25. ShopType int
  26. ProductId string // 具体的productId,如果不传,则取列表
  27. }
  28. /*
  29. shopExchange
  30. */
  31. type ShopExchange_req struct {
  32. ProductId string
  33. }
  34. type InventoryCosume_req struct {
  35. ItemId int
  36. Count int
  37. }
  38. type InventoryGift_req struct {
  39. ToUserId int
  40. ItemId int
  41. Count int
  42. }
  43. type InventoryCosume_resp struct {
  44. ItemId int
  45. Succeeded bool
  46. ErrMsg string
  47. }
  48. /*
  49. 签到
  50. getSigninInfo
  51. 无上行,获取签到列表
  52. type Signin struct {
  53. Id int
  54. Award item.ItemPack
  55. DoubleVipLevel int // vip?加倍,0表示没有
  56. SignTime int // 签到时间,0表示未签
  57. }
  58. type ContinueAward struct {
  59. Day int // 连续多少天
  60. Award []item.ItemPack
  61. Completed bool // 是否已领取
  62. }
  63. type SigninInfo struct {
  64. SigninTable []*Signin
  65. Continue []*ContinueAward
  66. Signable bool // 当前是否可签到
  67. }`
  68. -----------------------------------------
  69. doSignin
  70. 无上行
  71. 下行: []item.ItemPack
  72. 签到成功后,返回签到奖励列表,如果没有,表示签到失败
  73. */
  74. /*
  75. 任务
  76. const (
  77. TaskStatus_active = iota // 任务进行中 0
  78. TaskStatus_complete // 完成
  79. TaskStatus_awarded // 已领取奖励
  80. TaskStatus_inactive // 未开始
  81. TaskStatus_expired // 已过期
  82. )
  83. type Task struct {
  84. Id int
  85. Title string
  86. Desc string
  87. Action int
  88. Target int
  89. Repeatable bool // 是否可重复
  90. Duration int // 任务有效期
  91. PreTask int // 如果不为0,则需要完成前置任务才创建,否则自动创建
  92. Limited_time Task_Period // 如果是限时开放的任务,则在这里添加时效
  93. Awards []item.ItemPack
  94. }
  95. type UserTask struct {
  96. TaskId int
  97. Scheduled int // 完成进度
  98. Status int
  99. Task_Period // 任务对玩家的时效,时效内已完成,如果没有后置任务,则不重置,等时效结束后再创建
  100. }
  101. type Task_Period struct {
  102. Start int // 开始时间戳 秒 0表示无时效
  103. Duration int // 持续时间 秒
  104. }
  105. getSysTask 获取系统任务信息
  106. 上行 : {TaskId:taskId}
  107. 下行 : Task
  108. getSysTaskList 获取所有系统任务
  109. 无上行
  110. 下行 : []Task
  111. getUserTaskList 获取我当前任务
  112. 无上行
  113. 下行 : []UserTask
  114. awardTask 领取奖励
  115. 上行 : {TaskId:taskId}
  116. 下行 : {Success bool,ErrMsg string}
  117. */
  118. type AwardTask_req struct {
  119. TaskId int
  120. }
  121. /*
  122. 背包
  123. // Item.Type
  124. const (
  125. Item_Gold = iota // 金币
  126. Item_Diamond // 钻石
  127. Item_Vitality // 活跃度
  128. Item_Cannon // 炮台
  129. Item_Consume // 其他消耗品
  130. )
  131. type Item struct {
  132. Id int
  133. ActiveId int
  134. Type int
  135. Name string
  136. Desc string
  137. Start int // 开始时间戳 秒 0表示无时效
  138. Duration int // 持续时间 秒
  139. ExtraInfo string // 其他特效
  140. }
  141. // 实体道具
  142. type ItemPack struct {
  143. ItemId int
  144. Count int
  145. }
  146. type UserItem struct {
  147. ItemId int // 道具ID
  148. ActiveId int // 时效道具使用中的ID, 0表示非时效道具
  149. Type int
  150. Count int // 道具数量
  151. Start int // 开始时间戳 秒 0表示还未开始使用
  152. Duration int // 持续时间 秒
  153. ExtraInfo string // 其他特效
  154. }
  155. getSysItems
  156. 获取物品系统表
  157. 无上行
  158. 下行 : []Item
  159. getUserItems
  160. 获取我的道具列表
  161. 无上行
  162. 下行 : []UserItem
  163. consumeItem
  164. 使用道具
  165. 上行 : InventoryCosume_req
  166. 下行 : {Succeeded bool,ErrMsg string}
  167. */
  168. /*
  169. 通知推送
  170. notification
  171. 上行: 无,客户端登录后主动注册
  172. 下行: []Notification_push
  173. const (
  174. Notification_Task = iota // 任务
  175. Notification_Vip // vip等级变化
  176. Notification_Inventory // 背包
  177. Notification_Cannon // 炮台
  178. Notification_Gold // 金币
  179. Notification_Diamond // 钻石
  180. )
  181. */
  182. type Notification_push struct {
  183. Type int
  184. Data string
  185. }
  186. type GiftContinueAward_req struct {
  187. Day int
  188. }
  189. type SendUserMail_req struct {
  190. Title string
  191. Content string
  192. Img string
  193. }
  194. type GetUserMail_req struct {
  195. MailId int
  196. }
  197. type SendSysMail_req struct {
  198. Title string //标题
  199. Content string //内容
  200. Status int //状态
  201. SourceName string //源名称
  202. Crdate int //时间戳
  203. Tools []item.ItemPack //附件内容
  204. }
  205. type UpdateSysMail_req struct {
  206. SysMsgId int
  207. Status int
  208. }
  209. type DelSysMail_req struct {
  210. SysMsgId int
  211. }
  212. type RankList_req struct {
  213. RankType int
  214. Num int
  215. }
  216. type RankHistoryList_req struct {
  217. DateFlag string
  218. }
  219. type RankAward_req struct {
  220. RankType int
  221. DoubleFlag int
  222. }
  223. /*
  224. 转盘
  225. prizeWheelConfig 无参数
  226. doWheel
  227. */
  228. type PrizeWheel_req struct {
  229. Times int
  230. }
  231. /*
  232. type Prize struct {
  233. Id int // 客户端排序用
  234. Chance int `json:"-"` // 概率 万分之
  235. Items item.ItemPack
  236. }
  237. type PrizeWheel_resp struct {
  238. Prizes []*prizewheel.Prize
  239. ErrMsg string
  240. }
  241. */
  242. type SaveRealName_req struct {
  243. RealName string
  244. IDCard string
  245. }
  246. /*
  247. 礼包
  248. 包含策划文档中3个模块内容
  249. 限时礼包
  250. 每日特惠
  251. 首充礼包
  252. const (
  253. GiftPackLimit_None = iota // 无限制
  254. GiftPackLimit_Once // 只能购买一次
  255. GiftPackLimit_EveryDay // 每天购买一次
  256. )
  257. const (
  258. GiftPackType_First = iota // 首充礼包
  259. GiftPackType_TimeLimited // 限时礼包
  260. GiftPackType_EveryDay // 每日特惠
  261. )
  262. type GiftPack struct {
  263. Id int
  264. Price int
  265. Limit int
  266. Items []item.ItemPack
  267. //PreGiftPack int `json:",omitempty"` // 前置礼包,必须购买前置礼包才能购买本礼包,这里默认要求连续购买
  268. Type int // 礼包类型
  269. Start int `json:",omitempty"` // 如果是限时礼包
  270. Duration int `json:",omitempty"`
  271. Group int `json:",omitempty"` // 每日特惠中,不同价格用不同Group区分
  272. GroupIndex int `json:",omitempty"` // 同组顺序
  273. }
  274. 协议
  275. getGiftPacks 获取系统礼包
  276. 上行 无
  277. 下行 map[int]GiftPack
  278. getBuyableGiftPacks 获取当前可购买的礼包
  279. 上行 无
  280. 下行 []UserBuyable
  281. type UserBuyable struct {
  282. GiftPackId int // 礼包ID
  283. Buyable bool // 是否可购买
  284. TimeLeft int // 剩余时间
  285. }
  286. buyGiftPack 购买礼包,测试用
  287. 上行: BuyGiftPack_req
  288. 下行: 无
  289. */
  290. type BuyGiftPack_req struct {
  291. ProductID string
  292. }
  293. /*
  294. 成长礼包
  295. const (
  296. GrowthTermStatus_none = iota // 没有
  297. GrowthTermStatus_complete // 可领取
  298. GrowthTermStatus_awarded // 已领取
  299. )
  300. type GrowthPack struct {
  301. Id int // 礼包ID
  302. Name string // 名称
  303. Price int // 价格
  304. Terms []GrowthTerm // 礼包列表
  305. }
  306. type GrowthTerm struct {
  307. TermIndex int // index
  308. Name string // 名称
  309. Bullet int // 解锁子弹
  310. Items []item.ItemPack // 礼包内容
  311. }
  312. type UserGrowthTerm struct {
  313. UserId int // 用户ID,客户端不发
  314. GrowthPackId int // 礼包ID
  315. TermIndex int // index
  316. Bullet int // 目标炮台等级
  317. Status int // 目前状态
  318. }
  319. 协议:
  320. getGrowthPacks 获取系统礼包
  321. []GrowthPack
  322. buyGrowthPack 购买礼包,测试用
  323. BuyGiftPack_req
  324. getGrowthPackTerms 获取所有礼包状态
  325. []UserGrowthTerm
  326. awardGrowthPack 领取礼包奖励
  327. GrowthPackAward_req
  328. */
  329. type GrowthPackAward_req struct {
  330. GiftPackId int
  331. Index int
  332. }
  333. type VipAddPoint_req struct {
  334. Point int
  335. }
  336. type GetDiamond_resp struct {
  337. Success bool
  338. Diamond int
  339. }
  340. type GetMoney_resp struct {
  341. Success bool
  342. Gold int
  343. }
  344. type GetVitality_resp struct {
  345. DayPoint int //日活跃度
  346. WeekPoint int //周活跃度
  347. }
  348. /*
  349. 防沉迷通知
  350. pre_addiction
  351. */
  352. /*
  353. 实物兑换
  354. getExchangeList 获取可兑换的列表
  355. exchangeGift 进行兑换
  356. type ExchangeInfo struct {
  357. Id int
  358. LeftCount int // 剩余数量,如果小于0,则不限量,等于0表示缺货
  359. LimitOnce bool // 是否限制购买一次
  360. VipNeed int // 所需VIP等级
  361. Price int // 价格
  362. Items []item.ItemPack
  363. }
  364. */
  365. type ExchangeGift_req struct {
  366. ExchangeId int
  367. Num int
  368. Remark string
  369. }
  370. type ExchangeHistory_req struct {
  371. PageIndex int
  372. PageSize int
  373. }
  374. type BetList_req struct {
  375. GameID int // 游戏ID
  376. Days int // 天数(0=今天 1=昨天 7=最近一周 all=最近30天)
  377. PageIndex int // 页索引
  378. PageSize int // 页大小
  379. BetZone string
  380. }
  381. type CashList_req struct {
  382. BeginTime string
  383. EndTime string
  384. PageIndex int
  385. PageSize int
  386. }
  387. // 保险柜
  388. type BankInOrOut_req struct {
  389. Amount int
  390. GameID int
  391. ServerName string
  392. }
  393. type BankInOrOut_resp struct {
  394. RetCode int
  395. Gold int //身上金币
  396. BankAmount int //保险柜金币
  397. OutMsg string
  398. }
  399. // 聊天
  400. type Chat_req struct {
  401. ChannelID int //聊天频道
  402. RecvUserID int //私聊备用
  403. Msg string //内容
  404. MsgType int
  405. }
  406. // 好友
  407. type Friend_req struct {
  408. TargetUserID int //搜索,申请,删除, 赠送礼物,领取礼物
  409. TargetNickName string // 昵称
  410. }
  411. type Friend_HandleApply_req struct {
  412. TargetUserID int
  413. Apply int //0:不同意; 1:同意
  414. }
  415. type SpreadApply_req struct {
  416. Code int
  417. }
  418. type SpreadMember_req struct {
  419. PageIndex int
  420. PageSize int
  421. }
  422. type SpreadGift_req struct {
  423. FromUserID int
  424. }
  425. // vip
  426. /*
  427. type VipPrivilege struct {
  428. Privilege int `json:"pid"`
  429. Param int `json:"p"`
  430. }
  431. type VipInfo struct {
  432. Level int //等级
  433. Point int //分数
  434. Desc string //描述
  435. GiftPack []item.ItemPack //升级礼包(json格式)
  436. Privileges []VipPrivilege
  437. }
  438. 获取vip配置表
  439. getVipInfo()
  440. 返回: []VipInfo
  441. 获取我的VIP信息
  442. getUserVip()
  443. 返回:VipLevel,VipPoint
  444. */
  445. // 签到
  446. /*
  447. // 签到历史记录
  448. type SigninWheelHistory struct {
  449. UserId int
  450. NickName string
  451. FaceId int
  452. FaceUrl string
  453. Time int
  454. SigninWheelResult
  455. }
  456. // 签到配置
  457. type config_param struct {
  458. Param int // 参数
  459. Chance int `json:"-"` // 概率,客户端看不到
  460. }
  461. type SigninWheelConfig struct {
  462. totalBaseChance int
  463. totalMultipleChance int
  464. Base []config_param // 基础配置
  465. Multiple []config_param // 倍数配置
  466. }
  467. type UserSiginWheelInfo struct {
  468. CanSignin bool // 我是否可以签到
  469. SigninWheelConfig // 签到配置信息
  470. }
  471. // 签到结果,如果为0则表示签到失败
  472. type SigninWheelResult struct {
  473. Base int // 基础数值
  474. Multiple int // 倍率
  475. }
  476. 三个协议,都不带参数
  477. getSigninWheelInfo 输出 UserSiginWheelInfo
  478. doSigninWheel 输出 SigninWheelResult
  479. getSigninWheelHistory 输出 SigninWheelHistory
  480. */
  481. type AchievementInfo_req struct {
  482. TaskID int
  483. }
  484. type AchievementUpdate_req struct {
  485. TaskID int
  486. Status int
  487. }
  488. type GetGameCount_req struct {
  489. UserID int
  490. }
  491. type TrackRecord_req struct {
  492. Level_1 string // 1级类目
  493. Level_2 string // 2级类目
  494. Level_3 string // 3级类目
  495. }
  496. type Review_req struct {
  497. AppName string
  498. }
  499. // 绑定相关
  500. type BindingInfo struct {
  501. FacebookBound int
  502. PhoneBound int
  503. }
  504. type BindFacebook_req struct {
  505. OpenId string // openid
  506. NickName string // 昵称
  507. FaceUrl string // 头像URL
  508. }
  509. type BindPhone_req struct {
  510. PhoneNumber string
  511. SmsCode string
  512. }
  513. type Bind_resp struct {
  514. RetCode int
  515. ErrMsg string
  516. }
  517. type AwardGameSettleVideo_req struct {
  518. SettleId int
  519. }
  520. type ReceiveNewUserGift_req struct {
  521. IsDouble int // 是否双倍(视频广告)
  522. }
  523. type TeacherBind struct {
  524. TeacherId int
  525. }
  526. type TeacherProfit struct {
  527. Days int
  528. PageIndex int
  529. PageSize int
  530. }
  531. type TeacherPlayVideo struct {
  532. Rid int
  533. StudentId int
  534. }
  535. type AgentBind struct {
  536. Code int
  537. }
  538. type Agent struct {
  539. FromUserId int
  540. PageIndex int
  541. PageSize int
  542. }
  543. type AgentSetBindSend struct {
  544. BindSend int
  545. }
  546. type AgentSendBindSend struct {
  547. ToUserID int
  548. }
  549. type AgentCommissionRank struct {
  550. Days int
  551. PageIndex int
  552. PageSize int
  553. }
  554. type AgentApply struct {
  555. Memo string
  556. }
  557. type AgentGroup struct {
  558. Id int
  559. Name string
  560. Url string
  561. }
  562. type AwardCouponTask_req struct {
  563. UserTaskId int
  564. }
  565. type Transfer_req struct {
  566. ToUserID int
  567. Amount int
  568. }
  569. type Transfer_resp struct {
  570. Success bool
  571. ErrMsg string
  572. }
  573. type SaveBankInfo_req struct {
  574. RealName string // 真实姓名
  575. BankName string // 银行名称
  576. BankCode string // 银行码
  577. BankCard string // 银行卡号
  578. Mobile string // 手机号
  579. }
  580. type Award_req struct {
  581. HallType int // 0=无效 1=金币大厅 2=元宝大厅 3=不区分大厅类型
  582. }
  583. type RechargeCard_req struct {
  584. CardNo string
  585. }
  586. type SaveCountry_req struct {
  587. CountryName string
  588. Currency string
  589. }
  590. type FriendRoomInvite_req struct {
  591. ToUserId int
  592. RoomNo int
  593. }
  594. type FriendBlack_req struct {
  595. ToUserId int
  596. PageIndex int
  597. PageSize int
  598. }