MemKey_Guild.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * Description of MemKey_Guild
  5. *
  6. * @author cyzhao
  7. */
  8. class MemKey_Guild {
  9. //
  10. // <editor-fold defaultstate="collapsed" desc=" 辅助方法 ">
  11. //
  12. /**
  13. * @return bool 是否使用短名称
  14. */
  15. private static function bUseShort() {
  16. // return true; # 全部启用
  17. return defined('GAME_ONLINE') and GAME_ONLINE;
  18. }
  19. /**
  20. * key前缀
  21. * @param int $zoneid 分区id
  22. * @param string $uid
  23. * @return string
  24. */
  25. private static function Key_($zoneid, $uid) {
  26. return self::bUseShort() ? 'u-' . $uid . '-' . $zoneid : 'user-' . $uid . '-zone' . $zoneid;
  27. }
  28. // </editor-fold>
  29. /**
  30. * 获取玩家公会信息
  31. * @param type $zoneid
  32. * @return string
  33. */
  34. public static function getUserGuildInfo_hash($uid, $zoneid) {
  35. return self::Key_($zoneid, $uid) . "-guild";
  36. }
  37. /**
  38. * 公会列表缓存
  39. * @param type $page
  40. * @param type $zoneid
  41. * @return type
  42. */
  43. public static function guildListCache($page, $zoneid) {
  44. return "cache-guild-list" . "-zone" . $zoneid . $page;
  45. }
  46. // /**
  47. // * 推荐公会列表缓存
  48. // * @return string
  49. // */
  50. // static function guildRecommendationCache($zoneid) {
  51. // return "cache-guild-recommendation" . "-zone" . $zoneid;
  52. // }
  53. //
  54. // /**
  55. // * 推荐公会队列
  56. // * @return string
  57. // */
  58. // static function constGuildRecommendationQueue($zoneid) {
  59. // return "guild-recommendation-queue" . "-zone" . $zoneid;
  60. // }
  61. /**
  62. * 获取公会信息
  63. */
  64. static function getGuildInfo_hash($gid, $zoneid) {
  65. return "guild-" . $gid . "-zone" . $zoneid;
  66. }
  67. /**
  68. * 获取当前最大公会ID,
  69. * @return string
  70. */
  71. static function constGetCurrentMaxGuildID($zoneid) {
  72. return "guild-currentmaxid" . "-zone" . $zoneid;
  73. }
  74. // /**
  75. // * 【哈希】捐献请求记录
  76. // * @return string
  77. // */
  78. // static function CacheGuildDonate($guildId, $zoneid) {
  79. // return "guild-donate-" . $guildId . "-zone" . $zoneid;
  80. // }
  81. //
  82. // /**
  83. // * 【LIST】捐献者记录
  84. // * @return string
  85. // */
  86. // static function UserDonateRecordList($guildId, $index, $zoneid) {
  87. // return "guild-donor-" . $guildId . "-" . $index . "-zone" . $zoneid;
  88. // }
  89. //
  90. // /**
  91. // * 【LIST】除了捐献之外的日志
  92. // * @return string
  93. // */
  94. // static function constGuildJournal($guildId, $zoneid) {
  95. // return "guild-journal-" . $guildId . "-zone" . $zoneid;
  96. // }
  97. }