OpeCode.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 Rank = 611;
  40. /**
  41. * 战斗功能
  42. */
  43. const Fight = 606;
  44. /**
  45. * 商城功能
  46. */
  47. const Shop = 607;
  48. /**
  49. * 仓库功能
  50. */
  51. const Store = 608;
  52. /** 系统功能 */
  53. const System = 609;
  54. /** 公会 */
  55. const Guild = 610;
  56. //
  57. //
  58. // <editor-fold defaultstate="collapsed" desc="反射方法">
  59. //
  60. /**
  61. * 依据opecode=> Proc模块名称
  62. * @param type $ope
  63. * @return string
  64. * @author gwang
  65. */
  66. public static function getProc($ope) {
  67. $r = new \ReflectionClass(__CLASS__); # 新建反射对象
  68. $procs = array_flip($r->getConstants()); # 提取操作码到数组中
  69. if (!isset($procs[$ope])) { # 找不到
  70. return 'err'; # 返回固定的字符串: err
  71. }
  72. return __NAMESPACE__ . '\\' . $procs[$ope] . 'Proc'; # 拼装处理模块的名称
  73. }
  74. // </editor-fold>
  75. }