当前位置: 首页>>代码示例>>PHP>>正文


PHP Util::getConf方法代码示例

本文整理汇总了PHP中Util::getConf方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getConf方法的具体用法?PHP Util::getConf怎么用?PHP Util::getConf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Util的用法示例。


在下文中一共展示了Util::getConf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrBitZoneConf = Util::getConf('/bitzone', 'BITZONE');
     $arrBitZoneConf = $this->analysisConf($arrBitZoneConf);
     if (empty($arrBitZoneConf)) {
         return false;
     }
     // 遍历获得asResult->item->0/1/..->urls->asurls->strategys中的标志位数组
     // 取得配置中各标志位在上述数组位置中的值
     // 将最终解析出来的标志位值加入asResult->item->0/1/..->dispData->strategybits中
     if (!empty($arrData['uiData']['asResult']['item']) && is_array($arrData['uiData']['asResult']['item'])) {
         foreach ($arrData['uiData']['asResult']['item'] as &$asResultItem) {
             $arrBitZoneInfo = array();
             if (!empty($asResultItem['urls']['asUrls']['strategys']) && is_array($asResultItem['urls']['asUrls']['strategys'])) {
                 foreach ($arrBitZoneConf as $strTipKey => $arrTipConfInfo) {
                     $strTipValue = '';
                     foreach ($arrTipConfInfo as $intSection => $arrPos) {
                         $intStrategySectionNum = intval($asResultItem['urls']['asUrls']['strategys'][$intSection]);
                         foreach ($arrPos as $intPos) {
                             $intTmp = ($intStrategySectionNum & pow(2, $intPos)) == 0 ? 0 : 1;
                             $strTipValue = $strTipValue === '' ? $intTmp : $strTipValue . $intTmp;
                         }
                     }
                     $arrBitZoneInfo[$strTipKey] = bindec($strTipValue);
                 }
             }
             $asResultItem['dispData']['strategybits'] = $arrBitZoneInfo;
         }
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:34,代码来源:BitZone.php

示例2: run

 public static function run(&$arrData)
 {
     if (empty($arrData)) {
         return false;
     }
     // 策略配置
     $arrStrategys = Util::getConf('/strategy', 'STRATEGY_ENGINE/STRATEGY');
     if (is_array($arrStrategys)) {
         foreach ($arrStrategys as $arrStrategy) {
             if (empty($arrStrategy['STRATEGY_CLASS'])) {
                 // 策略函数为空
                 continue;
             }
             if (strcasecmp($arrStrategy['TURN'], 'on') != 0) {
                 // 当前策略关闭
                 continue;
             }
             // 调用对应的策略
             $objStrategy = new $arrStrategy['STRATEGY_CLASS']();
             // file_put_contents ( '/home/work/search/view-ui/data/data_'.$arrStrategy ['STRATEGY_CLASS'], serialize($arrData) );
             // file_put_contents ( '/home/work/search/view-ui/data/data_'.$arrStrategy ['CONF'].'_conf', serialize($arrStrategy ['CONF']) );
             call_user_func_array(array($objStrategy, 'run'), array(&$arrData, $arrStrategy['CONF']));
             //file_put_contents ( '/home/work/search/view-ui/data/data_'.$arrStrategy ['STRATEGY_CLASS'].'_result', serialize($arrData) );
         }
     }
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:26,代码来源:StrategyEngine.php

示例3: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $ecResult = $arrData['uiData']['ecResult'];
     $arrTplConfs = Util::getConf('/tpl_style', 'STYLE_TEMPLATE');
     $ecResultItem = $arrData['uiData']['ecResult']['ecResultItem'];
     $resultArr = array();
     $tmpArr = array();
     foreach ($arrTplConfs as $key => $val) {
         $resultArr[$key]['result'] = $val['result'];
         $resultArr[$key]['tpl_style'] = $val['tpl_style'];
     }
     if (!empty($ecResultItem) && is_array($ecResultItem)) {
         foreach ($ecResultItem as $item) {
             if (is_array($item)) {
                 $src_id = 'SRCID_' . $item['id'];
                 if (!empty($arrTplConfs[$src_id]) && is_array($arrTplConfs[$src_id])) {
                     if (!isset($tmpArr[$arrTplConfs[$src_id]['result']])) {
                         $this->selectTplStyle($arrData, $item, $resultArr);
                         $tmpArr[$arrTplConfs[$src_id]['result']] = true;
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:29,代码来源:TplStyleSelect.php

示例4: getPreImageKey

 /**
  * type:0-读cache时   1-写cache时
  */
 public static function getPreImageKey($arrData, $arrConf, $type = 0)
 {
     $arrConf = Util::getConf('/image_predict', 'IMAGE_PREDICT');
     $queryInfo = $arrData['uiData']['queryInfo'];
     //临时硬编码:先上写时,读用旧的key
     $version = $type == 1 ? $arrConf['version'] : "0.1";
     $key = md5($queryInfo['queryWord'] . '+' . intval($queryInfo['pageNo']) . '+' . intval($queryInfo['resNum']) . '+' . $queryInfo['language'] . '+' . $arrData['uiControl']['platform'] . '+' . $arrData['uiControl']['templateType'] . '+' . $arrData['uiControl']['templateName'] . '+' . $version);
     return $key;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:12,代码来源:ImagePredict.php

示例5: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrFilterConfs = Util::getConf('/url_filter', 'URL_FILTER');
     if (!is_array($arrFilterConfs) || empty($arrFilterConfs)) {
         return false;
     }
     $arrResultUrls = array();
     // 查找对应资源
     foreach ($GLOBALS['RESULT'] as $res) {
         if (isset($arrFilterConfs[$res]) && !empty($arrFilterConfs[$res]['src_ids'])) {
             $arrFilterConfs[$res]['src_ids'] = explode(',', $arrFilterConfs[$res]['src_ids']);
             $arrFilterConfs[$res]['src_ids'] = array_flip($arrFilterConfs[$res]['src_ids']);
             foreach ($arrData['uiData'][$res]['item'] as $intIndex => $arrItem) {
                 if (isset($arrFilterConfs[$res]['src_ids'][$arrItem['dispData']['StdStg']])) {
                     $arrResultUrls[trim($arrItem['itemUrl'])] = trim($arrItem['itemUrl']);
                 }
             }
         }
     }
     // 对AS结果url去重
     $strResult = 'asResult';
     $intTotalCount = isset($arrFilterConfs['count']) ? intval($arrFilterConfs['count']) : 0;
     $intCurCount = 0;
     $intAs = 0;
     $intSp = 0;
     $strForLog = '';
     if (!empty($arrResultUrls) && is_array($arrData['uiData'][$strResult]['item']) && !empty($arrData['uiData'][$strResult]['item'])) {
         foreach ($arrData['uiData'][$strResult]['item'] as $intIndex => $arrItem) {
             if ($intTotalCount > 0 && $intCurCount >= $intTotalCount) {
                 break;
             }
             if (isset($arrResultUrls[trim($arrItem['offsetInfo']['url'])])) {
                 if ($arrItem['comeFrome'] == 'AS') {
                     $intAs++;
                 } else {
                     if ($arrItem['comeFrome'] == 'SP') {
                         $intSp++;
                     }
                 }
                 $intCurCount++;
                 unset($arrData['uiData'][$strResult]['item'][$intIndex]);
                 $strForLog = 'url_filter_asResult';
             }
         }
     }
     $arrData['uiData'][$strResult]['asResultNum'] = intval($arrData['uiData'][$strResult]['asResultNum']) - $intAs;
     $arrData['uiData'][$strResult]['spResutlNum'] = intval($arrData['uiData'][$strResult]['spResutlNum']) - $intSp;
     if (!empty($strForLog)) {
         $GLOBALS['logArr']['url_filter'] = $strForLog;
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:55,代码来源:UrlFilter.php

示例6: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrSids = array();
     $arrSample = Util::getConf('/sample_variable', 'sample_variable/FILTER_PROMPT');
     $filter_sample = array();
     $hint_sample = array();
     //获取过滤条件
     if (is_array($arrData['uiData']['queryInfo']['samplingId']) && !empty($arrData['uiData']['queryInfo']['samplingId']) && is_array($arrSample) && !empty($arrSample)) {
         $arrSids = $arrData['uiData']['queryInfo']['samplingId'];
         $arrSids = array_flip($arrSids);
         $filter_sample = $this->getFilterSampleVariables($arrSample, $arrSids);
         $hint_sample = $this->getHintSampleVariables($arrSample, $arrSids);
     }
     //过滤条件为空,直接返回
     if (empty($filter_sample) && empty($hint_sample)) {
         return true;
     }
     $arrPromtId = array();
     if (isset($arrData['uiData']['queryInfo']['promptNode']) && is_array($arrData['uiData']['queryInfo']['promptNode'])) {
         //通过过滤条件收集需要删除的提示
         foreach ($arrData['uiData']['queryInfo']['promptNode'] as $intKey => &$arrOnePromptNode) {
             if (!empty($arrOnePromptNode['promptContent'])) {
                 $arrPromptContent = json_decode($arrOnePromptNode['promptContent'], true);
                 $arrPositionTmp = array();
                 if (!empty($arrPromptContent['hints']) && is_array($arrPromptContent['hints'])) {
                     foreach ($arrPromptContent['hints'] as $strPosition => $arrOnePositionPromptContent) {
                         //首先按id过滤
                         if (!empty($hint_sample["prompt_id"]) && empty($hint_sample["prompt_id"][$arrOnePositionPromptContent[0]['id']])) {
                             $arrPromtId[] = $intKey;
                         }
                         //按模板过滤
                         if (empty($hint_sample["prompt_id"][$arrOnePositionPromptContent[0]['id']]) && !empty($filter_sample["template"][$arrOnePositionPromptContent[0]['templateName']])) {
                             $arrPromtId[] = $intKey;
                         }
                     }
                 }
             }
         }
         //删除对应的提示
         foreach ($arrPromtId as $key) {
             unset($arrData['uiData']['queryInfo']['promptNode'][$key]);
         }
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:48,代码来源:FilterPromptStrategy.php

示例7: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     //PP/PPIM是否存在
     $intPPFlag = 0;
     //右侧是否有品专/地标/知心
     $intPinzhuanFlag = 0;
     //是否存在右侧安全提示
     $intRightPromptFlag = 0;
     $bolFlagFeature = Util::getConf('/feature', 'FEATURE_LIST/ADLEVEL/TURN') === 'ON' ? true : false;
     if ($bolFlagFeature && isset($arrData['uiData']['ecResult']['adlevel'])) {
         $intPPFlag = $arrData['uiData']['ecResult']['adlevel'] & 0x1;
         $intPinzhuanFlag = $arrData['uiData']['ecResult']['adlevel'] >> 2 & 0x1;
     } else {
         $arrPPIds = array(EC_FC_PP, EC_FC_PPIM_UL);
         $arrPinzhuanIds = array(EC_PP_ZQ, EC_PP_QTZ, EC_PP_DB, EC_PP_DB_2);
         foreach ($arrData['uiData']['ecResult']['ecResultItem'] as $item) {
             if ($intPPFlag === 0 && in_array($item['id'], $arrPPIds)) {
                 $intPPFlag = 1;
             }
             if ($intPinzhuanFlag === 0 && in_array($item['id'], $arrPinzhuanIds)) {
                 $intPinzhuanFlag = 1;
             }
         }
     }
     if ($intPinzhuanFlag === 0) {
         $intPinzhuanFlag = empty($arrData['uiData']['rightResult']['item']) ? 0 : 1;
     }
     $intRightPromptFlag = $this->bolExistRightPrompt($arrData) ? 1 : 0;
     if ($intPPFlag === 1) {
         $arrPromptContent = array();
         //安全提示展现位置:RightTop-右上方  RightBottom-右下方
         $strPosition = $intRightPromptFlag === 1 ? 'RightTop' : ($intPinzhuanFlag === 1 ? 'RightBottom' : 'RightTop');
         $arrPositionContent = array();
         //安全提示展现是否的模板
         $arrPositionContent['templateName'] = 'hint_securityplan';
         //安全提示展现的样式:0-普通版  1-缩略版
         $arrPositionContent['style'] = $intRightPromptFlag === 1 ? 0 : ($intPinzhuanFlag === 1 ? 1 : 0);
         $arrPromptContent[$strPosition][] = $arrPositionContent;
         $arrData['uiData']['queryInfo']['promptNode'][] = array('id' => -1, 'promptContent' => json_encode(array('hints' => $arrPromptContent)));
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:45,代码来源:NewAdSecurityPlanTip.php

示例8: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrFilterConfs = Util::getConf('/tpl_filter', 'TEMPLATE_FILTER');
     if (!is_array($arrFilterConfs) || empty($arrFilterConfs) || empty($arrFilterConfs['result']) || empty($arrFilterConfs['template_name'])) {
         return false;
     }
     $arrResult = explode(',', $arrFilterConfs['result']);
     $arrResult = array_flip($arrResult);
     $arrTplNames = explode(',', $arrFilterConfs['template_name']);
     $arrTplNames = array_flip($arrTplNames);
     $intTotalCount = isset($arrFilterConfs['count']) ? intval($arrFilterConfs['count']) : 0;
     $intCurCount = 0;
     $bolFlag = false;
     // 过滤模板对应的单条结果
     $arrForLog = array();
     foreach ($GLOBALS['RESULT'] as $res) {
         if (isset($arrResult[$res]) && is_array($arrData['uiData'][$res]['item']) && !empty($arrData['uiData'][$res]['item'])) {
             // 处理每条结果
             foreach ($arrData['uiData'][$res]['item'] as $intIndex => $arrItem) {
                 if ($intTotalCount > 0 && $intCurCount >= $intTotalCount) {
                     $bolFlag = true;
                     break;
                 }
                 if (isset($arrTplNames[$arrItem['dispData']['strategy']['tempName']])) {
                     // 待补充日志
                     unset($arrData['uiData'][$res]['item'][$intIndex]);
                     $intCurCount++;
                     $strTemp = $arrItem['dispData']['strategy']['tempName'];
                     $arrForLog[$strTemp] = $strTemp;
                     unset($strTemp);
                 }
             }
         }
         if ($bolFlag === true) {
             break;
         }
     }
     if (!empty($arrForLog)) {
         $GLOBALS['logArr']['template_filter'] = implode(',', $arrForLog);
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:45,代码来源:TemplateFilter.php

示例9: aladdin_pk_siteHint

 /**
  * @desc 判断site语法提示是否需要避让site语法阿拉丁
  **/
 public function aladdin_pk_siteHint(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrAlaPkSiteHintConfs = Util::getConf('/aladdin_pk_siteHint', 'ALADDIN_PK_SITEHINT');
     if (!is_array($arrAlaPkSiteHintConfs) || empty($arrAlaPkSiteHintConfs)) {
         return false;
     }
     foreach ($GLOBALS['RESULT'] as $res) {
         if (isset($arrAlaPkSiteHintConfs[$res]) && !empty($arrAlaPkSiteHintConfs[$res]['src_ids'])) {
             $arrAlaPkSiteHintConfs[$res]['src_ids'] = explode(',', $arrAlaPkSiteHintConfs[$res]['src_ids']);
             foreach ($arrData['uiData'][$res]['item'] as $arrItem) {
                 if (in_array($arrItem['dispData']['StdStg'], $arrAlaPkSiteHintConfs[$res]['src_ids'])) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:24,代码来源:HintFlag.php

示例10: get_sample_variable

 /**
  *  根据采样ID返回采样结果
  *  @param array $arrData
  *  @param string $exp_name
  *
  * @return value 如果没有查到, 返回0
  */
 public function get_sample_variable($arrData, $exp_name)
 {
     $sample_variable = 0;
     //for small flow
     $arrSample = Util::getConf('/sample_variable', 'sample_variable/' . $exp_name);
     //判断arrData中是否存在samplingId
     if (is_array($arrData['uiData']['queryInfo']['samplingId']) && !empty($arrData['uiData']['queryInfo']['samplingId']) && is_array($arrSample) && !empty($arrSample)) {
         $arrSids = $arrData['uiData']['queryInfo']['samplingId'];
         $arrSids = array_flip($arrSids);
         //判断samplingId是否存在sampv_variable.conf中exp_name配置项内, 如果存在, 返回value。不存在, 返回0
         foreach ($arrSample['Contexted'] as $arrTemp) {
             if (isset($arrSids[$arrTemp['sampling_id']])) {
                 if ($arrTemp['value'] >= 1 && $arrTemp['value'] <= 10000) {
                     $sample_variable = $arrTemp['value'];
                     break;
                 }
             }
         }
     }
     return $sample_variable;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:28,代码来源:WomcEntranceFilter.php

示例11: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $tempNameInfo = Util::getConf('/tempname2stdstg', 'DispTempName');
     if (empty($tempNameInfo) || !is_array($tempNameInfo)) {
         return false;
     }
     $asResultItem =& $arrData['uiData']['asResult']['item'];
     foreach ($asResultItem as $key => &$item) {
         if ($item['comeFrome'] === 'AS') {
             if (!isset($item['dispData']['templateName']) || empty($item['dispData']['templateName'])) {
                 continue;
             }
             $templateName = $item['dispData']['templateName'];
             if (isset($tempNameInfo[$templateName]['stdstg']) && !empty($tempNameInfo[$templateName]['stdstg'])) {
                 $item['dispData']['StdStg_new'] = intval($tempNameInfo[$templateName]['stdstg']);
             }
         }
     }
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:22,代码来源:DispTempName2StdStg.php

示例12: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrDispConfs = Util::getConf('/advertise', 'DISP_STRATEGY');
     $arrProductConfs = isset($arrDispConfs['PRODUCT']) ? $arrDispConfs['PRODUCT'] : array();
     $arrGeneralConfs = isset($arrDispConfs['GENERAL']) ? $arrDispConfs['GENERAL'] : array();
     $arrFilterConfs = isset($arrDispConfs['FILTER']) ? $arrDispConfs['FILTER'] : array();
     $arrSampleConfs = isset($arrDispConfs['SAMPLE']) ? $arrDispConfs['SAMPLE'] : array();
     // 抽样流量策略
     $bolSampleFlag = false;
     $strEcResultKey = 'ecResult';
     $arrLogZhiIds = array();
     if (isset($arrFilterConfs['sample_ids']) && !empty($arrFilterConfs['sample_ids']) && is_array($arrSampleConfs['EC']) && !empty($arrSampleConfs['EC'])) {
         $arrFilterConfs['sample_ids'] = explode(',', $arrFilterConfs['sample_ids']);
         $arrFilterConfs['sample_ids'] = array_flip($arrFilterConfs['sample_ids']);
         $bolSampleExist = false;
         if (is_array($arrData['uiData']['queryInfo']['samplingId']) && !empty($arrData['uiData']['queryInfo']['samplingId'])) {
             foreach ($arrData['uiData']['queryInfo']['samplingId'] as $intSamId) {
                 if (isset($arrFilterConfs['sample_ids'][$intSamId])) {
                     $bolSampleExist = true;
                     break;
                 }
             }
         }
         if ($bolSampleExist === true && is_array($arrData['uiData'][$strEcResultKey]['ecResultItem']) && !empty($arrData['uiData'][$strEcResultKey]['ecResultItem'])) {
             // 遍历广告队列结果
             foreach ($arrData['uiData'][$strEcResultKey]['ecResultItem'] as $intEcIndex => $arrEcItem) {
                 if (isset($arrSampleConfs['EC'][$arrEcItem['id']])) {
                     $bolSampleFlag = true;
                     $arrTempConfs = $arrSampleConfs['EC'][$arrEcItem['id']];
                     foreach ($arrTempConfs as $intSrcIndex => $arrSrcInfo) {
                         // check抽样id
                         if (isset($arrSrcInfo['sample_ids']) && !empty($arrSrcInfo['sample_ids'])) {
                             $arrSrcInfo['sample_ids'] = explode(',', $arrSrcInfo['sample_ids']);
                             $arrSrcInfo['sample_ids'] = array_flip($arrSrcInfo['sample_ids']);
                             $bolSampleExist = false;
                             if (is_array($arrData['uiData']['queryInfo']['samplingId']) && !empty($arrData['uiData']['queryInfo']['samplingId'])) {
                                 foreach ($arrData['uiData']['queryInfo']['samplingId'] as $intSamId) {
                                     if (isset($arrSrcInfo['sample_ids'][$intSamId])) {
                                         $bolSampleExist = true;
                                         break;
                                     }
                                 }
                             }
                             if ($bolSampleExist === false) {
                                 continue;
                             }
                         } else {
                             continue;
                         }
                         // 'src_ids' =>
                         // 'id1,leftResult;id2,rightResult;id3-id6,rightResult',
                         // 解析src_ids串
                         $arrSrcInfo['src_ids'] = explode(';', $arrSrcInfo['src_ids']);
                         $arrSrcInfoTemp = array();
                         $arrMinMaxInfo = array();
                         // 保存范围id,key为min_id,max_id,result
                         foreach ($arrSrcInfo['src_ids'] as $intTemp => $strInfo) {
                             $strInfo = explode(',', $strInfo);
                             if (strpos($strInfo[0], '-') === false) {
                                 $arrSrcInfoTemp[$strInfo[0]] = $strInfo[1];
                             } else {
                                 $arrTemp = explode('-', $strInfo[0]);
                                 $arrMinMaxInfo[$arrTemp[0]] = array('min_id' => intval($arrTemp[0]), 'max_id' => intval($arrTemp[1]), 'result' => $strInfo[1]);
                                 unset($arrTemp);
                             }
                         }
                         $arrSrcInfo['src_ids'] = $arrSrcInfoTemp;
                         unset($arrSrcInfoTemp);
                         // 找知心结果且flag为1,pk掉
                         // 循环处理leftResult,rightResult,topResult
                         foreach ($GLOBALS['RESULT'] as $res) {
                             if (is_array($arrData['uiData'][$res]['item']) && !empty($arrData['uiData'][$res]['item'])) {
                                 $intTotalCount = isset($arrFilterConfs[$res]) ? intval($arrFilterConfs[$res]) : 0;
                                 $intCurCount = 0;
                                 // 遍历知心队列结果,执行pk策略
                                 foreach ($arrData['uiData'][$res]['item'] as $intIndex => $arrItem) {
                                     if ($intTotalCount > 0 && $intCurCount >= $intTotalCount) {
                                         break;
                                     }
                                     $intCurCount++;
                                     if (isset($arrSrcInfo['src_ids'][$arrItem['dispData']['StdStg']]) && trim($arrSrcInfo['src_ids'][$arrItem['dispData']['StdStg']]) == trim($res) && 1 == intval($arrSrcInfo['flag'])) {
                                         unset($arrData['uiData'][$res]['item'][$intIndex]);
                                         $arrLogZhiIds[$arrItem['dispData']['StdStg']] = $arrItem['dispData']['StdStg'];
                                         // $bolFlag = true;
                                     }
                                     foreach ($arrMinMaxInfo as $intMinId => $arrMinInfo) {
                                         if (intval($arrItem['dispData']['StdStg']) >= $intMinId && intval($arrItem['dispData']['StdStg']) <= intval($arrMinInfo['max_id']) && trim($arrMinInfo['result']) == trim($res) && 1 == intval($arrSrcInfo['flag'])) {
                                             unset($arrData['uiData'][$res]['item'][$intIndex]);
                                             $arrLogZhiIds[$arrItem['dispData']['StdStg']] = $arrItem['dispData']['StdStg'];
                                             // $bolFlag = true;
                                         }
                                     }
                                 }
                             }
                         }
                         unset($arrMinMaxInfo);
                     }
//.........这里部分代码省略.........
开发者ID:drehere,项目名称:shenmegui,代码行数:101,代码来源:DispArchitecture.php

示例13: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrRightPromptStrategyConf = Util::getConf('/rightprompt', 'RIGHTPROMPT_STRATEGY');
     $bolFlagFeature = Util::getConf('/feature', 'FEATURE_LIST/ADLEVEL/TURN') === 'ON' ? true : false;
     //避让策略时,广告标识(品专、地标)
     $arrCollisionEcIds = $arrRightPromptStrategyConf['COLLISION']['EC'];
     //共存策略时,知心资源号(攻略)
     $arrCoexistZhixinIds = $arrRightPromptStrategyConf['COEXIST']['ZHIXIN'];
     //PK策略时,知心资源号(百科、模糊推右)
     $arrPkZhixinIds = $arrRightPromptStrategyConf['PK']['ZHIXIN'];
     //命中pk策略标记
     $bolPkStrategy = false;
     //命中共存策略标记
     $bolCoexistStrategy = false;
     //命中避让策略标记
     $bolCollisionStrategy = false;
     //判断是否存在右侧提示,若存在则记录其位置
     $arrRightPromptIds = array();
     if (isset($arrData['uiData']['queryInfo']['promptNode']) && is_array($arrData['uiData']['queryInfo']['promptNode'])) {
         foreach ($arrData['uiData']['queryInfo']['promptNode'] as $intKey => $arrOnePromptNode) {
             if (!empty($arrOnePromptNode['promptContent'])) {
                 $arrPromptContent = json_decode($arrOnePromptNode['promptContent'], true);
                 if (!empty($arrPromptContent) && !empty($arrPromptContent['hints']['RightTop'])) {
                     $arrRightPromptIds[] = $intKey;
                 }
             }
         }
     }
     //如果存在右侧提示,才进行策略PK,共存,避让
     if (!empty($arrRightPromptIds)) {
         //如果后端有传广告标记,则按照后端标记来判断是否避让
         if ($bolFlagFeature && isset($arrData['uiData']['ecResult']['adlevel'])) {
             $intFlag = $arrData['uiData']['ecResult']['adlevel'] >> 1 & 0x1;
             if ($intFlag != 0) {
                 $bolCollisionStrategy = true;
             }
         } else {
             // 查找是否存在品专和地标
             if (!$bolCollisionStrategy && !empty($arrCollisionEcIds) && isset($arrData['uiData']['ecResult']['ecResultItem']) && is_array($arrData['uiData']['ecResult']['ecResultItem'])) {
                 foreach ($arrData['uiData']['ecResult']['ecResultItem'] as $arrOneEcItem) {
                     if (!empty($arrOneEcItem['id']) && in_array($arrOneEcItem['id'], $arrCollisionEcIds)) {
                         $bolCollisionStrategy = true;
                         break;
                     }
                 }
             }
         }
         //未命中PK策略时,查找右侧知心
         $arrPkZhixinIndexs = array();
         if (!$bolCollisionStrategy && isset($arrData['uiData']['rightResult']['item']) && is_array($arrData['uiData']['rightResult']['item'])) {
             foreach ($arrData['uiData']['rightResult']['item'] as $intKey => $arrOneRightResultItem) {
                 if (!empty($arrOneRightResultItem['dispData']['StdStg'])) {
                     if (!empty($arrPkZhixinIds) && in_array($arrOneRightResultItem['dispData']['StdStg'], $arrPkZhixinIds)) {
                         $bolPkStrategy = true;
                         $arrPkZhixinIndexs[] = $intKey;
                     } elseif (!empty($arrCoexistZhixinIds) && in_array($arrOneRightResultItem['dispData']['StdStg'], $arrCoexistZhixinIds)) {
                         $bolCoexistStrategy = true;
                     } else {
                         $bolCollisionStrategy = true;
                     }
                 }
             }
         }
         //命中避让策略时,删除右侧提示
         if ($bolCollisionStrategy && !empty($arrRightPromptIds)) {
             foreach ($arrRightPromptIds as $intKey) {
                 unset($arrData['uiData']['queryInfo']['promptNode'][$intKey]);
             }
             $arrData['uiData']['queryInfo']['rightPromptStraFlag'] = 1;
             return true;
         }
         //命中共存策略时,直接返回
         if ($bolCoexistStrategy) {
             $arrData['uiData']['queryInfo']['rightPromptStraFlag'] = 2;
             //右侧提示的展示样式(0:窄;1:宽;2:自适应)
             $arrData['uiData']['queryInfo']['promptStyle']['RightTop']['width'] = 2;
             return true;
         }
         //命中PK策略时,删除右侧百科知心和右侧模糊推右的知心
         if ($bolPkStrategy && !empty($arrPkZhixinIndexs)) {
             foreach ($arrPkZhixinIndexs as $intKey) {
                 unset($arrData['uiData']['rightResult']['item'][$intKey]);
             }
             $arrData['uiData']['queryInfo']['rightPromptStraFlag'] = 4;
             return true;
         }
     }
     return true;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:92,代码来源:RightPromptStrategy.php

示例14: run

 public function run(&$arrData, $arrConf)
 {
     if (empty($arrData) || !is_array($arrData)) {
         return false;
     }
     $arrChallengerConf = Util::getConf('/tpl_rewrite', 'TPL_REWRITE');
     // file_put_contents
     // ('/home/work/search/view-ui/data/data_ItemTplRewrite_conf',
     // serialize($arrTplConfs) );
     // 防御者配置
     $arrDefanderConf = array();
     // 找出挑战者
     foreach ($GLOBALS['RESULT'] as $res) {
         if (!empty($arrData['uiData'][$res]['item']) && is_array($arrData['uiData'][$res]['item'])) {
             // 添加队列Pk条件
             $arrDefanderConf['Challenger_' . $res] = $arrChallengerConf['RESULT_PK']['Challenger_' . $res];
             foreach ($arrData['uiData'][$res]['item'] as $item) {
                 $intStdStg = $item['dispData']['StdStg'];
                 $intStdStl = $item['dispData']['StdStl'];
                 $strTpl = empty($item['dispData']['strategy']['tempName']) ? $item['dispData']['templateName'] : $item['dispData']['strategy']['tempName'];
                 // 根据StdStg搜索
                 $arrChallengerConf_item = $arrChallengerConf['ITEM_PK']['Challenger_' . $intStdStg];
                 if (empty($arrChallengerConf_item)) {
                     // 根据templateName搜索
                     $arrChallengerConf_item = $arrChallengerConf['ITEM_PK']['Challenger_' . $strTpl];
                 }
                 if (empty($arrChallengerConf_item)) {
                     // 没搜索到相关的配置
                     continue;
                 }
                 if (!empty($arrChallengerConf_item['tpl']) && $strTpl !== $arrChallengerConf_item['tpl']) {
                     // 模板不匹配
                     continue;
                 }
                 if (!empty($arrChallengerConf_item['stdstg']) && $intStdStg !== $arrChallengerConf_item['stdstg']) {
                     // stdstg不匹配
                     continue;
                 }
                 if (!empty($arrChallengerConf_item['stdstl']) && $intStdStl !== $arrChallengerConf_item['stdstl']) {
                     // stdstl不匹配
                     continue;
                 }
                 $arrResults = explode(',', $arrChallengerConf_item['result']);
                 if (!empty($arrChallengerConf_item['result']) && !empty($arrResults) && !in_array($res, $arrResults)) {
                     // 队列不匹配
                     continue;
                 }
                 // 收集单条Pk条件
                 if (empty($arrDefanderConf['Challenger_item'])) {
                     $arrDefanderConf['Challenger_item'] = $arrChallengerConf_item['Defander'];
                 } else {
                     $arrDefanderConf['Challenger_item'] = array_merge($arrDefanderConf['Challenger_item'], $arrChallengerConf_item['Defander']);
                 }
             }
         }
     }
     // 对防御者进行惩罚
     foreach ($GLOBALS['RESULT'] as $res) {
         if (!empty($arrData['uiData'][$res]['item']) && is_array($arrData['uiData'][$res]['item'])) {
             foreach ($arrData['uiData'][$res]['item'] as &$item) {
                 $intStdStg = $item['dispData']['StdStg'];
                 $intStdStl = $item['dispData']['StdStl'];
                 $strTpl = empty($item['dispData']['strategy']['tempName']) ? $item['dispData']['templateName'] : $item['dispData']['strategy']['tempName'];
                 $arrDefanderConf_item = array();
                 // 根据队列PK策略找到防御者进行惩罚
                 foreach ($GLOBALS['RESULT'] as $res_tmp) {
                     // 根据StdStg搜索
                     $arrDefanderConf_item = $arrDefanderConf['Challenger_' . $res_tmp]['Defander_' . $intStdStg];
                     if (empty($arrDefanderConf_item)) {
                         // 根据templateName搜索
                         $arrDefanderConf_item = $arrDefanderConf['Challenger_' . $res_tmp]['Defander_' . $strTpl];
                     }
                     if (!empty($arrDefanderConf_item)) {
                         // 找到了
                         break;
                     }
                 }
                 // 根据单条PK策略找到防御者进行惩罚
                 if (empty($arrDefanderConf_item)) {
                     // 根据StdStg搜索
                     $arrDefanderConf_item = $arrDefanderConf['Challenger_item']['Defander_' . $intStdStg];
                     if (empty($arrDefanderConf_item)) {
                         // 根据templateName搜索
                         $arrDefanderConf_item = $arrDefanderConf['Challenger_item']['Defander_' . $strTpl];
                     }
                 }
                 if (empty($arrDefanderConf_item)) {
                     // 没搜索到防御者惩罚配置
                     continue;
                 }
                 if (!empty($arrDefanderConf_item['tpl']) && $strTpl !== $arrDefanderConf_item['tpl']) {
                     continue;
                 }
                 if (!empty($arrChallengerConf_item['stdstg']) && $intStdStg !== $arrChallengerConf_item['stdstg']) {
                     // stdstg不匹配
                     continue;
                 }
                 if (!empty($arrDefanderConf_item['stdstl']) && $arrDefanderConf_item['stdstl'] != $intStdStl) {
                     continue;
                 }
//.........这里部分代码省略.........
开发者ID:drehere,项目名称:shenmegui,代码行数:101,代码来源:ItemTplRewrite.php

示例15: parseTplConfig

 /**
  * 解析模板配置
  *
  * @param $arrData unknown_type       	
  * @param $arrTplConfig unknown_type       	
  * @return boolean
  */
 public function parseTplConfig(&$arrData, $arrTplConfig)
 {
     $arrQueryInfo =& $arrData['uiData']['queryInfo'];
     $arrHilightInfo =& $arrData['uiData']['hilightInfo'];
     $arrControlInfo =& $arrData['uiControl'];
     $arrUrlConfig = $arrQueryInfo['pUrlConfig'];
     // strategy
     unset($arrQueryInfo['strategyName']);
     $bolTnUnFeature = Util::getConf('/feature', 'FEATURE_LIST/TN_UN/TURN') === 'ON' ? true : false;
     if ($bolTnUnFeature) {
         $strTn = empty($arrData['uiData']['queryInfo']['accountName']) ? $GLOBALS['DEFAULT_TEMPLATE_NAME'] : $arrData['uiData']['queryInfo']['accountName'];
         $strStrategyName = shmdict_getValueFromDict($strTn, 'tn_un');
         $arrQueryInfo['strategyName'] = empty($strStrategyName) ? 'baidu' : $strStrategyName;
     } else {
         if (isset($arrTplConfig['strategy'])) {
             $arrQueryInfo['strategyName'] = trim($arrTplConfig['strategy']);
         } else {
             if (!isset($arrQueryInfo['strategyName'])) {
                 $arrQueryInfo['strategyName'] = DEFAULT_TEMPLATE_STRATEGY;
             }
         }
     }
     // services
     unset($arrControlInfo['services_ResultPage']);
     $arrServiceNames = explode(',', ALL_SERVICE);
     $arrServiceNames = array_flip($arrServiceNames);
     if (isset($arrTplConfig['services']) && !empty($arrTplConfig['services'])) {
         $arrServices = explode(',', $arrTplConfig['services']);
         $arrResultPage = array();
         for ($i = 0; $i < MAX_SVR_NUM; $i++) {
             $arrResultPage[$i] = 0;
         }
         foreach ($arrServices as $key) {
             if (isset($arrServiceNames[$key]) && $arrServiceNames[$key] < MAX_SVR_NUM) {
                 $arrResultPage[$arrServiceNames[$key]] = 1;
             }
         }
         $arrControlInfo['services_ResultPage'] = $arrResultPage;
     }
     unset($arrControlInfo['services_FrontPage']);
     if (isset($arrTplConfig['front_services']) && !empty($arrTplConfig['front_services'])) {
         $arrServices = explode(',', $arrTplConfig['front_services']);
         $arrResultPage = array();
         for ($i = 0; $i < MAX_SVR_NUM; $i++) {
             $arrResultPage[$i] = 0;
         }
         foreach ($arrServices as $key) {
             if (isset($arrServiceNames[$key]) && $arrServiceNames[$key] < MAX_SVR_NUM) {
                 $arrResultPage[$arrServiceNames[$key]] = 1;
             }
         }
         $arrControlInfo['services_FrontPage'] = $arrResultPage;
     }
     if (isset($arrTplConfig['ignore_url'])) {
         $arrControlInfo['ignoreUrl'] = intval($arrTplConfig['ignore_url']);
     } else {
         $arrControlInfo['ignoreUrl'] = 0;
     }
     if (isset($arrTplConfig['protectpp'])) {
         $arrControlInfo['protectppSwitch'] = intval($arrTplConfig['protectpp']);
         if ($arrControlInfo['protectppSwitch'] != PROTECTPP_SWITCH_OPEN) {
             $arrControlInfo['protectppSwitch'] = PROTECTPP_SWITCH_CLOSE;
         }
     } else {
         $arrControlInfo['protectppSwitch'] = PROTECTPP_SWITCH_CLOSE;
     }
     // 强制关闭了
     $arrControlInfo['protectppSwitch'] = PROTECTPP_SWITCH_CLOSE;
     if (isset($arrTplConfig['needsp'])) {
         $arrQueryInfo['needSp'] = intval($arrTplConfig['needsp']);
         if ($arrQueryInfo['needSp'] < 0 || $arrQueryInfo['needSp'] > 1) {
             $arrQueryInfo['needSp'] = 0;
         }
     } else {
         $arrQueryInfo['needSp'] = 0;
     }
     if (isset($arrTplConfig['inter_page'])) {
         $arrQueryInfo['interPage'] = intval($arrTplConfig['inter_page']);
     } else {
         $arrQueryInfo['interPage'] = 0;
     }
     if (isset($arrTplConfig['resLimit'])) {
         $arrQueryInfo['resLimitSwitch'] = intval($arrTplConfig['resLimit']);
         if ($arrQueryInfo['resLimitSwitch'] != PROTECTPP_SWITCH_OPEN) {
             $arrQueryInfo['resLimitSwitch'] = PROTECTPP_SWITCH_CLOSE;
         }
     } else {
         $arrQueryInfo['resLimitSwitch'] = PROTECTPP_SWITCH_CLOSE;
     }
     unset($arrQueryInfo['wenkuUrlPara']);
     if (isset($arrTplConfig['special_pagetype_para'])) {
         $strTemp = $arrTplConfig['special_pagetype_para'];
         $arrTemp = str_split($strTemp);
//.........这里部分代码省略.........
开发者ID:drehere,项目名称:shenmegui,代码行数:101,代码来源:TemplateSelector.php


注:本文中的Util::getConf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。