Authored by yyq

hot search key

... ... @@ -20,6 +20,7 @@ use Hood\Session;
use WebPlugin\Mobile;
use Api\Yohobuy;
use LibModels\Web\Passport\LoginData;
use LibModels\Web\Home\IndexData;
use WebPlugin\UdpLog;
use WebPlugin\Encryption;
... ... @@ -564,15 +565,24 @@ class WebAction extends Controller_Abstract
else {
$channel = \Index\HomeModel::getSwitchChannel();
}
$apiDomain = $this->getApiDomain();
$header = array(
'navbars' => \Index\HomeModel::getNavBars($channel),
'hotSearch' => '',
'gobytype' => 'gobuy' . $channel,
'searchcate' => 'searchcate' . $channel,
'header' => true,
'apiDomain' => $apiDomain,
'sysUserSession'=> '',
);
$terms = IndexData::getHotSearchData();
if(!empty($terms['data'])) {
$header['hotSearch'] = isset($terms['data']['hotTerms'][0]['content']) ? $terms['data']['hotTerms'][0]['content'] : '';
}
//同步session
if(!empty($uid) && $sysUserSession < 20) {
$header['sysUserSession'] = Helpers::syncUserSession($uid);
... ...
... ... @@ -32,6 +32,23 @@ class IndexData
}
/**
* 获取热搜词数据
*
* @param int $status (default)
* @param string $fields (default)
* @return array
*/
public static function getHotSearchData()
{
$params = Yohobuy::param();
$params['client_type'] = 'web'; // 调用web手机网站的
$params['method'] = 'app.search.getTerms';
$params['private_key'] = Yohobuy::$privateKeyList['web'];
$params['client_secret'] = Sign::getSign($params);
return Yohobuy::get(API_URL, $params, true);
}
/**
* 获取资源数据
*
* @param string $content_code
... ...
... ... @@ -135,8 +135,9 @@
<div class="search float-left {{searchcate}}" >
<form action="//search.yohobuy.com" method="get" id="searchForm">
<span class="searchspan">
<input type="hidden" id="defaultsearch">
<input class="searchinput" type="text" name="query" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30"></span>
<input type="hidden" id="defaultsearch" value="">
<input class="searchinput" type="text" name="query" id="query_key" autocomplete="off" x-webkit-speech="" lang="zh-CN" x-webkit-grammar="builtin:translate" value="{{hotSearch}}" onfocus="if(this.value==this.defaultValue){this.value='';this.style.color='#333'}" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#999'}" maxlength="30" style="color: #999;">
</span>
<a class="icon-search" href="javascript:submitSearch();"></a>
<ul class="search-list"></ul>
</form>
... ...
... ... @@ -803,6 +803,7 @@
float: left;
width: 240px;
height: 28px;
color: #999;
border: 1px solid #000;
box-sizing: border-box;
padding: 6px 0 5px 10px;
... ...