OpeCode.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 功能码常量定义, 要求: 常量名称和对应的功能处理模块的名称相一致(无需Proc后缀).
  5. * @author gwang
  6. */
  7. class OpeCode {
  8. /**
  9. * 支付功能
  10. */
  11. const Pay = 888;
  12. /**
  13. * 玩家主功能
  14. */
  15. const User = 600;
  16. // /**
  17. // * 好友功能
  18. // */
  19. // const Friend = 601;
  20. /**
  21. * 任务模块
  22. */
  23. const Task = 602;
  24. /**
  25. * 英雄功能
  26. */
  27. const Hero = 603;
  28. /**
  29. * 邮件功能
  30. */
  31. const Email = 604;
  32. /**
  33. * 活动功能
  34. */
  35. const Active = 605;
  36. /**
  37. * 战斗功能
  38. */
  39. const Fight = 606;
  40. /**
  41. * 商城功能
  42. */
  43. const Shop = 607;
  44. /**
  45. * 仓库功能
  46. */
  47. const Store = 608;
  48. /** 系统功能 */
  49. const System = 609;
  50. /**
  51. * 排行榜功能
  52. */
  53. const Rank = 611;
  54. /**
  55. * 事件功能
  56. */
  57. const Event = 612;
  58. /**
  59. * 学院
  60. */
  61. const College = 613;
  62. /**
  63. * 公会功能
  64. */
  65. const Guild = 614;
  66. /**
  67. * 拍卖
  68. */
  69. const Auction = 615;
  70. /**
  71. * 地图
  72. */
  73. const Map = 616;
  74. // <editor-fold defaultstate="collapsed" desc="反射方法">
  75. //
  76. /**
  77. * 依据opecode=> Proc模块名称
  78. * @param type $ope
  79. * @return string
  80. * @author gwang
  81. */
  82. public static function getProc($ope) {
  83. $r = new \ReflectionClass(__CLASS__); # 新建反射对象
  84. $procs = array_flip($r->getConstants()); # 提取操作码到数组中
  85. if (!isset($procs[$ope])) { # 找不到
  86. return 'err'; # 返回固定的字符串: err
  87. }
  88. return __NAMESPACE__ . '\\' . $procs[$ope] . 'Proc'; # 拼装处理模块的名称
  89. }
  90. // </editor-fold>
  91. }