OpeCode.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. const Guild = 610;
  52. /**
  53. * 排行榜功能
  54. */
  55. const Rank = 611;
  56. /**
  57. * 事件功能
  58. */
  59. const Event = 612;
  60. //
  61. //
  62. // <editor-fold defaultstate="collapsed" desc="反射方法">
  63. //
  64. /**
  65. * 依据opecode=> Proc模块名称
  66. * @param type $ope
  67. * @return string
  68. * @author gwang
  69. */
  70. public static function getProc($ope) {
  71. $r = new \ReflectionClass(__CLASS__); # 新建反射对象
  72. $procs = array_flip($r->getConstants()); # 提取操作码到数组中
  73. if (!isset($procs[$ope])) { # 找不到
  74. return 'err'; # 返回固定的字符串: err
  75. }
  76. return __NAMESPACE__ . '\\' . $procs[$ope] . 'Proc'; # 拼装处理模块的名称
  77. }
  78. // </editor-fold>
  79. }