OpeCode.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. // <editor-fold defaultstate="collapsed" desc="反射方法">
  67. //
  68. /**
  69. * 依据opecode=> Proc模块名称
  70. * @param type $ope
  71. * @return string
  72. * @author gwang
  73. */
  74. public static function getProc($ope) {
  75. $r = new \ReflectionClass(__CLASS__); # 新建反射对象
  76. $procs = array_flip($r->getConstants()); # 提取操作码到数组中
  77. if (!isset($procs[$ope])) { # 找不到
  78. return 'err'; # 返回固定的字符串: err
  79. }
  80. return __NAMESPACE__ . '\\' . $procs[$ope] . 'Proc'; # 拼装处理模块的名称
  81. }
  82. // </editor-fold>
  83. }