123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace loyalsoft;
- /**
- * 功能码常量定义, 要求: 常量名称和对应的功能处理模块的名称相一致(无需Proc后缀).
- * @version 2023.8.31 修改约定: cmdcode前两位为opecode. 参数传递过程中不单独传输opecode了.
- * @author gwang,cyzhao
- */
- class OpeCode {
- /**
- * 支付功能
- */
- const Pay = 88;
- /**
- * 玩家主功能
- */
- const User = 60;
- const Active = 61;
- const Task = 62;
- const Email = 63;
- const Store = 64;
- const Shop = 65;
- const Hero = 66;
- const Fight = 68;
- // <editor-fold defaultstate="collapsed" desc="反射方法">
- //
- /**
- * 依据opecode=> Proc模块名称
- * @param type $ope
- * @return string
- * @author gwang
- */
- public static function getProc($ope) {
- $r = new \ReflectionClass(__CLASS__); # 新建反射对象
- $procs = array_flip($r->getConstants()); # 提取操作码到数组中
- if (!isset($procs[$ope])) { # 找不到
- return 'err'; # 返回固定的字符串: err
- }
- return __NAMESPACE__ . '\\' . $procs[$ope] . 'Proc'; # 拼装处理模块的名称
- }
- // </editor-fold>
- }
|