user.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. package gatesink
  2. import (
  3. "encoding/json"
  4. "strings"
  5. "time"
  6. userlabel "bet24.com/servers/micros/userlabel/proto"
  7. "bet24.com/log"
  8. coreservice "bet24.com/servers/coreservice/client"
  9. slotmanager "bet24.com/servers/games/slotcommon/manager"
  10. "bet24.com/servers/insecureframe/gate"
  11. task "bet24.com/servers/micros/task/proto"
  12. )
  13. func newUser(userIndex int32) *user {
  14. this := new(user)
  15. this.init(userIndex)
  16. return this
  17. }
  18. type user struct {
  19. UserIndex int32
  20. chan_clear chan bool
  21. }
  22. func (this *user) init(userIndex int32) {
  23. this.UserIndex = userIndex
  24. this.chan_clear = make(chan bool)
  25. }
  26. func (this *user) clear() {
  27. // 用户离开
  28. slotmanager.OnUserExit(this.getUserId())
  29. u := gate.GetUserInfo(this.UserIndex)
  30. // 1=活跃时长(大厅模块)(用户标签)
  31. seconds := time.Now().Unix() - u.GetLogonTime()
  32. go userlabel.TriggerEvent(this.getUserId(), userlabel.Type_Login, userlabel.Scope{OnlineSeconds: int(seconds)})
  33. if u != nil && !Sink.IsChipRoom() {
  34. go func(userId int) {
  35. coreservice.OnUserExit(userId)
  36. }(this.getUserId())
  37. }
  38. close(this.chan_clear)
  39. }
  40. func (this *user) onLogined() {
  41. u := gate.GetUserInfo(this.UserIndex)
  42. if u == nil {
  43. return
  44. }
  45. userId := u.GetUserId()
  46. coreservice.OnUserEnter(userId, this.GetIP())
  47. go slotmanager.OnUserLogined(this.getUserId())
  48. // 开启Notification
  49. if !Sink.IsChipRoom() {
  50. go func() {
  51. time.Sleep(time.Second)
  52. task.DoTaskAction(userId, task.TaskAction_login, 1, task.TaskScope{})
  53. }()
  54. this.selectNotification()
  55. // 发一个广告配置
  56. this.sendAdConfig()
  57. }
  58. }
  59. func (this *user) onGameMessage(msg, data string) bool {
  60. //处理无需登录指令
  61. if ret := this.handleAuthlessMsg(msg, data); ret {
  62. return true
  63. }
  64. //需要登录的指令
  65. if ret := this.handleAuthMsg(msg, data); ret {
  66. return true
  67. }
  68. log.Debug("unhandled message %v data %v", msg, data)
  69. return false
  70. }
  71. // 不需要登录的指令
  72. func (this *user) handleAuthlessMsg(msg, data string) (ret bool) {
  73. ret = true
  74. switch msg {
  75. case "gameRequest": //审核游戏名
  76. this.gameRequest(msg, data)
  77. this.sendLoginConfig()
  78. case "getSlotConfig":
  79. ret := slotmanager.GetConfigByCmd(data)
  80. this.WriteMsg(msg, ret)
  81. case "getSlotConfigList":
  82. ret := slotmanager.GetConfigList(data)
  83. d, _ := json.Marshal(ret)
  84. this.WriteMsg(msg, string(d))
  85. case "writeSlotConfig":
  86. log.Debug("writeSlotConfig %s", data)
  87. ret := slotmanager.WriteConfigByCmd(data)
  88. this.WriteMsg(msg, ret)
  89. case "feedback":
  90. this.feedback(msg, data)
  91. case "trackRecord": //足迹记录
  92. this.trackRecord(msg, data)
  93. default:
  94. ret = false
  95. }
  96. return
  97. }
  98. func (this *user) handleAuthMsg(msg, data string) (ret bool) {
  99. u := gate.GetUserInfo(this.UserIndex)
  100. if u == nil {
  101. log.Release("handleAuthMsg invalid msg = %s userIndex=%d u=%+v", msg, this.UserIndex, u)
  102. return false
  103. }
  104. userId := u.GetUserId()
  105. if userId <= 0 {
  106. log.Release("handleAuthMsg invalid msg = %s userIndex=%d userId=%d u=%+v", msg, this.UserIndex, userId, u)
  107. return false
  108. }
  109. //log.Debug("handleAuthMsg %s", msg)
  110. ret = true
  111. switch msg {
  112. // 商城
  113. case "getExchangeRateList": // 币种列表
  114. this.getExchangeRateList(msg, data)
  115. case "saveCountry": // 保存国家地区
  116. this.saveCountry(msg, data)
  117. case "getShopList":
  118. this.getShopList(msg, data)
  119. case "getLocalPrice":
  120. this.getLocalPrice(msg, data)
  121. case "changeFace": //修改头像
  122. this.changeFace(msg, data)
  123. case "changeNickName": //修改昵称
  124. this.changeNickName(msg, data)
  125. case "changeNameInfo": // 修改昵称信息
  126. this.changeNameInfo(msg, data)
  127. case "changeSex": //修改性别
  128. this.changeSex(msg, data)
  129. case "getInfo": //查询社交类用户信息(昵称、服务器名称、头像变化)
  130. this.getInfo(msg, data)
  131. // 邮件类处理
  132. case "sendUserMail": // 发送用户邮件
  133. this.sendUserMail(msg, data)
  134. case "getUserMails": // 获取用户邮件列表
  135. this.getUserMails(msg, data)
  136. case "sendSysMail": // 发送系统邮件(含附件)
  137. this.sendSysMail(msg, data)
  138. case "getSysMails": // 获取系统邮件列表
  139. this.getSysMails(msg, data)
  140. case "updateSysMail": // 修改系统邮件(领取邮件附件)
  141. this.updateSysMail(msg, data)
  142. case "delSysMail": // 删除系统邮件
  143. this.delSysMail(msg, data)
  144. case "updateAllSysMail": // 领取所有邮件
  145. this.updateAllSysMail(msg, data)
  146. // 金币操作
  147. case "cashLog": // 金币日志
  148. this.cashLog(msg, data)
  149. case "financeLog": // 充值、提现记录
  150. this.financeLog(msg, data)
  151. // 服务器类处理
  152. case "betlist": // 下注记录
  153. this.betlist(msg, data)
  154. case "gameHistory": // 游戏历史
  155. this.gameHistory(msg, data)
  156. case "getGameCount": // 游戏记录
  157. this.getGameCount(msg, data)
  158. case "getLonghuRooms":
  159. this.getLonghuRooms(msg, data)
  160. case "getGameRooms":
  161. this.getGameRooms(msg, data)
  162. case "setSwitchInfo":
  163. this.setSwitchInfo(msg, data) // 设置开关(旁观、跟踪)
  164. case "getSwitchInfo":
  165. this.getSwitchInfo(msg, data) // 获取(个人)开关信息
  166. case "getSwitchLevelConf":
  167. this.getSwitchLevelConf(msg, data) // 获取开关等级配置
  168. case "awardTask":
  169. this.awardTask(msg, data)
  170. case "awardAllTask":
  171. this.awardAllTask(msg)
  172. case "getSysTask":
  173. this.getSysTask(msg, data)
  174. case "getSysTaskList":
  175. this.getSysTaskList(msg, data)
  176. case "getUserTaskList":
  177. this.getUserTaskList(msg, data)
  178. case "getUserRecordList":
  179. this.getUserRecordList(msg, data)
  180. case "getCouponTask":
  181. this.getCouponTask(msg, data)
  182. case "awardCouponTask":
  183. this.awardCouponTask(msg, data)
  184. case "updateCouponTaskTmpLimit":
  185. this.updateCouponTaskTmpLimit(msg, data)
  186. case "getSysItems": //获取系统道具列表
  187. this.getSysItems(msg, data)
  188. case "consumeItem": //使用道具
  189. this.consumeItem(msg, data)
  190. case "sellItem": // 出售道具
  191. this.sellItem(msg, data)
  192. case "giftItems": // 赠送道具
  193. this.giftItems(msg, data)
  194. case "getGiftCardHistory": // 获取礼品卡记录
  195. this.getGiftCardHistory(msg, data)
  196. case "getUserDecorations":
  197. this.getUserDecorations(msg, data)
  198. case "setUserDecoration":
  199. this.setUserDecoration(msg, data)
  200. // 转盘
  201. case "prizeWheelConfig":
  202. this.getPrizeWheelConfig(msg)
  203. case "getWheelTimes":
  204. this.getWheelTimes(msg, data)
  205. case "doWheel":
  206. this.doWheel(msg, data)
  207. case "getPrizeRecord":
  208. this.getPrizeRecord(msg, data)
  209. case "getJackpotAmount":
  210. this.getJackpotAmount(msg)
  211. case "subsidyGetInfo": //获取补助信息
  212. this.subsidyGetInfo(msg, data)
  213. case "subsidyGift": //领取补助
  214. this.subsidyGift(msg, data)
  215. case "subsidyGiftChip": //领取元宝补助
  216. this.subsidyGiftChip(msg, data)
  217. case "getUserVitalityInfo": //获取用户活跃度信息
  218. this.getUserVitalityInfo(msg, data)
  219. case "getGiftPacks": // 获取礼包数据
  220. this.getGiftPacks(msg)
  221. case "getBuyableGiftPacks": // 获取用户可购买的礼包列表
  222. this.getBuyableGiftPacks(msg)
  223. case "getGrowthPacks": // 获取礼包数据
  224. this.getGrowthPacks(msg)
  225. case "getGrowthPackTerms": // 获取用户可购买的礼包列表
  226. this.getGrowthPackTerms(msg)
  227. case "awardGrowthPack": // 获取用户可购买的礼包列表
  228. this.awardGrowthPack(msg, data)
  229. case "monthlyCardSysInfo": //月卡系统信息
  230. this.monthlyCardSysInfo(msg, data)
  231. case "monthlyCardUserInfo": //月卡用户信息
  232. this.monthlyCardUserInfo(msg, data)
  233. case "monthlyCardGift": //月卡领取
  234. this.monthlyCardGift(msg, data)
  235. case "weekCardGift": //周卡领取
  236. this.weekCardGift(msg, data)
  237. case "getExchangeList":
  238. this.getExchangeList(msg, data)
  239. case "exchangeGift":
  240. this.exchangeGift(msg, data)
  241. case "getExchangeHistory":
  242. this.getExchangeHistory(msg, data)
  243. case "getShareItems":
  244. this.getShareItems(msg)
  245. case "rewardShareItems":
  246. this.rewardShareItems(msg)
  247. case "doSharePlatform":
  248. this.doSharePlatform()
  249. case "doShareGame":
  250. this.doShareGame()
  251. case "finishNoviceGuidance":
  252. this.finishNoviceGuidance(data)
  253. case "finishGameNoviceGuidance":
  254. this.finishGameNoviceGuidance(msg, data)
  255. case "isShowNoviceGuidance":
  256. this.isShowNoviceGuidance(msg, data)
  257. case "exchangeGold":
  258. this.exchangeGold(msg, data)
  259. case "exchangeGoldInBulk":
  260. this.exchangeGoldInBulk(msg, data)
  261. //保险柜
  262. case "bankIn": //保险柜存入
  263. this.bankIn(msg, data)
  264. case "bankOut": //保险柜取出
  265. this.bankOut(msg, data)
  266. case "bankQuery": //保险柜查询
  267. this.bankQuery(msg, data)
  268. case "goldTransferLog": // 赠送记录
  269. this.goldTransferLog(msg, data)
  270. case "goldTransferCfg": // 赠送配置信息
  271. this.goldTransferCfg(msg, data)
  272. case "transferGold":
  273. this.transferGold(msg, data)
  274. //聊天
  275. case "sendChatMsg": //发送聊天信息
  276. this.sendChatMsg(msg, data)
  277. case "getChatMsg": // 获取聊天信息
  278. this.getChatMsg(msg, data)
  279. case "sendChannelChat":
  280. this.sendChannelChat(msg, data)
  281. case "getChannelChat":
  282. this.getChannelChat(msg, data)
  283. case "getChannelInfo":
  284. this.getChannelInfo(msg, data)
  285. case "clearChannelHistory":
  286. this.clearChannelHistory(msg, data)
  287. // 好友
  288. case "searchUser": //搜索玩家
  289. this.getSearchUserinfo(msg, data)
  290. case "searchUserList": //搜索玩家
  291. this.getSearchUserList(msg, data)
  292. case "friendApply": //添加好友
  293. this.friendApply(msg, data)
  294. case "friendApplyList": //好友审核列表
  295. this.friendVerifyList(msg, data)
  296. case "friendHandleApply": //好友申请处理
  297. this.friendHandleApply(msg, data)
  298. case "getfriendList": //好友列表
  299. this.getFriendList(msg, data)
  300. case "delfriend": //删除好友
  301. this.delFriend(msg, data)
  302. case "friendGiveGift": //赠送礼物
  303. this.friendGiveGift(msg, data)
  304. case "friendGetGift": //获得礼物
  305. this.friendGetGift(msg, data)
  306. case "friendRoomInvite": // 房间邀请(好友场)
  307. this.friendRoomInvite(msg, data)
  308. case "friendGetRoomInviteList": // 好友邀请列表
  309. this.friendGetRoomInviteList(msg, data)
  310. case "friendRoomInviteInvalid": // 好友邀请失效
  311. this.friendRoomInviteInvalid(msg, data)
  312. case "getMaxFriendCount": // 获取好友上限
  313. this.getMaxFriendCount(msg)
  314. case "getPotentialFriendList": // 获取潜在好友
  315. this.getPotentialFriendList(msg)
  316. case "friendGetBlackList": // 黑名单列表
  317. this.friendGetBlackList(msg, data)
  318. case "friendAddBlack": // 添加黑名单
  319. this.friendAddBlack(msg, data)
  320. case "friendDelBlack": // 删除黑名单
  321. this.friendDelBlack(msg, data)
  322. //推广(邀请)
  323. case "spreadApply": //会员申请
  324. this.spreadApply(msg, data)
  325. case "spreadMembers": //会员列表
  326. this.spreadMembers(msg, data)
  327. case "spreadGift": //领取奖励
  328. this.spreadGift(msg, data)
  329. //评论
  330. case "reviewInfo": //获取评论信息
  331. this.reviewGetInfo(msg, data)
  332. case "reviewGift": //领取评论
  333. this.reviewGift(msg, data)
  334. // 签到转盘
  335. case "getSigninWheelInfo":
  336. this.getSigninWheelInfo(msg)
  337. case "doSigninWheel":
  338. this.doSigninWheel(msg)
  339. case "getSigninWheelHistory":
  340. this.getSigninWheelHistory(msg)
  341. //服务器类处理
  342. case "getGameList": //游戏列表
  343. this.getGameList(msg, data)
  344. case "changeUserWord": //修改个性签名
  345. this.changeUserWord(msg, data)
  346. case "getMyGameStatus": //获取游戏状态,用于金币场断线重连
  347. this.getMyGameStatus(msg)
  348. //case "trackRecord": //足迹记录
  349. // this.trackRecord(msg, data)
  350. case "testPay": // 充值测试用
  351. this.testPay(data)
  352. case "triggerEvent": // 触发用户标签事件
  353. this.triggerEvent(msg, data)
  354. case "getUserFirstCharge":
  355. this.getUserFirstCharge(msg, data)
  356. case "sendSms": //发送短信验证码
  357. this.sendSms(msg, data)
  358. case "bindPhone":
  359. this.bindPhone(msg, data)
  360. case "bindFacebook":
  361. this.bindFacebook(msg, data)
  362. case "getBindingInfo":
  363. this.getBindingInfo(msg)
  364. case "bankInfo": // 银行信息
  365. this.bankInfo(msg)
  366. case "getNewUserGift":
  367. this.getNewUserGift(msg)
  368. case "receiveNewUserGift":
  369. this.receiveNewUserGift(msg, data)
  370. case "getNewYearGift":
  371. this.getNewYearGift(msg)
  372. case "receiveNewYearGift":
  373. this.receiveNewYearGift(msg, data)
  374. case "getGameSettleVideoList":
  375. this.getGameSettleVideoList(msg, data)
  376. case "awardGameSettleVideo":
  377. this.awardGameSettleVideo(msg, data)
  378. case "withdrawInfo": // 提现信息(提现前调用)
  379. this.withdrawInfo(msg)
  380. // 师徒体系
  381. case "teacherRegister": // 注册
  382. this.teacherRegister(msg, data)
  383. case "teacherInfo": // 师父信息
  384. this.teacherInfo(msg, data)
  385. case "bindTeacher": // 绑定
  386. this.bindTeacher(msg, data)
  387. case "students": // 徒弟列表
  388. this.students(msg, data)
  389. case "teacherProfitList": // 收益列表
  390. this.teacherProfitList(msg, data)
  391. case "rankAward": // 榜单奖励
  392. this.rankAward(msg, data)
  393. case "getLevelList": // 等级信息
  394. this.getLevelList(msg, data)
  395. case "hallAward": // 登录奖励
  396. this.loginAward(msg, data)
  397. case "getSlotScore":
  398. this.getSlotScore(msg, data)
  399. case "getSlotScoreExchange":
  400. this.getSlotScoreExchange(msg, data)
  401. case "slotScoreExchange":
  402. this.slotScoreExchange(msg, data)
  403. case "getSlotScoreExchangeHistory":
  404. this.getSlotScoreExchangeHistory(msg, data)
  405. case "getChipWheelConfig":
  406. this.getChipWheelConfig(msg)
  407. case "doChipWheel":
  408. this.doChipWheel(msg, data)
  409. case "getChipWheelHistory":
  410. this.getChipWheelHistory(msg)
  411. case "purchaseInfo": // 100K购信息(期数\元宝数量\倒计时\抽奖码集合)
  412. this.purchaseInfo(msg, data)
  413. case "purchaseBet": // 100K购抽奖(返回操作结果\抽奖码)
  414. this.purchaseBet(msg, data)
  415. case "sendTaskAnswerAward": // 问卷调查奖励
  416. this.sendTaskAnswerAward(msg, data)
  417. case "sendAgentShareAward": // 代理分享奖励
  418. this.sendAgentShareAward(msg, data)
  419. case "useRechargeCard":
  420. this.useRechargeCard(msg, data) // 使用充值卡
  421. case "getUserWinScore":
  422. this.getUserWinScore(msg) // 获取当前累积的输赢
  423. case "deleteAccount": // 删除账号
  424. this.deleteAccount(msg, data)
  425. case "addDot": // 添加打点
  426. this.addDot(msg, data)
  427. case "getUserSavingPot": // 获取存钱罐
  428. this.getUserSavingPot(msg, data)
  429. case "getUserNewSavingPot": // 获取存钱罐
  430. this.getUserNewSavingPot(msg, data)
  431. case "checkUserSavingPotStatus": // 获取存钱罐状态
  432. this.checkUserSavingPotStatus(msg, data)
  433. default:
  434. if strings.Contains(msg, "agent") {
  435. this.onAgentMsg(msg, data)
  436. return
  437. }
  438. if strings.Contains(msg, "SlotsService") {
  439. this.onSlotsServiceMsg(msg, data)
  440. return
  441. }
  442. if strings.Contains(msg, "LadderService") {
  443. this.onUserLadderMsg(msg, data)
  444. return
  445. }
  446. if strings.Contains(msg, "DailyWheel") {
  447. this.onDailyWheelMsg(msg, data)
  448. return
  449. }
  450. if strings.Contains(msg, "BattlePass") {
  451. this.onBattlePassMsg(msg, data)
  452. return
  453. }
  454. if strings.Contains(msg, "UserSignIn") {
  455. this.onUserSignInMsg(msg, data)
  456. return
  457. }
  458. if strings.Contains(msg, "PrivateRoom") {
  459. this.onPrivateRoomMsg(msg, data)
  460. return
  461. }
  462. if strings.Contains(msg, "SimpleMatch") {
  463. this.onSimpleMatchMsg(msg, data)
  464. return
  465. }
  466. if strings.Contains(msg, "PointMatch") {
  467. this.onPointMatchMsg(msg, data)
  468. return
  469. }
  470. if strings.Contains(msg, "SetsMatch") {
  471. this.onSetsMatchMsg(msg, data)
  472. return
  473. }
  474. if strings.Contains(msg, "SngMatch") {
  475. this.onSngMatchMsg(msg, data)
  476. return
  477. }
  478. if strings.Contains(msg, "ComboMatch") {
  479. this.onComboMatchMsg(msg, data)
  480. return
  481. }
  482. if strings.Contains(msg, "SingleMatch") {
  483. this.onSingleMatchMsg(msg, data)
  484. return
  485. }
  486. if strings.Contains(msg, "AudioRoom") { // 语音房相关处理
  487. this.onAudioRoomMsg(msg, data)
  488. return
  489. }
  490. // 需要定向输出的
  491. if strings.Contains(msg, "rankList") { // 获取排行榜列表
  492. this.getRankList(msg, data)
  493. return
  494. }
  495. // 需要定向输出的
  496. if strings.Contains(msg, "rankHistoryList") { // 获取历史榜单
  497. this.rankHistoryList(msg, data)
  498. return
  499. }
  500. if strings.Contains(msg, "getRankAwardList") { // 榜单奖励列表
  501. this.getRankAwardList(msg, data)
  502. return
  503. }
  504. if strings.Contains(msg, "getUserItems") { //获取背包内道具列表
  505. this.getUserItems(msg, data)
  506. return
  507. }
  508. if strings.Contains(msg, "announceList") { // 公告列表
  509. this.announceList(msg, data)
  510. return
  511. }
  512. if slotmanager.OnGameMessage(u.GetUserId(), msg, data) {
  513. return
  514. }
  515. if strings.Contains(msg, "NewVip") { // 新版vip
  516. this.onNewVipMsg(msg, data)
  517. return
  518. }
  519. if strings.Contains(msg, "Badge") { // 徽章
  520. this.onBadgeMsg(msg, data)
  521. return
  522. }
  523. if strings.Contains(msg, "GiftService") {
  524. this.onGiftServiceMsg(msg, data)
  525. return
  526. }
  527. if strings.Contains(msg, "NoviceWelfare") { // 新手福利任务
  528. this.onNoviceWelfareMsg(msg, data)
  529. return
  530. }
  531. if strings.Contains(msg, "LevelRewards") { // 等级礼包
  532. this.onLevelRewardsMsg(msg, data)
  533. return
  534. }
  535. if strings.HasPrefix(msg, "guess") { // 竞猜相关协议
  536. this.onGuessMsg(msg, data)
  537. return
  538. }
  539. if strings.Contains(msg, "HighlyProfitable") { // 一本万利
  540. this.onHighlyProfitableMsg(msg, data)
  541. return
  542. }
  543. //if strings.Contains(msg, "getBroadcasts") { //获取广播消息
  544. // this.getBroadcasts(msg, data)
  545. // return
  546. //}
  547. ret = false
  548. }
  549. return
  550. }
  551. func (this *user) WriteMsg(msg, data string) bool {
  552. return gate.SendMessage(this.UserIndex, msg, data)
  553. }
  554. func (this *user) GetIP() string {
  555. return gate.GetUserIP(this.UserIndex)
  556. }
  557. func (this *user) GetEventChannel() chan interface{} {
  558. return gate.GetEventChannel(this.UserIndex)
  559. }
  560. func (this *user) getUserId() int {
  561. u := gate.GetUserInfo(this.UserIndex)
  562. if u == nil {
  563. return 0
  564. }
  565. return u.GetUserId()
  566. }
  567. func (this *user) getYyfUid() int {
  568. u := gate.GetUserInfo(this.UserIndex)
  569. if u == nil {
  570. return 0
  571. }
  572. return u.YyfUid
  573. }
  574. func (this *user) getPartnerId() int {
  575. u := gate.GetUserInfo(this.UserIndex)
  576. if u == nil {
  577. return 0
  578. }
  579. return u.GetPartnerId()
  580. }
  581. func (this *user) getVersionCode() int {
  582. u := gate.GetUserInfo(this.UserIndex)
  583. if u == nil {
  584. return 0
  585. }
  586. return u.GetVersionCode()
  587. }
  588. func (this *user) getUserGold() int {
  589. u := gate.GetUserInfo(this.UserIndex)
  590. if u == nil {
  591. return 0
  592. }
  593. return u.GetUserGold()
  594. }
  595. func (this *user) getNickName() string {
  596. u := gate.GetUserInfo(this.UserIndex)
  597. if u == nil {
  598. return ""
  599. }
  600. return u.GetUserNickName()
  601. }
  602. func (this *user) getFaceId() int {
  603. u := gate.GetUserInfo(this.UserIndex)
  604. if u == nil {
  605. return 0
  606. }
  607. return u.GetUserFaceId()
  608. }
  609. func (this *user) getFaceUrl() string {
  610. u := gate.GetUserInfo(this.UserIndex)
  611. if u == nil {
  612. return ""
  613. }
  614. return u.GetUserFaceUrl()
  615. }
  616. func (this *user) getHigherUserId() int {
  617. u := gate.GetUserInfo(this.UserIndex)
  618. if u == nil {
  619. return 0
  620. }
  621. return u.GetHigherUserID()
  622. }
  623. func (this *user) setHigherUserId(higherUserId int) {
  624. u := gate.GetUserInfo(this.UserIndex)
  625. if u == nil {
  626. return
  627. }
  628. u.SetHigherUserID(higherUserId)
  629. }
  630. func (this *user) getCurrency() string {
  631. return "SAR"
  632. /*
  633. u := gate.GetUserInfo(this.UserIndex)
  634. if u == nil {
  635. return "SAR"
  636. }
  637. ret := u.GetCurrency()
  638. if ret == "" {
  639. ret = "SAR"
  640. }
  641. return ret*/
  642. }
  643. func (this *user) setCurrency(currency string) {
  644. u := gate.GetUserInfo(this.UserIndex)
  645. if u == nil {
  646. return
  647. }
  648. u.SetCurrency(currency)
  649. }
  650. func (this *user) getCurrencyIsModify() int {
  651. u := gate.GetUserInfo(this.UserIndex)
  652. if u == nil {
  653. return 0
  654. }
  655. return u.GetCurrencyIsModify()
  656. }
  657. func (this *user) setCurrencyIsModify(isModify int) {
  658. u := gate.GetUserInfo(this.UserIndex)
  659. if u == nil {
  660. return
  661. }
  662. u.SetCurrencyIsModify(isModify)
  663. }
  664. func (this *user) getUTMSource() string {
  665. u := gate.GetUserInfo(this.UserIndex)
  666. if u == nil {
  667. return ""
  668. }
  669. return u.GetUTMSource()
  670. }
  671. func (this *user) setUTMSource(source string) {
  672. u := gate.GetUserInfo(this.UserIndex)
  673. if u == nil {
  674. return
  675. }
  676. u.SetUTMSource(source)
  677. }
  678. func (this *user) isGuest() bool {
  679. u := gate.GetUserInfo(this.UserIndex)
  680. if u == nil {
  681. return false
  682. }
  683. return u.IsGuest()
  684. }