Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
hf
9 years ago
Commit
f3190d58daf305e703faa3d0794661b4cb959674
1 parent
a4934346
modify side nav to call h5 api
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
27 deletions
library/Action/AbstractAction.php
library/Configs/CacheConfig.php
library/LibModels/Wap/Home/SideData.php
library/Plugin/DataProcess/FloorProcess.php
script/nginx/conf/vhosts/yohobuy.test.conf
yohobuy/m.yohobuy.com/application/models/Index/Side.php
library/Action/AbstractAction.php
View file @
f3190d5
...
...
@@ -353,6 +353,8 @@ class AbstractAction extends Controller_Abstract
*/
protected
function
setNavSide
(
$guangChoosed
=
'all'
)
{
$this
->
_view
->
assign
(
'sideNav'
,
\Index\SideModel
::
getLeftNav
(
$guangChoosed
));
/*
$this->_view->assign('sideNav', array(
0 => array(
'textCn' => '男生',
...
...
@@ -415,6 +417,7 @@ class AbstractAction extends Controller_Abstract
)
),
));
*/
}
/**
...
...
library/Configs/CacheConfig.php
View file @
f3190d5
...
...
@@ -14,5 +14,7 @@ class CacheConfig
const
KEY_ACTION_GIRLS_INDEX
=
'key_action_girls_index'
;
// 女生首页
const
KEY_ACTION_KIDS_INDEX
=
'key_action_kids_index'
;
// 潮童首页
const
KEY_ACTION_LIFESTYLE_INDEX
=
'key_action_lifestyle_index'
;
// 创意生活首页
const
KEY_COMMON_SIDE_NAV
=
'key_common_side_nav'
;
// 公共的侧边栏
}
...
...
library/LibModels/Wap/Home/SideData.php
View file @
f3190d5
...
...
@@ -22,27 +22,26 @@ class SideData
/**
* 左侧边栏的分类和图标数据
*
* 备注:暂不使用,因很少变,获取后还需要再封装
*
* @return array
*/
public
static
function
leftNav
()
{
$param
=
Yohobuy
::
param
();
$param
[
'client_type'
]
=
'iphone'
;
// 因安卓不返回icon的地址
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
$query
=
Yohobuy
::
httpBuildQuery
(
''
,
$param
);
$urlList
=
array
();
$urlList
[
'getEntrance'
]
=
Yohobuy
::
SERVICE_URL
.
self
::
URI_LEFTNAV_ENTRANCE
.
$query
;
$urlList
[
'getCategory'
]
=
Yohobuy
::
SERVICE_URL
.
self
::
URI_LEFTNAV_CATEGORY
.
$query
;
return
Yohobuy
::
getMulti
(
$urlList
);
// $param = Yohobuy::param();
// $param['client_type'] = 'h5'; // 因安卓不返回icon的地址
// $param['client_secret'] = Sign::getSign($param);
// $query = Yohobuy::httpBuildQuery('', $param);
//
// return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
// $urlList = array();
// $urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;
// $urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;
//
// return Yohobuy::getMulti($urlList);
$param
=
Yohobuy
::
param
();
$param
[
'client_type'
]
=
'h5'
;
// 调用H5手机网站的
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
self
::
URI_LEFTNAV_CATEGORY
,
$param
);
}
}
...
...
library/Plugin/DataProcess/FloorProcess.php
View file @
f3190d5
...
...
@@ -150,8 +150,6 @@ class FloorProcess
$build
[
'textCn'
]
=
$one
[
'title'
];
$result
[
'hotCategory'
][
'list'
][]
=
$build
;
}
return
$result
;
}
...
...
script/nginx/conf/vhosts/yohobuy.test.conf
View file @
f3190d5
server
{
listen
80
;
server_name
wap
.
yohobuy
.
com
;
server_name
yhb
.
test
.
yoho
.
cn
*.
yhb
.
test
.
yoho
.
cn
;
#access_log /Data/logs/access.wap.yohobuy.com.log combined;
error_log
/
Data
/
logs
/
error
.
wap
.
yohobuy
.
com
.
log
warn
;
#access_log /Data/logs/access.buy.test.yoho.cn.log combined;
error_log
/
Data
/
logs
/
error
.
buy
.
test
.
yoho
.
cn
.
log
warn
;
root
/
Data
/
code
/
git
/
yohobuy
/
yohobuy
/
m
.
yohobuy
.
com
/
public
;
set
$
sub
''
;
if
($
host
~* ([^\.]+)\.
yhb
.
test
.
yoho
.
cn
$) {
set
$
sub
$
1
;
}
location
~* \.
html
$ {
root
/
Data
/
PE
/
yohobuy
/
assets
;
root
/
Data
/
code
/
git
/
yohobuy
/
assets
;
if
(!-
f
$
request_filename
){
root
/
Data
/
PE
/
yohobuy
/
yohobuy
/
m
.
yohobuy
.
com
/
public
;
root
/
Data
/
code
/
git
/
yohobuy
/
yohobuy
/
m
.
yohobuy
.
com
/
public
;
rewrite
^/(.+)$ /
index
.
php
?$
1
&
last
;
}
expires
7
d
;
...
...
@@ -40,19 +45,19 @@ server
include
fastcgi_params
;
}
error_page
403
=
http
://
wap
.
yohobuy
.
com
;
error_page
404
=
http
://
wap
.
yohobuy
.
com
/
error
.
html
;
error_page
403
=
http
://
buy
.
test
.
yoho
.
cn
;
error_page
404
=
http
://
buy
.
test
.
yoho
.
cn
/
error
.
html
;
}
server
{
listen
80
;
server_name
static
.
wap
.
yohobuy
.
com
;
server_name
static
yhb
.
test
.
yoho
.
cn
;
#access_log /Data/logs/access.static.wap.yohobuy.com.log combined;
#error_log /Data/logs/error.static.wap.yohobuy.com.log warn;
#access_log /Data/logs/access.static.buy.test.yoho.cn.log combined;
#error_log /Data/logs/error.static.buy.test.yoho.cn.log warn;
root
/
Data
/
PE
/
yohobuy
/
static
;
root
/
Data
/
code
/
git
/
yohobuy
/
static
;
location
/ {
log_not_found
off
;
...
...
yohobuy/m.yohobuy.com/application/models/Index/Side.php
0 → 100644
View file @
f3190d5
<?php
namespace
Index
;
use
LibModels\Wap\Home\SideData
;
use
Configs\CacheConfig
;
use
Plugin\Helpers
;
/**
*
* @name SideModel
* @package models/Index
* @copyright yoho.inc
* @version 1.0 (2015-10-21 21:21:09)
* @author fei.hong <fei.hong@yoho.cn>
*/
class
SideModel
{
/**
* 获取左侧边栏数据
*
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
*/
public
static
function
getLeftNav
(
$guangChoosed
=
'all'
)
{
$result
=
array
();
if
(
USE_CACHE
)
{
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
'master'
);
if
(
!
empty
(
$result
))
{
$result
[]
=
self
::
genLeftNavGuang
(
$guangChoosed
);
return
$result
;
}
}
// 调用接口获取后台配置的侧边栏数据
$side
=
SideData
::
leftNav
();
if
(
!
empty
(
$side
[
'data'
]))
{
foreach
(
$side
[
'data'
]
as
$key
=>
$value
)
{
// 逛的按照原来的做法,使用配置
if
(
$value
[
'sort_name_en'
]
===
'TRENDFINDER'
)
{
continue
;
}
$result
[
$key
][
'textCn'
]
=
$value
[
'sort_name'
];
$result
[
$key
][
'textEn'
]
=
$value
[
'sort_name_en'
];
$result
[
$key
][
'styleClass'
]
=
strtolower
(
$value
[
'sort_name_en'
]);
$result
[
$key
][
'url'
]
=
$value
[
'sort_url'
];
$result
[
$key
][
'img'
]
=
Helpers
::
getImageUrl
(
$value
[
'sort_ico'
],
60
,
60
);
}
}
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
$result
);
}
}
// 追加逛的子分类数据
$result
[]
=
self
::
genLeftNavGuang
(
$guangChoosed
);
return
$result
;
}
/**
* 获取并生成左侧边栏中逛的数据
*
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
* @return array
*/
private
static
function
genLeftNavGuang
(
$guangChoosed
=
'all'
)
{
return
array
(
'textCn'
=>
'逛'
,
'textEn'
=>
'TRENDFINDER'
,
'styleClass'
=>
'guang'
,
'subNav'
=>
array
(
'list'
=>
array
(
0
=>
array
(
'textCn'
=>
'逛'
,
'textEn'
=>
'TrendFinder'
,
'back'
=>
true
,
'isSelect'
=>
false
,
'bgColor'
=>
(
$guangChoosed
===
'girls'
)
?
'#FF88AE'
:
false
,
),
1
=>
array
(
'textCn'
=>
'查看全部'
,
'textEn'
=>
''
,
'back'
=>
false
,
'isSelect'
=>
(
$guangChoosed
===
'all'
)
?
true
:
false
,
'url'
=>
'/guang/list/index?gender=1,2,3'
),
2
=>
array
(
'textCn'
=>
'只看男生'
,
'textEn'
=>
'Boys'
,
'back'
=>
false
,
'isSelect'
=>
(
$guangChoosed
===
'boys'
)
?
true
:
false
,
'url'
=>
'/guang/list/index?gender=1,3'
),
3
=>
array
(
'textCn'
=>
'只看女生'
,
'textEn'
=>
'Girls'
,
'back'
=>
false
,
'isSelect'
=>
(
$guangChoosed
===
'girls'
)
?
true
:
false
,
'url'
=>
'/guang/list/index?gender=2,3'
,
),
)
)
);
}
}
...
...
Please
register
or
login
to post a comment