MemKey_GameRun.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. // <editor-fold defaultstate="collapsed" desc="英雄">
  13. /**
  14. * 运行时数据 - 英雄评价内容
  15. * @param type $heroId
  16. * @return string
  17. */
  18. public static function HeroDiscusses_item_hash($heroId) {
  19. return "gamerun-herodiscuss-$heroId-item";
  20. }
  21. /**
  22. * 运行时数据 - 英雄评价内容的评分
  23. * @param int $heroId
  24. * @return string
  25. */
  26. public static function HeroDiscusses_score_zset($heroId) {
  27. return "gamerun-herodiscuss-$heroId-score";
  28. }
  29. /**
  30. * 运行时数据 - 英雄评价 - 玩家给英雄打分
  31. * @param int $heroId
  32. * @return string
  33. */
  34. public static function HeroDiscusses_userScore_normal($heroId) {
  35. return "gamerun-herodiscuss-$heroId-userscore";
  36. }
  37. // </editor-fold>
  38. /**
  39. * 运行时数据 - 订单编号 - 当前秒内的订单序号
  40. * @return type
  41. */
  42. public static function Game_OrderID_normal_int() {
  43. return "gamerun-orderId-" . now();
  44. }
  45. /**
  46. * 运行时数据 - 玩家记录集
  47. * @param int $zoneid 分区id
  48. * @param int $day tsDay
  49. * @return string
  50. */
  51. public static function Game_UserRecordByZone($zoneid, $day) {
  52. return "gamerun-dailyUserRecord-$day-zone$zoneid";
  53. }
  54. /**
  55. * 运行时数据 - 系统消息
  56. * @param int $zoneid
  57. * @return string
  58. */
  59. public static function Game_SysMsgByZone_zset($zoneid) {
  60. return "gamerun-sysmsg-zone$zoneid";
  61. }
  62. // <editor-fold defaultstate="collapsed" desc=" 竞技场 ">
  63. /**
  64. * 运行时数据 - 竞技场 实时积分榜(总榜)
  65. * @param int $zoneid 分区id
  66. * @param int $season 赛季
  67. * @return string
  68. */
  69. public static function Game_PVPScoreByZoneSeason_zset($zoneid, $season) {
  70. return "gamerun-pvpScore-zone$zoneid-season$season";
  71. }
  72. /**
  73. * 运行时数据 - 竞技场 积分榜(某天)
  74. * 业务逻辑: 查询下昨天的榜, 根据榜单发放奖励
  75. * @param int $zoneid
  76. * @param int $day 天
  77. * @return string
  78. */
  79. public static function Game_PVPScoreByZone_zset_Day($zoneid, $day) {
  80. return "gamerun-pvpScore-zone$zoneid-day$day";
  81. }
  82. // /**
  83. // * 运行时数据 - pvp积分榜(上周)
  84. // * 当前和上周都是作为总榜的记录存在,
  85. // * @param int $zoneid
  86. // * @return string
  87. // */
  88. // public static function Game_PVPScoreByZone_zset_lastWeek($zoneid) {
  89. // $week = TimeUtil::tsWeek() - 1;
  90. // return "gamerun-pvpScore-zone$zoneid-$week";
  91. // }
  92. // /**
  93. // * 运行时数据 - pvp 每周排行榜发放记录 [tsweek,...]
  94. // * @param int $zoneid
  95. // * @return string
  96. // */
  97. // public static function Game_PVPRankRewardRecord_set($zoneid) {
  98. // return "gamerun-pvpRewardRecord-zone$zoneid";
  99. // }
  100. //
  101. // /**
  102. // * 运行时数据 - pvp 每周领取排行榜奖励的玩家记录 [tsweek,...]
  103. // * @param int $zoneid
  104. // * @param int $tsweek Description
  105. // * @return string
  106. // */
  107. // public static function Game_PVPRankRewardRecord_byWeek_str($zoneid, $tsweek) {
  108. // return "gamerun-pvpRewardRecord-zone$zoneid-$tsweek";
  109. // }
  110. // </editor-fold>
  111. //
  112. // <editor-fold defaultstate="collapsed" desc=" 排行榜相关 ">
  113. //
  114. /**
  115. * 运行时数据 - 战斗力总榜
  116. * @param type $zoneid
  117. */
  118. public static function Game_FightPowerRank_zset($zoneid) {
  119. return "gamerun-rank-fpower-zone$zoneid";
  120. }
  121. /**
  122. * 运行时数据 - 战力突破记录
  123. * @param int $zoneid
  124. * @return type
  125. */
  126. public static function Game_Rank_FPowerBreakLog_hash($zoneid) {
  127. return "gamerun-rank-fpower-breaklog-zone$zoneid";
  128. }
  129. /**
  130. * 运行时数据 - 通关榜
  131. * @param type $zoneid
  132. * @return type
  133. */
  134. public static function Game_Rank_passgate_zset($zoneid) {
  135. return "gamerun-rank-passgate-zone$zoneid";
  136. }
  137. /**
  138. * 运行时数据 - 通关人数统计(达到100W人以后溢出)
  139. * {
  140. * 33=>99, (每一关从0增加到100W,统计100W个人以后溢出)
  141. * 32=>87,
  142. * }
  143. * @param type $zoneid
  144. * @return type
  145. */
  146. public static function Game_Rank_passgate_count_hash($zoneid) {
  147. return "gamerun-rank-passgate-count-zone$zoneid";
  148. }
  149. /**
  150. * 运行时数据 - 通关帮突破记录
  151. * @param type $zoneid
  152. * @return type
  153. */
  154. public static function Game_Rank_passage_BreachLog_hash($zoneid) {
  155. return "gamerun-rank-passgate-breaklog-zone$zoneid";
  156. }
  157. // </editor-fold>
  158. //
  159. /**
  160. * 运行时数据 - 每天的登录用户记录-byUId
  161. * @param type $zoneid
  162. * @param type $tsDay
  163. * @return type
  164. */
  165. static function DailyLoginUser_byUID_hash($zoneid, $tsDay = null) {
  166. if (!$tsDay) { # 检查是否默认参数
  167. $tsDay = tsDay();
  168. }
  169. return "gamerun-loginUser-byUid-zone$zoneid-day_$tsDay";
  170. }
  171. /**
  172. * 运行时数据 - 每天的登录用户记录-byLevel
  173. * @param type $zoneid
  174. * @param int $level 玩家等级
  175. * @param type $tsDay
  176. * @return type
  177. */
  178. static function DailyLoginUser_byLevel_hash($zoneid, $level, $tsDay = null) {
  179. if (!$tsDay) { # 检查是否默认参数
  180. $tsDay = tsDay();
  181. }
  182. return "gamerun-loginUser-byLevel-zone$zoneid-day_$tsDay-lvl_$level";
  183. }
  184. // ------ 统计分析 数据 ↓ ----
  185. // <editor-fold defaultstate="collapsed" desc=" 统计分析数据">
  186. /**
  187. * 统计数据 - 用户总数量 (int)
  188. * @return string
  189. */
  190. public static function Stat_UserCountByZone_int($zoneid) {
  191. return "stat-totalUserNum-zone$zoneid";
  192. }
  193. // <editor-fold defaultstate="collapsed" desc="商城">
  194. /**
  195. * 统计数据 - 每日商品销量 (zset)
  196. * @param type $zoneid
  197. * @return string
  198. */
  199. public static function stat_daily_ShopSales_zset($zoneid, $tsday) {
  200. return "stat-daily-shopsales-zone$zoneid-$tsday";
  201. }
  202. /**
  203. * 统计数据 - 每周商品销量 (zset)
  204. * @param type $zoneid
  205. * @param type $tsweek
  206. * @return string
  207. */
  208. public static function stat_weekly_ShopSales_zset($zoneid, $tsweek) {
  209. return "stat-weekly-shopsales-zone$zoneid-$tsweek";
  210. }
  211. /**
  212. * 统计数据 - 每月商品销量 (zset)
  213. * @param type $zoneid
  214. * @param type $tsmonth
  215. * @return string
  216. */
  217. public static function stat_monthly_ShopSales_zset($zoneid, $tsmonth) {
  218. return "stat-monthly-shopsales-zone$zoneid-$tsmonth";
  219. }
  220. /**
  221. * 消费日志 - 普通商城消费记录 (list1000)
  222. * @param type $zoneid
  223. * @return type
  224. */
  225. public static function log_ShopSales_list($zoneid) {
  226. return "log-shopsales-zone$zoneid";
  227. }
  228. // </editor-fold>
  229. public static function stat_daily_secretshopSales_zset($zoneid, $tsday) {
  230. return "stat-daily-secretshopsales-zone$zoneid-$tsday";
  231. }
  232. public static function stat_weekly_secretshopSalse_zset($zoneid, $tsweek) {
  233. return "stat-weekly-secretshopsales-zone$zoneid-$tsweek";
  234. }
  235. public static function stat_monthly_secretshopSales_zset($zoneid, $tsMonth) {
  236. return "stat-monthly-secretshopsales-zone$zoneid-$tsMonth";
  237. }
  238. // </editor-fold>
  239. // <editor-fold defaultstate="collapsed" desc=" 日志 ">
  240. /**
  241. * 神秘商城 - 消费日志 ()list1000)
  242. * @param type $zoneid
  243. * @return string
  244. */
  245. public static function log_secretshopSales_list($zoneid) {
  246. return "log-secretshopsales-zone$zoneid";
  247. }
  248. /**
  249. * 日志 xtype 记录 (lsit1000)
  250. * @param type $type
  251. * @return string
  252. */
  253. public static function log_x($type) {
  254. $typename = strval(new enum_LogLevel($type));
  255. return "log-" . $typename;
  256. }
  257. // </editor-fold>
  258. }