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


PHP CLog::logId方法代码示例

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


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

示例1: queryFromSug

 public function queryFromSug(&$arrData)
 {
     //sug接口wiki:http://wiki.babel.baidu.com/twiki/bin/view/Ps/Rank/InterActionTopic/OpensugInterfaceIntroduction
     //json=1表示返回标准的json格式数据
     //cb=空 表示返回的数据中没有“window.baidu.sug”回调
     $arrUrlParams = array();
     $strReferWord = '';
     if (!empty($arrData['uiData']['queryinfo']['refer'])) {
         $strUrlParams = parse_url($arrData['uiData']['queryinfo']['refer'], PHP_URL_QUERY);
         if (!empty($strUrlParams)) {
             parse_str($strUrlParams, $arrUrlParams);
             if (!empty($arrUrlParams)) {
                 $strReferWord = isset($arrUrlParams['wd']) ? $arrUrlParams['wd'] : (isset($arrUrlParams['word']) ? $arrUrlParams['word'] : (isset($arrUrlParams['w']) ? $arrUrlParams['w'] : ''));
             }
         }
     }
     $arrHeader['pathinfo'] = 'su';
     $arrHeader['querystring'] = 'wd=' . $arrData['uiData']['queryInfo']['queryWord'] . "&ie=utf-8&json=2&cb=";
     $arrHeader['Referer'] = $_SERVER['HTTP_REFERER'];
     $arrHeader['Cookie'] = $_SERVER['HTTP_COOKIE'];
     $arrData['uiData']['queryInfo']['isParams']['sug_status'] = SUG_STATUS_NORMAL;
     $arrSugInfo = array();
     if (!isset($_ENV['HHVM'])) {
         ral_set_logid(CLog::logId());
         $ret = ral('sug', 'get', '', Volatile::rand(), $arrHeader);
     } else {
         $ral = new RalClass();
         $ral->ral_set_logid(CLog::logId());
         $ret = $ral->ral_curl_sug('sug', '', $arrHeader);
     }
     //ral请求失败
     if ($ret === false) {
         $arrData['uiData']['queryInfo']['isParams']['sug_status'] = SUG_STATUS_RAL_ERROR;
         return $arrSugInfo;
     }
     $arrRst = json_decode($ret, true);
     //json_decode失败
     if ($arrRst === false) {
         $arrData['uiData']['queryInfo']['isParams']['sug_status'] = SUG_STATUS_JSON_FAIL;
         return $arrSugInfo;
     }
     if (empty($arrRst['q'])) {
         $arrData['uiData']['queryInfo']['isParams']['sug_status'] = SUG_STATUS_ERROR_REQ;
         return $arrSugInfo;
     }
     //sug为空
     if (empty($arrRst['s']) || !is_array($arrRst['s'])) {
         $arrData['uiData']['queryInfo']['isParams']['sug_status'] = SUG_STATUS_NO_SUG;
         return $arrSugInfo;
     }
     $arrSugInfo = $arrRst['s'];
     return $arrSugInfo;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:53,代码来源:QuerySug.php

示例2: log

 public function log($arrData, $intType = 0)
 {
     if (empty($arrData) || $arrData['uiControl']['type'] != 'www') {
         return;
     }
     $arrQueryInfo = $arrData['uiData']['queryInfo'];
     $arrResult = $arrData['uiData']['asResult'];
     // Consider midpage displayed 20 result per page as default,Here we set
     // the threshold from PB_PAGESIZE to PB_PAGESIZE*2
     if ($arrQueryInfo['resNum'] > 2 * $GLOBALS['URLLOG']['PB_PAGESIZE'] || $arrQueryInfo['pageNo'] > 2 || $arrResult['asResultNum'] < 0) {
         return;
     }
     $this->BaiduLog->setProduct(ProductID::PS);
     $this->BaiduLog->setTimestamp(b2log_get_timestamp());
     $this->BaiduLog->setLogid(CLog::logId());
     $BaiduIs = new BaiduIs();
     if ($intType === 1) {
         $BaiduIs->setMod($arrQueryInfo['isParams']['mod']);
         $BaiduIs->setCqid($arrQueryInfo['isParams']['cqid']);
         $BaiduIs->setIsid($arrQueryInfo['isParams']['isid']);
         $BaiduIs->setChk($arrQueryInfo['isParams']['chk']);
         $BaiduIs->setIsBd($arrQueryInfo['isParams']['isbd']);
         $this->BaiduLog->setBaiduis($BaiduIs);
     }
     // 高可信se置换后,日志里仍然打印原始query
     if ($arrQueryInfo['superSeFlag'] == 1) {
         $this->BaiduLog->setQuery($arrQueryInfo['queryWordBak']);
     } else {
         $this->BaiduLog->setQuery($arrQueryInfo['queryWord']);
     }
     $this->addQueryInfo($arrData);
     $this->addUrlInfos($arrData);
     $logInfo = $this->BaiduLog->serialize();
     $strLogFile = $intType === 1 ? 'pre_pbUrl' : 'pbUrl';
     $ret = b2log_write($strLogFile, $logInfo);
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:36,代码来源:PbUrlLog.php

示例3: queryFromUs


//.........这里部分代码省略.........
     $objQuery->platformName = $arrControlInfo['platform'];
     $objQuery->is_bws_re = $arrQueryInfo['is_bws_re'];
     $objQuery->useragent_full = $arrQueryInfo['useragent_full'];
     $objQuery->confuse_Switch = $arrQueryInfo['confuse_Switch'];
     $objQuery->protectNum = $arrQueryInfo['protectNum'];
     $objQuery->ec_src = $arrQueryInfo['ec_src'];
     $objQuery->php_default_platform = $GLOBALS['DEFAULT_PLATFORM'];
     $objQuery->dspName = $arrQueryInfo['dspName'];
     $objQuery->ipv6Address = $arrQueryInfo['ipv6Address'];
     $objQuery->refer = $arrQueryInfo['refer'];
     $objQuery->needProtect = $arrQueryInfo['needProtect'];
     $objQuery->protectPPSwitch = $arrQueryInfo['protectPPSwitch'];
     $objQuery->nojc = $arrQueryInfo['nojc'];
     $objQuery->super_se_flag = $arrQueryInfo['superSeFlag'];
     $objQuery->isContainPunc = $arrQueryInfo['isContainPunc'];
     $objQuery->wordNoPunc = $arrQueryInfo['wordNoPunc'];
     $objQuery->clusterMod = $arrQueryInfo['clusterMod'];
     $objQuery->wordEnc = $arrQueryInfo['wordEnc'];
     $objQuery->extraStr = $arrQueryInfo['extraStr'];
     $objQuery->strategy_state = $arrQueryInfo['strategyState'];
     $objQuery->prompt_flag = $arrQueryInfo['promptUsOpen'];
     $objQuery->passport_user_id = $arrSessionInfo['passportUserId'];
     $objQuery->need_interleaving = $arrQueryInfo['need_interleaving'];
     $objQuery->comeFrom = $arrQueryInfo['comeFrom'];
     if (!empty($arrQueryInfo['country'])) {
         $objQuery->country_str = $arrQueryInfo['country'];
     }
     $objQuery->is_sample_template = isset($arrQueryInfo['is_sample_template']) ? intval($arrQueryInfo['is_sample_template']) : 0;
     $objQuery->superseSwitch = isset($arrQueryInfo['superseSwitch']) ? intval($arrQueryInfo['superseSwitch']) : 1;
     $objQuery->query_lang = $arrQueryInfo['query_lang'];
     $objQuery->displayLang = $arrControlInfo['language'];
     if (isset($arrQueryInfo['isParams'])) {
         if ($arrQueryInfo['isParams']['mod'] === IS_PRE_DICT_REQ) {
             if (!empty($arrQueryInfo['isParams']['hsug'])) {
                 $objQuery->hsug = $arrQueryInfo['isParams']['hsug'];
             }
             if (!empty($arrQueryInfo['isParams']['sug'])) {
                 $objQuery->sug = $arrQueryInfo['isParams']['sug'];
             }
             if (!empty($arrQueryInfo['isParams']['clist'])) {
                 $objQuery->clist = $arrQueryInfo['isParams']['clist'];
             }
         }
         $objQuery->mod = $arrQueryInfo['isParams']['mod'];
         $objQuery->cqid = empty($arrQueryInfo['isParams']['cqid']) ? '0' : $arrQueryInfo['isParams']['cqid'];
         $objQuery->isid = empty($arrQueryInfo['isParams']['isid']) ? '0' : $arrQueryInfo['isParams']['isid'];
         $objQuery->chk = empty($arrQueryInfo['isParams']['chk']) ? '0' : $arrQueryInfo['isParams']['chk'];
         if (in_array($objQuery->mod, array(IS_PRE_REQ, IS_PRE_DICT_REQ)) && in_array($objQuery->word, array('baidu', '百度'))) {
             $objQuery->f4s = 1;
         } else {
             $objQuery->f4s = $arrQueryInfo['isParams']['f4s'];
         }
         $objQuery->isbd = $arrQueryInfo['isParams']['isbd'];
         $objQuery->csq = intval($arrQueryInfo['isParams']['csq']);
         $objQuery->pstg = intval($arrQueryInfo['isParams']['pstg']);
         $objQuery->isDebugSwitch = intval($arrQueryInfo['isDebugSwitch']);
     }
     // User Agent相关字段, by chenjinsheng@baidu.com, 2013-07-08
     if (!empty($arrQueryInfo['userAgent'])) {
         list($resx, $resy) = @explode('x', $arrQueryInfo['userAgent']['resolution']);
         $arrUaInfo = array('ua_os' => $arrQueryInfo['userAgent']['os'], 'ua_browser' => $arrQueryInfo['userAgent']['browser'], 'ua_modal' => $arrQueryInfo['userAgent']['modal'], 'ua_measure' => $arrQueryInfo['userAgent']['measure'], 'ua_res_x' => $resx, 'ua_res_y' => $resy);
         $arrExpFields = Bd_Conf::getConf('tpl_uaadaptation/UA_DICT_EXPLICIT');
         $arrExpFields = array_keys($arrExpFields);
         foreach ($arrExpFields as $filed) {
             unset($arrQueryInfo['userAgent'][$filed]);
         }
         if (!empty($arrQueryInfo['userAgent'])) {
             $objUaFields = Util::mcpack_normal($arrQueryInfo['userAgent']);
             $strUaFields = mc_pack_array2pack($objUaFields);
             $arrUaInfo['ua_ext'] = $strUaFields;
         }
         $objQuery->uaInfo = $arrUaInfo;
     }
     $arrQuery = $objQuery->toArray();
     $arrQuery = Util::mcpack_normal($arrQuery);
     foreach ($arrQuery as $key => $value) {
         if (in_array($key, array('cookie', 'beforeUrl', 'UrlParaPack', 'JpAlaPre'))) {
             $arrQuery['(raw)' . $key] = $value;
             unset($arrQuery[$key]);
         }
     }
     if (!isset($_ENV['HHVM'])) {
         ral_set_logid(CLog::logId());
         $ret = ral('us', 'us', $arrQuery, Volatile::rand());
         if ($ret === false) {
             $intErrno = ral_get_errno();
             CLog::fatal('Fail to connect us, errNo:' . $intErrno, $GLOBALS['logArr']);
         }
     } else {
         $ral = new RalClass();
         $ral->ral_set_logid(CLog::logId());
         $ret = $ral->ral('us', 'us', $arrQuery, Volatile::rand());
         if ($ret === false) {
             $intErrno = $ral->ral_get_errno();
             $strErrmsg = $ral->ral_get_error($intErrno);
             CLog::fatal('Fail to connect us, errNo:' . $intErrno . 'errMsg: ' . $strErrmsg, $GLOBALS['logArr']);
         }
     }
     return $ret;
 }
开发者ID:drehere,项目名称:shenmegui,代码行数:101,代码来源:QueryUS.php

示例4: pre_render

/**
 * 数据预处理(先只针对pc模板)
 * @param unknown_type $data
 * @param unknown_type 阿拉丁数据
 * @param unknown_type 普通结果数据
 */
function pre_render(&$data, &$arrAlaData, &$arrAsData)
{
    $arrCssUi = $data['uiData']['cssUI'];
    require VUI_APP_PATH . '/plugins/modifier.format_result.php';
    $intLogId = CLog::logId();
    //asResult队列
    //FE模板中的逻辑
    $intFlagConfuse = intval($data['uiData']['templateConfig']['confuseResult']);
    $intUseRender = intval($data['uiData']['templateConfig']['useRender']);
    $intIsFavoOn = intval($data['uiData']['templateConfig']['EnableFavo']);
    $bolIsPassportUserLogin = $data['uiData']['passport']['isPassportUserLogin'];
    $strUserName = $data['uiData']['passport']['passportUserName'];
    $strDisplayName = $data['uiData']['passport']['displayname'];
    $strSecureEmail = $data['uiData']['passport']['secureemail'];
    $strSecureMobil = $data['uiData']['passport']['securemobil'];
    $strUserDisplayInfo = strlen($strDisplayName) > 0 ? $strDisplayName : (strlen($strUserName) > 0 ? $strUserName : (strlen($strSecureEmail) > 0 ? $strSecureEmail : $strSecureMobil));
    $intIndex = (intval($data['uiData']['queryInfo']['pageNo']) - 1) * intval($data['uiData']['queryInfo']['resNum']) + 1;
    $arrHintData = array();
    if (!empty($data['uiData']['promptNode'])) {
        foreach ($data['uiData']['promptNode'] as $arrPromptNode) {
            if (!empty($arrPromptNode['promptContent']) && strlen($arrPromptNode['promptContent']) > 4) {
                $arrOnePromptContent = json_decode($arrPromptNode['promptContent'], true);
                $arrHintData = array_merge_recursive($arrHintData, $arrOnePromptContent);
            }
        }
    }
    // 遍历asResult队列
    if (!empty($data['uiData']['asResult']['item']) && is_array($data['uiData']['asResult']['item'])) {
        foreach ($data['uiData']['asResult']['item'] as $intKey => &$item) {
            $arrOneData = array();
            if ($item[comeFrome] == 'AS') {
                if ($intFlagConfuse == 0 && $intUseRender != 0 && !empty($item['dispData']['templateName'])) {
                    $arrExtData = array();
                    $arrExtData['resIndex'] = $intIndex;
                    $arrExtData['isFavoOn'] = $intIsFavoOn == 1 ? $data['uiData']['passport']['isFavoOn'] : false;
                    $arrExtData['hintData'] = $arrHintData;
                    $arrExtData['isUserLogin'] = $data['uiData']['passport']['isPassportUserLogin'];
                    $arrExtData['burstFlag'] = $item['burstFlag'];
                    $arrExtData['cssUI'] = $arrCssUi;
                    $arrExtData['resourceid'] = $item['dispData']['StdStg_new'];
                    $arrExtData['feData']['id'] = $intIndex;
                    $arrExtData['feData']['mu'] = $item['offsetInfo']['url'];
                    $arrExtData['feData']['y'] = $item['identifyStr'];
                    $arrExtData['feData']['rsv_stl'] = $item['dispData']['StdStl'];
                    // as的结果需要进行format_result
                    $item = smarty_modifier_format_result($item);
                    // 添加FE需要的extData信息,FE无需在模板中再添加
                    $item['resultData']['extData'] = $arrExtData;
                    //$strType = 'result';
                    $strType = empty($item['resultData']['tplData']['strategy']['type']) ? 'result' : $item['resultData']['tplData']['strategy']['type'];
                    $strTemplateName = $item['strategy']['tempName'];
                    // 子进程common_render时需要的type字段
                    $arrOneData['render_type'] = $strType;
                    // 子进程common_render时需要的templateName字段
                    $arrOneData['render_template'] = $strTemplateName;
                    // 用于子进程从uiData中取数据时使用
                    // as的直接取$data['uiData'][$strQueueName]['item'][$intQueueId]
                    // aladdin的取$data['uiData'][$strQueueName]['item'][$intQueueId]['dispData']
                    $arrOneData['type'] = 'as';
                    $arrRenderDataDetail = array();
                    // 子进程取数据时,去查找的队列(asResult,leftResult,leftResult,topResult)
                    $arrRenderDataDetail['queueName'] = 'asResult';
                    // 子进程取数据时,队列中的位置
                    $arrRenderDataDetail['queueId'] = $intKey;
                    $arrOneData['render_data'] = $arrRenderDataDetail;
                    // 标识单条结果,用于curl_multi发/取数据,以及后续的数据填充
                    $key = $strType . '_' . $strTemplateName . '_' . $arrRenderDataDetail['queueName'] . '_' . $arrRenderDataDetail['queueId'] . '_' . $intLogId;
                    $item['multi_render_key'] = $key;
                    $arrAsData[$key] = $arrOneData;
                }
            } elseif ($item[comeFrome] == 'SP') {
                #if (!in_array(intval($item ['dispData'] ['StdStg']), array(4, 19, 34, 23)) && $item ['dispData'] ['strategy'] ['tempName'] != 'naturalresult') {
                if ($item['dispData']['strategy']['tempName'] != 'naturalresult') {
                    if (isset($item['dispData']['resultData']['extData'])) {
                        $item['dispData']['resultData']['extData']['feData']['y'] = $item['identifyStr'];
                        $item['dispData']['resultData']['extData']['feData']['mu'] = $item['offsetInfo']['url'];
                        $item['dispData']['resultData']['extData']['feData']['id'] = $intIndex;
                        $item['dispData']['resultData']['extData']['feData']['wrapByAladdin'] = 'true';
                        $item['dispData']['resultData']['extData']['feData']['isUserLogin'] = $bolIsPassportUserLogin;
                        $item['dispData']['resultData']['extData']['feData']['username'] = $strUserName;
                        $item['dispData']['resultData']['extData']['feData']['userDisplayInfo'] = $strUserDisplayInfo;
                        $item['dispData']['resultData']['extData']['feData']['cssUI'] = $arrCssUi;
                        $item['dispData']['resultData']['extData']['feData']['rsv_stl'] = $item['dispData']['StdStl'];
                    }
                    $item['dispData']['resultData']['extData']['burstFlag'] = $item['burstFlag'];
                    if (!empty($item['dispData']['strategy']) && !empty($item['dispData']['strategy']['ctplOrPhp'])) {
                        $strType = empty($item['dispData']['strategy']['type']) ? 'aladdin' : $item['dispData']['strategy']['type'];
                        $strTemplateName = $item['dispData']['strategy']['tempName'];
                        $arrOneData['render_type'] = $strType;
                        $arrOneData['render_template'] = $strTemplateName;
                        $arrRenderDataDetail = array();
                        $arrRenderDataDetail['queueName'] = 'asResult';
                        $arrRenderDataDetail['queueId'] = $intKey;
                        $arrOneData['render_data'] = $arrRenderDataDetail;
//.........这里部分代码省略.........
开发者ID:drehere,项目名称:shenmegui,代码行数:101,代码来源:smarty_render.php


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