MemKey_GameRun.php 7.0 KB

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