protected function invoke($amf_entry, $module, $action, $data, $lock_time = 60)
 {
     try {
         $start = microtime(true);
         $GLOBALS['uid'] = $data['uid'];
         $GLOBALS['gameuid'] = intval($data['gameuid']);
         if ($this->logger->isDebugEnabled()) {
             $this->logger->writeDebug($this->get_log_msg($data, "{$module}.{$action}", false));
         }
         $gameuid = intval($data['gameuid']);
         //锁定该动作
         $this->setLocker($gameuid, $action, $lock_time);
         // 执行动作
         $invoker = new ActionInvoker(APP_ROOT . '/libgame/actions/');
         $result = $invoker->invoke($module, $action, $data);
         if ($this->logger->isDebugEnabled()) {
             $this->logger->writeDebug($this->get_log_msg($result, "{$module}.{$action}", true));
         }
         // 释放锁
         $this->releaseLocker();
         if (get_app_config()->isPerfTestMode()) {
             $this->record_action($amf_entry, $start);
         }
     } catch (ConfigException $e) {
         $this->releaseLocker();
         error_log($e->getMessage() . "\n");
         return array('__code' => $e->getCode(), '__msg' => $e->getMessage());
     } catch (ActionException $e) {
         $this->releaseLocker();
         error_log($e->getMessage() . "\n");
         return array('__code' => $e->getCode(), '__msg' => $e->getMessage());
     } catch (Exception $e) {
         $this->releaseLocker();
         if (get_app_config()->isDebugMode()) {
             return array('__code' => $e->getCode(), '__msg' => $e->getMessage());
         } else {
             error_log($e->getMessage() . "\n");
             return array('__code' => 1, '__msg' => 'Unknown Error');
         }
     }
     return $result;
 }
 /**
  * API的主函数
  *
  */
 public function service()
 {
     // 验证必要的参数
     $this->validate();
     $format = getGPC('format', 'string');
     $this->setFormat($format);
     require_once FRAMEWORK . '/action/ActionInvoker.class.php';
     try {
         $invoker = new ActionInvoker($this->actionPath);
         $params = elex_addslashes($_REQUEST);
         $method = getGPC('method', 'string');
         $pos = strpos($method, '.');
         if ($pos === false) {
             $module = '';
             $action = $method;
         } else {
             $module = substr($method, 0, $pos);
             $action = substr($method, $pos + 1);
         }
         $result = $invoker->invoke($module, $action, $params);
         echo $this->getReturnResult($result, $this->format);
     } catch (Exception $e) {
         $this->errorMessage($e->getCode(), $e->getMessage());
     }
 }