Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
8 years ago
Commit
a25e04fe517f0c23d74248f74e2d3b38dd49047f
1 parent
280dbb83
hot search key
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
2 deletions
library/Action/WebAction.php
library/LibModels/Web/Home/IndexData.php
template/www.yohobuy.com/partials/layout/page-header.phtml
web-static/sass/_header.css
library/Action/WebAction.php
View file @
a25e04f
...
...
@@ -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
);
...
...
library/LibModels/Web/Home/IndexData.php
View file @
a25e04f
...
...
@@ -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
...
...
template/www.yohobuy.com/partials/layout/page-header.phtml
View file @
a25e04f
...
...
@@ -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>
...
...
web-static/sass/_header.css
View file @
a25e04f
...
...
@@ -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
;
...
...
Please
register
or
login
to post a comment