MemKey_GameRun.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 运行时游戏全局数据
  5. * @version
  6. * 1.0.0 Created at 2017-4-6. by --gwang
  7. * @author gwang (mail@wanggangzero.cn)
  8. * @copyright ? 2017-4-6, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  9. */
  10. class MemKey_GameRun {
  11. /**
  12. * 运行时数据 - 英雄评价内容
  13. * @param type $heroId
  14. * @return string
  15. */
  16. public static function HeroDiscusses_item_hash($heroId) {
  17. return "gamerun-herodiscuss-$heroId-item";
  18. }
  19. /**
  20. * 运行时数据 - 英雄评价内容的评分
  21. * @param int $heroId
  22. * @return string
  23. */
  24. public static function HeroDiscusses_score_zset($heroId) {
  25. return "gamerun-herodiscuss-$heroId-score";
  26. }
  27. /**
  28. * 运行时数据 - 英雄评价 - 玩家给英雄打分
  29. * @param int $heroId
  30. * @return string
  31. */
  32. public static function HeroDiscusses_userScore_normal($heroId) {
  33. return "gamerun-herodiscuss-$heroId-userscore";
  34. }
  35. /**
  36. * 运行时数据 - 订单编号 - 当前秒内的订单序号
  37. * @return type
  38. */
  39. public static function Game_OrderID_normal_int() {
  40. return "gamerun-orderId-" . now();
  41. }
  42. /**
  43. * 运行时数据 - 玩家记录集
  44. * @param int $zoneid 分区id
  45. * @param int $day tsDay
  46. * @return string
  47. */
  48. public static function Game_UserRecordByZone($zoneid, $day) {
  49. return "gamerun-dailyUserRecord-$day-zone$zoneid";
  50. }
  51. /**
  52. * 运行时数据 - 系统消息
  53. * @param int $zoneid
  54. * @return string
  55. */
  56. public static function Game_SysMsgByZone_zset($zoneid) {
  57. return "gamerun-sysmsg-zone$zoneid";
  58. }
  59. /**
  60. * 运行时数据 - pvp蝉联信息
  61. * @param int $zoneid
  62. */
  63. static function Game_PVP_Chanlian_normal($zoneid) {
  64. return "gamerun-pvp-chanlian-zone$zoneid";
  65. }
  66. /**
  67. * 运行时数据 - pvp蝉联历史冠军数据
  68. * @param type $zoneid
  69. * @return type
  70. */
  71. static function Game_PVP_Chanlian_History_hash($zoneid) {
  72. return "gamerun-pvp-chanlian-history-zone$zoneid";
  73. }
  74. /**
  75. * 运行时数据 - pvp实时积分榜(总榜)
  76. * @param int $zoneid
  77. * @return string
  78. */
  79. public static function Game_PVPScoreByZone_zset($zoneid) {
  80. return "gamerun-pvpScore-zone$zoneid";
  81. }
  82. /**
  83. * 运行时数据 - pvp实时积分榜(当前)
  84. * 当前和上周都是作为总榜的记录存在,
  85. * @param int $zoneid
  86. * @return string
  87. */
  88. public static function Game_PVPScoreByZone_zset_curWeek($zoneid) {
  89. $week = TimeUtil::tsWeek();
  90. return "gamerun-pvpScore-zone$zoneid-$week";
  91. }
  92. /**
  93. * 运行时数据 - pvp积分榜(上周)
  94. * 当前和上周都是作为总榜的记录存在,
  95. * @param int $zoneid
  96. * @return string
  97. */
  98. public static function Game_PVPScoreByZone_zset_lastWeek($zoneid) {
  99. $week = TimeUtil::tsWeek() - 1;
  100. return "gamerun-pvpScore-zone$zoneid-$week";
  101. }
  102. /**
  103. * 运行时数据 - pvp 每周排行榜发放记录 [tsweek,...]
  104. * @param int $zoneid
  105. * @return string
  106. */
  107. public static function Game_PVPRankRewardRecord_set($zoneid) {
  108. return "gamerun-pvpRewardRecord-zone$zoneid";
  109. }
  110. /**
  111. * 运行时数据 - pvp 每周领取排行榜奖励的玩家记录 [tsweek,...]
  112. * @param int $zoneid
  113. * @param int $tsweek Description
  114. * @return string
  115. */
  116. public static function Game_PVPRankRewardRecord_byWeek_str($zoneid, $tsweek) {
  117. return "gamerun-pvpRewardRecord-zone$zoneid-$tsweek";
  118. }
  119. /**
  120. * 运行时数据 - 战斗力总榜
  121. * @param type $zoneid
  122. */
  123. public static function Game_FightPowerRank_zset($zoneid) {
  124. return "gamerun-fightpower-zone$zoneid";
  125. }
  126. /**
  127. * 运行时数据 - 每天的登录用户记录-byUId
  128. * @param type $zoneid
  129. * @param type $tsDay
  130. * @return type
  131. */
  132. static function DailyLoginUser_byUID_hash($zoneid, $tsDay = null) {
  133. if (!$tsDay) { # 检查是否默认参数
  134. $tsDay = tsDay();
  135. }
  136. return "gamerun-loginUser-byUid-zone$zoneid-day_$tsDay";
  137. }
  138. /**
  139. * 运行时数据 - 每天的登录用户记录-byLevel
  140. * @param type $zoneid
  141. * @param int $level 玩家等级
  142. * @param type $tsDay
  143. * @return type
  144. */
  145. static function DailyLoginUser_byLevel_hash($zoneid, $level, $tsDay = null) {
  146. if (!$tsDay) { # 检查是否默认参数
  147. $tsDay = tsDay();
  148. }
  149. return "gamerun-loginUser-byLevel-zone$zoneid-day_$tsDay-lvl_$level";
  150. }
  151. // ------ 统计分析 数据 ↓ ----
  152. /**
  153. * 统计数据 - 用户总数量 (int)
  154. * @return string
  155. */
  156. public static function Stat_UserCountByZone_int($zoneid) {
  157. return "stat-totalUserNum-zone$zoneid";
  158. }
  159. // <editor-fold defaultstate="collapsed" desc="商城">
  160. /**
  161. * 统计数据 - 每日商品销量 (zset)
  162. * @param type $zoneid
  163. * @return string
  164. */
  165. public static function stat_daily_ShopSales_zset($zoneid, $tsday) {
  166. return "stat-daily-shopsales-zone$zoneid-$tsday";
  167. }
  168. /**
  169. * 统计数据 - 每周商品销量 (zset)
  170. * @param type $zoneid
  171. * @param type $tsweek
  172. * @return string
  173. */
  174. public static function stat_weekly_ShopSales_zset($zoneid, $tsweek) {
  175. return "stat-weekly-shopsales-zone$zoneid-$tsweek";
  176. }
  177. /**
  178. * 统计数据 - 每月商品销量 (zset)
  179. * @param type $zoneid
  180. * @param type $tsmonth
  181. * @return string
  182. */
  183. public static function stat_monthly_ShopSales_zset($zoneid, $tsmonth) {
  184. return "stat-monthly-shopsales-zone$zoneid-$tsmonth";
  185. }
  186. /**
  187. * 消费日志 - 普通商城消费记录 (list1000)
  188. * @param type $zoneid
  189. * @return type
  190. */
  191. public static function log_ShopSales_list($zoneid) {
  192. return "log-shopsales-zone$zoneid";
  193. }
  194. // </editor-fold>
  195. public static function stat_daily_secretshopSales_zset($zoneid, $tsday) {
  196. return "stat-daily-secretshopsales-zone$zoneid-$tsday";
  197. }
  198. public static function stat_weekly_secretshopSalse_zset($zoneid, $tsweek) {
  199. return "stat-weekly-secretshopsales-zone$zoneid-$tsweek";
  200. }
  201. public static function stat_monthly_secretshopSales_zset($zoneid, $tsMonth) {
  202. return "stat-monthly-secretshopsales-zone$zoneid-$tsMonth";
  203. }
  204. /**
  205. * 神秘商城 - 消费日志 ()list1000)
  206. * @param type $zoneid
  207. * @return string
  208. */
  209. public static function log_secretshopSales_list($zoneid) {
  210. return "log-secretshopsales-zone$zoneid";
  211. }
  212. /**
  213. * 日志 xtype 记录 (lsit1000)
  214. * @param type $type
  215. * @return string
  216. */
  217. public static function log_x($type) {
  218. $typename = strval(new enum_LogLevel($type));
  219. return "log-" . $typename;
  220. }
  221. }