Example #1
0
 public function execute()
 {
     $arrRequest = Saf_SmartMain::getCgi();
     $arrInput = $arrRequest["get"];
     $pageService = new Service_Page_Apiplatform_TestAction("param_apiplatform_testaction");
     $ret = $pageService->execute($arrInput);
     Navilib_View::output($ret, Navilib_View::JSON);
     Navilib_LogHook::addNotice('err_no', $ret["errno"]);
 }
Example #2
0
 private function _handleParamNeedSign(&$arrUrlParam)
 {
     self::$_objDataService = new Service_Data_Testman();
     foreach ($arrUrlParam as $strParamName => $strVal) {
         //如果是上传文件类型的参数
         if (0 === strpos($strVal, "@")) {
             $strFile = substr($strVal, 1);
             self::$_arrFile[$strParamName]['tmp_name'] = $strFile;
         }
     }
     $arrParamList = array_keys(self::$_arrParamNeedSign);
     foreach (self::$_arrParamNeedSign as $strParamName => $strSignCode) {
         $arrRely = self::$_objDataService->getRelyParam($strSignCode);
         //找出依赖于其他签名参数的签名参数,保存在self::$_arrParamHasRely中
         foreach ($arrRely as $strRelyParam) {
             if (in_array($strRelyParam, $arrParamList)) {
                 //如果发现a依赖于b且b也依赖于a,无法进行签名,直接返回false
                 if (in_array($strParamName, self::$_arrParamHasRely[$strRelyParam])) {
                     self::_appendResult("参数" . $strParamName . "和" . $strRelyParam . "的create_sign_code相互依赖,无法进行签名,不能进行回归测试", self::CONTENT_FATAL);
                     return false;
                 }
                 self::$_arrParamHasRely[$strParamName][] = $strRelyParam;
             }
         }
         //如果签名参数不依赖于其他签名参数,直接计算出签名
         if (!isset(self::$_arrParamHasRely)) {
             $strSign = self::$_objDataService->createSign($strSignCode, $arrUrlParam, self::$_arrFile);
             $arrUrlParam[$strParamName] = $strSign;
         }
     }
     if (count(self::$_arrParamHasRely) > 0) {
         foreach (self::$_arrParamHasRely as $strParamName => $arrRelyParam) {
             if (isset(self::$_arrParamHasRely[$strParamName])) {
                 self::_dftRelyParam($strParamName, $arrUrlParam);
             }
         }
     }
     return true;
 }