function getTemplateInfo()
 {
     header("Content-Type: text/plain; charset=UTF-8");
     jincimport('core.messagefactory');
     jincimport('utility.jsonresponse');
     $tem_id = JRequest::getInt('id', 0);
     $minstance = MessageFactory::getInstance();
     if (!($template = $minstance->loadTemplate($tem_id))) {
         $template = new MessageTemplate(0);
     }
     // Building JSON response
     $response = new JSONResponse();
     $response->set('subject', $template->get('subject'));
     $response->set('body', $template->get('body'));
     echo $response->toString();
 }
	/**
	 * 调用应用
	 * @return
	 */
	private static function _callApp()
	{
		$wxApp = C('WX_APP');

		if (! $wxApp) {
			self::_errorLog('WX_APP param is null');
			return false;
		}

		$execType = $wxApp['EXEC_TYPE'];
		$filePath = $wxApp['FILE_PATH'];
		$className = $wxApp['CLASS_NAME'];
		$methodName = $wxApp['METHOD_NAME'];
		$classType = $wxApp['CLASS_TYPE'];

		$return = false;

		switch ($execType) {
			//本地加载插件方式
			case 'local':
				if (! $filePath || ! $className || ! $methodName || ! $classType) {
					self::_errorLog('WX_APP param error:'.$filePath.'=='.$className.'=='.$methodName .'=='.$classType, $wxApp);
					return false;
				}
				if (! file_exists($filePath)) {
					self::_errorLog('WX_APP filePath error', $filePath);
					return false;
				}

				include_once $filePath;

				if (! class_exists($className, false) || ! method_exists($className, $methodName)) {
					self::_errorLog('class or method not exist');
					return false;
				}

				if ('instance' == $classType) {
					$obj = new $className();
					$return = $obj->$methodName(self::$_message, self::$_msgStr);
				} else if ('static' == $classType) {
					$return = call_user_func(array($className, $methodName), self::$_message, self::$_msgStr);
				}

				break;
			case 'http':
				if (strrpos($filePath, 'http://') === false || strrpos($filePath, 'https://') === false) {
					self::_errorLog('remote url error', $filePath);
					return false;
				}
				$return = self::_thirdApp($filePath, self::$_msgStr);
				break;
		}

		if (! $return) {
			return false;
		}

		if (isset($return['message_body']) && $return['message_body']) {
			$messageBody = $return['message_body'];
			if (! in_array($messageBody->type, self::$_noThreadMsgType)) {
				Logger::debug('需要API发送消息,非5秒响应');
			} else if($messageBody->transfer == 1) {						//做转发功能把原来的消息转到客服服务上
				include_once SUISHI_PHP_PATH . '/CPU/MessageTemplate.class.php';
				$messageBody->type = "transfer_customer_service";
				$messageXML = MessageTemplate::get(self::$_message->ent_weixin, $messageBody);
				Logger::info("echo message xml:", $messageXML);
				echo $messageXML;
			}else {
				include_once SUISHI_PHP_PATH . '/CPU/MessageTemplate.class.php';
				$messageXML = MessageTemplate::get(self::$_message->ent_weixin, $messageBody);
				Logger::info("echo message xml:", $messageXML);
				echo $messageXML;
			}
		}
	}