Authored by yyq

hot search key

@@ -20,6 +20,7 @@ use Hood\Session; @@ -20,6 +20,7 @@ use Hood\Session;
20 use WebPlugin\Mobile; 20 use WebPlugin\Mobile;
21 use Api\Yohobuy; 21 use Api\Yohobuy;
22 use LibModels\Web\Passport\LoginData; 22 use LibModels\Web\Passport\LoginData;
  23 +use LibModels\Web\Home\IndexData;
23 use WebPlugin\UdpLog; 24 use WebPlugin\UdpLog;
24 use WebPlugin\Encryption; 25 use WebPlugin\Encryption;
25 26
@@ -564,15 +565,24 @@ class WebAction extends Controller_Abstract @@ -564,15 +565,24 @@ class WebAction extends Controller_Abstract
564 else { 565 else {
565 $channel = \Index\HomeModel::getSwitchChannel(); 566 $channel = \Index\HomeModel::getSwitchChannel();
566 } 567 }
  568 +
567 $apiDomain = $this->getApiDomain(); 569 $apiDomain = $this->getApiDomain();
568 $header = array( 570 $header = array(
569 'navbars' => \Index\HomeModel::getNavBars($channel), 571 'navbars' => \Index\HomeModel::getNavBars($channel),
  572 + 'hotSearch' => '',
570 'gobytype' => 'gobuy' . $channel, 573 'gobytype' => 'gobuy' . $channel,
571 'searchcate' => 'searchcate' . $channel, 574 'searchcate' => 'searchcate' . $channel,
572 'header' => true, 575 'header' => true,
573 'apiDomain' => $apiDomain, 576 'apiDomain' => $apiDomain,
574 'sysUserSession'=> '', 577 'sysUserSession'=> '',
575 ); 578 );
  579 +
  580 + $terms = IndexData::getHotSearchData();
  581 +
  582 + if(!empty($terms['data'])) {
  583 + $header['hotSearch'] = isset($terms['data']['hotTerms'][0]['content']) ? $terms['data']['hotTerms'][0]['content'] : '';
  584 + }
  585 +
576 //同步session 586 //同步session
577 if(!empty($uid) && $sysUserSession < 20) { 587 if(!empty($uid) && $sysUserSession < 20) {
578 $header['sysUserSession'] = Helpers::syncUserSession($uid); 588 $header['sysUserSession'] = Helpers::syncUserSession($uid);
@@ -32,6 +32,23 @@ class IndexData @@ -32,6 +32,23 @@ class IndexData
32 } 32 }
33 33
34 /** 34 /**
  35 + * 获取热搜词数据
  36 + *
  37 + * @param int $status (default)
  38 + * @param string $fields (default)
  39 + * @return array
  40 + */
  41 + public static function getHotSearchData()
  42 + {
  43 + $params = Yohobuy::param();
  44 + $params['client_type'] = 'web'; // 调用web手机网站的
  45 + $params['method'] = 'app.search.getTerms';
  46 + $params['private_key'] = Yohobuy::$privateKeyList['web'];
  47 + $params['client_secret'] = Sign::getSign($params);
  48 + return Yohobuy::get(API_URL, $params, true);
  49 + }
  50 +
  51 + /**
35 * 获取资源数据 52 * 获取资源数据
36 * 53 *
37 * @param string $content_code 54 * @param string $content_code
@@ -135,8 +135,9 @@ @@ -135,8 +135,9 @@
135 <div class="search float-left {{searchcate}}" > 135 <div class="search float-left {{searchcate}}" >
136 <form action="//search.yohobuy.com" method="get" id="searchForm"> 136 <form action="//search.yohobuy.com" method="get" id="searchForm">
137 <span class="searchspan"> 137 <span class="searchspan">
138 - <input type="hidden" id="defaultsearch">  
139 - <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> 138 + <input type="hidden" id="defaultsearch" value="">
  139 + <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;">
  140 + </span>
140 <a class="icon-search" href="javascript:submitSearch();"></a> 141 <a class="icon-search" href="javascript:submitSearch();"></a>
141 <ul class="search-list"></ul> 142 <ul class="search-list"></ul>
142 </form> 143 </form>
@@ -803,6 +803,7 @@ @@ -803,6 +803,7 @@
803 float: left; 803 float: left;
804 width: 240px; 804 width: 240px;
805 height: 28px; 805 height: 28px;
  806 + color: #999;
806 border: 1px solid #000; 807 border: 1px solid #000;
807 box-sizing: border-box; 808 box-sizing: border-box;
808 padding: 6px 0 5px 10px; 809 padding: 6px 0 5px 10px;