示例#1
0
 public function execute()
 {
     //1. check if user is login as needed
     $arrUserinfo = Saf_SmartMain::getUserInfo();
     if (empty($arrUserinfo)) {
         //ouput error
     }
     //2. get and validate input params
     $arrRequest = Saf_SmartMain::getCgi();
     $arrInput = $arrRequest['get'];
     if (!isset($arrInput['id'])) {
         //output error
     }
     Bd_Log::debug('request input', 0, $arrInput);
     //3. call PageService
     $objServicePageSample = new Service_Page_Sample();
     $arrPageInfo = $objServicePageSample->execute($arrInput);
     //4. chage data to out format
     $arrOutput = $arrPageInfo;
     //5. build page
     // smarty模板,以下渲染模板的代码依赖于提供一个tpl模板
     //$tpl = Bd_TplFactory::getInstance();
     //$tpl->assign($arrOutput);
     //$tpl->display('en/newapp/index.tpl');
     //这里直接输出,作为示例
     $strOut = $arrOutput['data'];
     echo $strOut;
     //notice日志信息打印,只需要添加日志信息,saf会自动打一条log
     Bd_Log::addNotice('out', $arrOutput);
 }
示例#2
0
 public function execute($arrInput)
 {
     Bd_Log::debug('sample page service called');
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $intId = intval($arrInput['id']);
         if ($intId <= 0) {
             //参数错误的时候,从配置文件取消息
             $strData = Bd_Conf::getAppConf('sample/msg');
             $arrResult['data'] = $strData;
         } else {
             if ($this->objServiceDataSample->isExist($intId)) {
                 //以下获取数据的方式提供3种示例,3选1
                 //1. 调用本地DS
                 $strData = $this->objServiceDataSample->getSample($intId);
                 //2. 子系统交互, 注意:请确保conf/saf.conf中的api_lib配置成Navi, 否则会出错
                 //$strData = $this->objServiceDataSample->callOtherApp($intId);
                 //3. 调用本地库
                 //$objUtil = new App2_Util();
                 //$strData = $objUtil->getUtilMsg();
                 $arrResult['data'] = $strData;
             } else {
                 $arrResult['errno'] = 222;
                 //示例错误码
             }
         }
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#3
0
文件: Post.php 项目: WayWingsDev/mis
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataMessage = new Service_Data_Message_V1_Message();
         $data['operation_title'] = $arrInput['operation_title'];
         $data['operation_content'] = $arrInput['operation_content'];
         $data['operation_link'] = $arrInput['operation_link'];
         $data['select_city'] = intval($arrInput['select_city']);
         if (isset($_FILES["operation_pic_address_vertical"])) {
             $ret = $this->objServiceDataMessage->uploadPic($_FILES["operation_pic_address_vertical"]);
             if (false === $ret) {
                 return Navilib_Utils::result(Navilib_CommonError::FAIL);
             }
             $data['operation_pic_address_vertical'] = $ret;
         }
         if (isset($_FILES["operation_pic_address_across"])) {
             $ret = $this->objServiceDataMessage->uploadPic($_FILES["operation_pic_address_across"]);
             if (false === $ret) {
                 return Navilib_Utils::result(Navilib_CommonError::FAIL);
             }
             $data['operation_pic_address_across'] = $ret;
         }
         $data['start_time'] = strtotime($arrInput['start_time']);
         $data['end_time'] = strtotime($arrInput['end_time']);
         $ret = $this->objServiceDataMessage->insert_operation_in_db($data);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#4
0
 public function invoke($arrInput)
 {
     try {
         $strAppName = $arrInput["appName"];
         $strActionName = $arrInput["actionName"];
         //获取所有模块的名称
         $strCurPath = dirname(__FILE__);
         $strParamConfName = "param_" . strtolower(str_replace("/", "_", $strActionName));
         $strParamConfPath = $strCurPath . "/../../../../../../conf/app/{$strAppName}/{$strParamConfName}.conf";
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         $arrRet["data"]["actionParamPath"] = $strParamConfPath;
         //解析参数
         $arrConf = Bd_Conf::getAppConf($strParamConfName, $strAppName);
         foreach ($arrConf as $strParamName => &$arrItem) {
             $arrItem['type'] = self::_getParamType(intval($arrItem['type']));
         }
         $arrRet["data"]["actionParamList"] = $arrConf;
         //解析注释
         if ($mixFileHandle = fopen($strParamConfPath, 'r+')) {
             while (!feof($mixFileHandle)) {
                 $strLine = trim(fgets($mixFileHandle));
                 if (preg_match(self::$regDescription, $strLine, $arrContent)) {
                     $arrRet["data"]['description'] = $arrContent[1];
                 }
                 if (preg_match(self::$regAuthor, $strLine, $arrContent)) {
                     $arrRet["data"]['author'] = $arrContent[1];
                 }
             }
         }
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#5
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataFeedback = new Service_Data_Feedback_V1_Feedback();
         if (empty($arrInput['os_version']) || !isset($arrInput['os_version']) || $arrInput['os_version'] == "all") {
             $arrInput['os_version'] = null;
         }
         if (empty($arrInput['app_version']) || !isset($arrInput['app_version']) || $arrInput['app_version'] == "all") {
             $arrInput['app_version'] = null;
         }
         if ((empty($arrInput['suggestion_type']) || !isset($arrInput['suggestion_type']) || $arrInput['suggestion_type'] == "all") && $arrInput['suggestion_type'] != '0') {
             $arrInput['suggestion_type'] = null;
         }
         if ($arrInput['appid'] == 'all') {
             $arrInput['appid'] = null;
         } else {
             $arrInput['appid'] = $arrInput['appid'] ? intval($arrInput['appid']) : 1;
         }
         $data['feedback_list'] = $this->objServiceDataFeedback->get_feedback_list_page(($arrInput['select_page'] - 1) * 30, 30, $arrInput['os_version'], $arrInput['app_version'], $arrInput['suggestion_type'], $arrInput['appid']);
         $data['feedback_list'] = $this->objServiceDataFeedback->change_type($data['feedback_list']);
         $data['total_page_count'] = ceil(intval($this->objServiceDataFeedback->get_feedback_list_page_count($arrInput['os_version'], $arrInput['app_version'], $arrInput['suggestion_type'])) / 30);
         $data['now_page'] = intval($arrInput['select_page']);
         $data['page_list'] = $this->form_page_list($data['now_page'], $data['total_page_count']);
         $arrResult['data'] = $data;
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#6
0
 public function invoke($arrInput)
 {
     try {
         //获取所有模块的名称
         $strCurPath = dirname(__FILE__);
         $strAppPath = $strCurPath . "/../../../../../";
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         $arrRet["data"]["appPath"] = $strAppPath;
         if (is_dir($strAppPath)) {
             if ($objHandler = opendir($strAppPath)) {
                 while (($strFile = readdir($objHandler)) !== false) {
                     //只需要遍历出第一层目录
                     if (is_dir($strAppPath . "/" . $strFile) && $strFile != "." && $strFile != "..") {
                         $arrRet["data"]["appList"][] = $strFile;
                     }
                 }
                 closedir($objHandler);
             }
         }
         sort($arrRet["data"]["appList"]);
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#7
0
文件: Util.php 项目: WayWingsDev/mis
 public static function postData($url, $postData, $headers, $timeout = 4)
 {
     $ch = curl_init($url);
     //创建CURL对象
     curl_setopt($ch, CURLOPT_HEADER, 0);
     //返回头部
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     //返回信息
     curl_setopt($ch, CURLOPT_POST, 1);
     //设置POST提交
     curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
     //提交POST数据
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
     curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
     if (!empty($headers)) {
         curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     }
     $res = curl_exec($ch);
     //执行已经定义的设置
     // 加curl状态判断逻辑
     if (empty($res)) {
         $errno = curl_errno($ch);
         $error = curl_error($ch);
         $curl_info = json_encode(curl_getinfo($ch));
         Bd_Log::warning(sprintf("Error[postData] Message[%s] Error[%s] Errno[%d]", $curl_info, $error, $errno));
     }
     curl_close($ch);
     //关闭
     return $res;
 }
示例#8
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     //用于登录
     try {
         $this->objServiceDataMessage = new Service_Data_Message_V2_Message();
         $messageTypeDataService = new Service_Data_Message_V2_MessageType();
         $type_list = $messageTypeDataService->getList(100);
         //大于100的运营消息
         $data = $this->objServiceDataMessage->get_operation_message_details($arrInput['id']);
         $arrResult['data'] = $data[0];
         $arrResult['type_list'] = $type_list;
         $opt = $data[0]['opt'] ? json_decode($data[0]['opt'], true) : array();
         $arrResult['data']['opt'] = $opt;
         $linkInfo['id'] = $arrInput['id'];
         $linkInfo['type'] = $data[0]['type'];
         $linkInfo['origin'] = 'share';
         $arrResult['data']['articleLink'] = Net_Util::getMessageLink($linkInfo);
         $arrResult['data']['old_city_list'] = $opt['city_list'] ? json_encode($opt['city_list']) : '[]';
         $arrResult['data']['pic_cover'] = $arrResult['data']['pic_cover'] ? $arrResult['data']['pic_cover'] : $type_list[$arrResult['data']['type']]['pic_url'];
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#9
0
 public function invoke($arrInput)
 {
     try {
         $strUrlHost = $arrInput["urlHost"];
         $strAppName = $arrInput["appName"];
         self::$_strPath = $arrInput["urlPath"];
         $strActionName = $arrInput["actionName"];
         $strUrl = $strUrlHost . "/" . $strAppName . "/" . self::$_strPath;
         //获取所有模块的名称
         $strCurPath = dirname(__FILE__);
         $strParamConfName = "param_" . strtolower(str_replace("/", "_", $strActionName));
         $strTestConfName = "test_" . strtolower(str_replace("/", "_", $strActionName));
         $strParamConfPath = "conf/app/{$strAppName}/{$strParamConfName}.conf";
         $strTestConfPath = "conf/app/{$strAppName}/{$strTestConfName}.conf";
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         //解析参数配置
         $arrParamConf = Bd_Conf::getAppConf($strParamConfName, $strAppName);
         if (false === ($arrUrlParam = self::_getUrlParam($arrParamConf, $strParamConfPath, $strAppName))) {
             $arrRet['data']['testResult'] = self::$_strResult;
             return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
         }
         //var_dump($arrParamConf);
         //解析test配置
         $arrTestConf = Bd_Conf::getAppConf($strTestConfName, $strAppName);
         if (false === $arrTestConf) {
             self::_appendResult("测试配置文件" . $strTestConfPath . "不存在,将使用默认策略来进行测试", self::CONTENT_WARNING);
             //默认的配置是:call_type为post,errno为0
             $arrTestConf = array('call_type' => 'post', 'result' => array('errno' => 0));
         }
         if (isset($arrTestConf["call_type"])) {
             self::$_strCallType = strtolower($arrTestConf["call_type"]);
         }
         self::_appendResult("使用" . self::$_strCallType . "方式请求" . $strUrl . "?" . http_build_query($arrUrlParam));
         $strType = self::$_strCallType;
         if ("post" === self::$_strCallType) {
             $strType = true;
         } elseif ("get" === self::$_strCallType) {
             $strType = false;
         }
         //通过fetchurl访问url
         $str = Navilib_NetUtil::getUrlContent($strUrl, $arrUrlParam, $strType);
         $mixData = json_decode($str, true);
         //检查结果
         self::_checkTest($mixData, $arrTestConf["result"]);
         if (true === self::$_bolTestRet) {
             self::_appendResult("测试通过");
         } else {
             self::_appendResult("测试未通过", self::CONTENT_FATAL);
         }
         $arrRet['data']['testResult'] = self::$_strResult;
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#10
0
文件: Mis.php 项目: WayWingsDev/mis
 public function getRecode($strUname, $strUrlKeyWord, $intOffset, $intLimit)
 {
     $field = array("uname", "url_host", "app_name", "action_info", "call_type", "param", "url", "op_time");
     $conds = array("uname = " => $strUname, "url like" => "%{$strUrlKeyWord}%");
     $appends = array("order by op_time desc limit {$intOffset}, {$intLimit}");
     $ret = $this->proxy->select(self::TABLE_TESTMAN_RECODE, $field, $conds, $option, $appends);
     if (false === $ret) {
         Bd_Log::fatal("Mysql query failed in " . __FUNCTION__);
         return Navilib_Utils::result(Navilib_CommonError::MYSQL_QUERY_FAILED);
     }
     return Navilib_Utils::result(Navilib_CommonError::SUCCESS, $ret);
 }
示例#11
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $data = Service_Data_Track_V1_TrackNew::get_track_list($this->form_param($arrInput));
         $arrResult['data'] = $this->form_return($data);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#12
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataMessage = new Service_Data_Message_V1_Message();
         $this->objServiceDataMessage->update_operation_message($arrInput);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#13
0
 public function invoke($arrInput)
 {
     try {
         $objDataService = new Service_Data_Testman();
         $strUrlHost = trim($arrInput["urlHost"]);
         $strProxyHost = $objDataService->replaceOnlineHost($strUrlHost);
         $arrRet = array("errno" => Navilib_CommonError::SUCCESS, "data" => array("urlHost" => $strUrlHost, "appName" => trim($arrInput["appName"]), "proxyHost" => $strProxyHost));
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#14
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $data = $this->objServiceDataTrack->get_other_version();
         $arrResult['data'] = $this->form_return($data);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#15
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $track_details = json_decode(urldecode($arrInput['all_data']), true);
         $data = $this->objServiceDataTrack->get_track_details($this->form_param($track_details));
         $arrResult['data'] = $this->form_return($data, $track_details);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#16
0
 public function invoke($arrInput)
 {
     try {
         $strUrlKeyWord = $arrInput["urlKeyWord"];
         $intOffset = intval($arrInput["offset"]);
         $intLimit = intval($arrInput["limit"]);
         $objDataService = new Service_Data_Testman();
         $arrRet = $objDataService->getRecode(CURRENT_USER, $strUrlKeyWord, $intOffset, $intLimit);
         return Navilib_Utils::result($arrRet["errno"], $arrRet['data']);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#17
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataMessage = new Service_Data_Message_V1_Message();
         $data = $this->objServiceDataMessage->get_operation_message_details($arrInput['id']);
         $arrResult['data'] = $this->form_return($data[0]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#18
0
 public function actionStartUp()
 {
     //启动OMP
     $objOmp = new Bd_Omp();
     $objOmp->start();
     $uid = 0;
     $arrUserInfo = Saf_Action_SessionAction::getUserInfo();
     if (is_array($arrUserInfo) && isset($arrUserInfo['uid'])) {
         $uid = intval($arrUserInfo['uid']);
     }
     //uid字段是omp字段,wf和notice日志都需要打印
     Bd_Log::addNotice('uid', $uid);
     Saf_Action_PublicAction::setPublic(array('omp' => $objOmp));
 }
示例#19
0
 public function invoke($arrInput)
 {
     try {
         $strSignCode = $arrInput["signCodeForCreateSign"];
         $objDataService = new Service_Data_Testman();
         $strSign = $objDataService->createSign($strSignCode, $_POST, $_FILES);
         //开始生成签名
         $arrRet = array("errno" => Navilib_CommonError::SUCCESS, "data" => $strSign);
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#20
0
 protected function invoke($arrInput)
 {
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataFeedback = new Service_Data_Feedback_V1_Feedback();
         $data = $this->objServiceDataFeedback->change_type($this->objServiceDataFeedback->get_feedback_details($arrInput));
         $arrResult['data'] = $data[0];
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#21
0
 /**
  * @brief 魔术方法,负责调用$this->decorateClass->$func()
  *
  * @param  $func 用户传入的函数名
  * @param  $args传递给$func函数的参数
  * @return $func对应方法的返回结果
  * @retval $func对应函数的返回值类型
  * @note   此方法自动调用
  * @author chenyijie
  * @date 2012/07/10 14:33:59
  **/
 public function __call($func, $args)
 {
     $checkFunction = array($this->objClass, $func);
     $callable = is_callable($checkFunction);
     if ($callable === false) {
         $arrErr = array('caller' => 'CacheProxy', 'class' => get_class($this->objClass), 'function' => $func);
         Bd_Log::warning("The Function can not be called", 1, $arrErr);
         if ($func === 'ut') {
             //为了单测
             return false;
         }
         trigger_error("The Function can not be called", E_USER_WARNING);
     }
     $result = call_user_func_array(array($this->decorateClass, $func), $args);
     return $result;
 }
示例#22
0
 public function invoke($arrInput)
 {
     try {
         $strAppName = $arrInput["appName"];
         //获取所有模块的名称
         $strCurPath = dirname(__FILE__);
         $strDataPath = $strCurPath . "/../../../../../{$strAppName}/models/service/data";
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         $arrRet["data"]["dataPath"] = $strDataPath;
         self::_iterDir($strDataPath, $arrRet);
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#23
0
 public function invoke($arrInput)
 {
     try {
         $strUrlHost = $arrInput["urlHostForCurlProxy"];
         $strAppName = $arrInput["appNameForCurlProxy"];
         $strActionInfo = $arrInput["actionInfoForCurlProxy"];
         $strCallType = $arrInput["callTypeForCurlProxy"];
         $arrParamType = json_decode($arrInput["paramTypeForCurlProxy"]);
         $arrUrlParam = array();
         //解析出待发起请求的所有参数
         foreach ($arrParamType as $strParamName => $strType) {
             $arrUrlParam[$strParamName]["type"] = $strType;
             if ("file" !== $strType) {
                 $arrUrlParam[$strParamName]["value"] = $_POST[$strParamName];
             } else {
                 $arrUrlParam[$strParamName]["value"] = "";
             }
         }
         /*foreach ($_POST as $strKey => $strVal) {
         		if($strKey !== 'urlHostForCurlProxy' &&
         			$strKey !== 'appNameForCurlProxy' &&
         			$strKey !== 'actionInfoForCurlProxy' &&
         			$strKey !== 'callTypeForCurlProxy' &&
         			$strKey !== 'paramTypeForCurlProxy' &&
         			$strKey !== 'signCodeForCreateSign') {
             		$arrUrlParam[$strKey] = $strVal;
         		}
             }
             foreach ($_FILES as $strKey => $arrItem) {
             	$arrUrlParam[$strKey] = '@upload_file';
             }*/
         //没有对应的用户,直接退出
         if (strlen(CURRENT_USER) <= 0) {
             Bd_Log::warning("username is null");
             return Navilib_Utils::result(Navilib_CommonError::USER_NOT_LOGIN, array());
         }
         $objDataService = new Service_Data_Testman();
         $arrRet = $objDataService->addRecode(CURRENT_USER, $strUrlHost, $strAppName, $strActionInfo, $strCallType, $arrUrlParam);
         return Navilib_Utils::result($arrRet["errno"], array());
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#24
0
 /**
  * @brief 全局初始化接口
  *
  * @return  success-true failed-false 
  * @retval  boolean
  * @see getCasInit()
  * @note 这个函数修改了session的存储文件路径为/odp/data/phpcas,并关闭了phpCAS第三方库本身的日志
  * @note 在一个CGI中phpCAS client对象只能被初始化一次,因此设置$isCasClientInit属性用来控制
  * @author chenyijie
  * @date 2012/09/28 22:28:43
  **/
 private static function init()
 {
     if (self::$isCasClientInit) {
         return true;
     }
     if (!self::getCasInit()) {
         Bd_Log::warning('UUAP CAS protocol init failed');
         return false;
     }
     $link = self::$arrConf['Server'][0]['Hostname'];
     $port = self::$arrConf['DefaultPort'];
     phpCAS::setDebug('');
     phpCAS::client(CAS_VERSION_2_0, $link, intval($port), '', false);
     // 自己管理session,最后参数为false by yuliang
     phpCAS::setNoCasServerValidation();
     phpCAS::handleLogoutRequests(false);
     self::$isCasClientInit = true;
     return true;
 }
示例#25
0
文件: View.php 项目: WayWingsDev/mis
 protected function invoke($arrInput)
 {
     //用于登录
     $arrResult = array();
     $arrResult['errno'] = 0;
     try {
         $this->objServiceDataMessage = new Service_Data_Message_V1_Message();
         $data['operation_message_list'] = $this->objServiceDataMessage->get_operation_list_page();
         if (empty($data['operation_message_list'])) {
             unset($data['operation_message_list']);
         }
         $data['user_name'] = mb_strtoupper($this->user_name);
         $arrResult['data'] = $data;
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         $arrResult['errno'] = $e->getCode();
     }
     return $arrResult;
 }
示例#26
0
 public static function ext($name, $block = 'flags')
 {
     if (self::$_config === null) {
         self::_init();
     }
     $flag = self::$_config[$block][$name];
     $out = array();
     if (is_array($flag)) {
         $preg = "/\\+\\d\\d:\\d\\d\$/";
         $start = strtotime($flag['start']);
         $end = strtotime($flag['end']);
         if (false !== $start && false !== $end && preg_match($preg, $flag['start']) == 1 && preg_match($preg, $flag['end']) == 1) {
             $out = array('start' => $start, 'end' => $end);
         } else {
             Bd_Log::warning('feature config is invalid');
         }
     }
     return $out;
 }
示例#27
0
 /**
  * @brief 此接口用于产生CacheCline实例并返回已有的CacheClient实例
  *
  * @return  success-CacheClient实例 failed-false
  * @retval  object/boolean 
  * @author chenyijie
  * @date 2012/07/09 13:36:23
  **/
 public static function getInstance()
 {
     if (!empty(self::$instance)) {
         return self::$instance;
     }
     $cacheClientClass = Bd_Conf::getConf('cacheproxy/which_cache_client');
     if ($cacheClientClass === false) {
         Bd_Log::warning("The ClientClass which you set in the cache.conf file does not exist");
         return false;
     }
     $cacheStr = 'Saf_Cache_Client_' . $cacheClientClass;
     if (!class_exists($cacheStr)) {
         Bd_Log::warning("The ClientClass which you set in the cache.conf file does not exist");
         return false;
     }
     $cacheObj = new $cacheStr();
     self::$instance = $cacheObj->create();
     return self::$instance;
 }
示例#28
0
 public function invoke($arrInput)
 {
     try {
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         //获取历史记录
         $objDataService = new Service_Data_Testman();
         $arrRecode = $objDataService->getRecode(CURRENT_USER, "", 0, 50);
         $arrRet['data'] = $arrRecode['data'];
         //常用域名:0表示线下域名,1表示线上域名
         $arrRet["data"]["freqDomain"] = $objDataService->getFreqDomain();
         ksort($arrRet["data"]["freqDomain"]);
         //常用模块
         $arrRet["data"]["freqModule"] = array("ucenter");
         sort($arrRet["data"]["freqModule"]);
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#29
0
 public function invoke($arrInput)
 {
     try {
         $strUrl = $arrInput["url"];
         $strCallType = $arrInput["callType"];
         $strUrlParam = $arrInput["urlParam"];
         $arrUrlParam = json_decode($strUrlParam, true);
         $arrUrlParam["ignoreLogin"] = 1;
         $arrRet["errno"] = Navilib_CommonError::SUCCESS;
         $strType = "post" === $strCallType ? true : false;
         //通过fetchurl访问url
         $str = Navilib_NetUtil::getUrlContent($strUrl, $arrUrlParam, $strType);
         $mixData = json_decode($str, true);
         $arrRet["data"] = $mixData;
         return Navilib_Utils::result($arrRet["errno"], $arrRet["data"]);
     } catch (Exception $e) {
         Bd_Log::warning($e->getMessage(), $e->getCode());
         return Navilib_Utils::result($e->getCode(), array());
     }
 }
示例#30
0
 public function callOtherApp($intId)
 {
     //跨子系统调用,这里调用自己作为示例
     $arrRet = Saf_Api_Server::call('feedbackAdmin', 'getSample', array('id' => $intId), null, null);
     if (false === $arrRet) {
         //异常逻辑处理
         $arrErrorCodes = Saf_Api_Server::getLastError();
         $arrErrNo = array_keys($arrErrorCodes);
         $intErrNo = $arrErrNo[0];
         $strErrMsg = $arrErrorCodes[$intErrNo];
         if ($intErrNo == Saf_Api_Server::METHOD_FAILED) {
             $intErrNo = Saf_Api_Server::getServiceError();
         }
         Bd_Log::warning($strErrMsg, $intErrNo, $arrParams);
         return false;
     } else {
         //获取数据成功,正常逻辑处理
         return $arrRet['data'];
     }
 }