1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace loyalsoft;
- /**
- * 功能码常量定义, 要求: 常量名称和对应的功能处理模块的名称相一致(无需Proc后缀).
- * @author gwang
- */
- class OpeCode {
- /**
- * 支付功能
- */
- const Pay = 888;
- /**
- * 玩家主功能
- */
- const User = 600;
- /**
- * 好友功能
- */
- const Friend = 601;
- /**
- * 任务模块
- */
- const Task = 602;
- /**
- * 英雄功能
- */
- const Hero = 603;
- /**
- * 邮件功能
- */
- const Email = 604;
- /**
- * 活动功能
- */
- const Active = 605;
- /**
- * 战斗功能
- */
- const Fight = 606;
- /**
- * 商城功能
- */
- const Shop = 607;
- /**
- * 仓库功能
- */
- const Store = 608;
- /** 系统功能 */
- const System = 609;
- /** 公会 */
- const Guild = 610;
- /**
- * 排行榜功能
- */
- const Rank = 611;
- /**
- * 事件功能
- */
- const Event = 612;
- //
- //
- // <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>
- }
|