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
hf
9 years ago
Commit
76acb1af8ebc9e485ff9f395a7370e1956d984e3
1 parent
5daf4c37
modify to fixes bug to brand list
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
52 deletions
library/LibModels/Wap/Product/NewsaleData.php
library/Plugin/DataProcess/ListProcess.php
library/Plugin/DataProcess/NewSaleProcess.php
script/nginx/conf/vhosts/nginx.test.yohobuy.conf
yohobuy/m.yohobuy.com/application/controllers/Search.php
yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
yohobuy/m.yohobuy.com/application/modules/Category/controllers/Class.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
yohobuy/m.yohobuy.com/configs/routes.index.ini
library/LibModels/Wap/Product/NewsaleData.php
View file @
76acb1a
...
...
@@ -112,7 +112,7 @@ class NewsaleData
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
API_URL
,
$param
,
600
);
// 缓存10分钟
}
/**
...
...
library/Plugin/DataProcess/ListProcess.php
View file @
76acb1a
<?php
namespace
Plugin\DataProcess
;
use
Plugin\Helpers
;
/**
...
...
@@ -17,19 +18,16 @@ class ListProcess
*/
public
static
function
getListData
(
$data
)
{
$result
=
array
(
'new'
=>
array
(),
'filter'
=>
array
());
$result
=
array
(
'new'
=>
array
(),
'filter'
=>
array
());
if
(
isset
(
$data
[
'product_list'
]))
{
if
(
isset
(
$data
[
'product_list'
]))
{
$result
[
'new'
]
=
self
::
getProductData
(
$data
[
'product_list'
]);
}
if
(
isset
(
$data
[
'filter'
]))
{
if
(
isset
(
$data
[
'filter'
]))
{
$result
[
'filter'
]
=
self
::
getFilterData
(
$data
[
'filter'
]);
}
return
$result
;
}
/**
...
...
@@ -43,13 +41,11 @@ class ListProcess
// 处理商品
$products
=
array
();
foreach
(
$data
as
$value
)
{
foreach
(
$data
as
$value
)
{
$products
[]
=
Helpers
::
formatProduct
(
$value
,
true
,
true
,
true
,
true
);
}
return
$products
;
}
/**
...
...
@@ -61,24 +57,23 @@ class ListProcess
public
static
function
getFilterData
(
$data
)
{
// 过滤条件数据
$filters
=
array
(
'classify'
=>
array
());
$filters
=
array
(
'classify'
=>
array
());
$num
=
1
;
$build
=
array
();
foreach
(
$data
as
$key
=>
$val
)
{
if
(
empty
(
$val
))
{
if
(
empty
(
$val
))
{
continue
;
}
if
(
!
is_callable
(
"self::
$key
"
))
{
continue
;
}
$build
=
self
::
$key
(
$val
);
if
(
$num
===
1
)
{
if
(
$num
===
1
)
{
$build
[
'active'
]
=
true
;
}
$num
++
;
$num
++
;
$filters
[
'classify'
][]
=
$build
;
}
...
...
@@ -86,7 +81,6 @@ class ListProcess
self
::
sortArrByField
(
$filters
[
'classify'
],
'sort_col'
);
return
$filters
;
}
private
static
function
brand
(
$data
)
...
...
@@ -165,7 +159,7 @@ class ListProcess
foreach
(
$data
as
$key
=>
$one
)
{
$discount
=
array
();
$discount
[
'dataId'
]
=
$key
;
$discount
[
'name'
]
=
$one
[
'name'
]
.
'折商品'
;
$discount
[
'name'
]
=
$one
[
'name'
]
.
'折商品'
;
$result
[
'subs'
][]
=
$discount
;
}
...
...
@@ -221,18 +215,18 @@ class ListProcess
$category
[
'dataId'
]
=
isset
(
$one
[
'relation_parameter'
])
?
$one
[
'relation_parameter'
][
'sort'
]
:
0
;
$category
[
'name'
]
=
$one
[
'category_name'
];
/*// 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
/* // 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
foreach ($one['sub'] as $single) {
$subitem = array();
$subitem['dataId'] = $single['category_id'];
$subitem['name'] = $single['category_name'];
$category['subs'][] = $subitem;
}
}*/
$category['subs'][] = $subitem;
}
} */
$result
[
'subs'
][]
=
$category
;
}
...
...
@@ -285,7 +279,7 @@ class ListProcess
foreach
(
$data
as
$one
)
{
$size
=
array
();
$size
[
'dataId'
]
=
$one
[
'size_id'
];
$size
[
'dataId'
]
=
$one
[
'size_id'
];
$size
[
'name'
]
=
$one
[
'size_name'
];
$result
[
'subs'
][]
=
$size
;
...
...
@@ -301,7 +295,8 @@ class ListProcess
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
){
private
static
function
sortArrByField
(
&
$array
,
$field
,
$desc
=
false
)
{
$fieldArr
=
array
();
foreach
(
$array
as
$k
=>
$v
)
{
$fieldArr
[
$k
]
=
$v
[
$field
];
...
...
@@ -309,4 +304,5 @@ class ListProcess
$sort
=
$desc
==
false
?
SORT_ASC
:
SORT_DESC
;
array_multisort
(
$fieldArr
,
$sort
,
$array
);
}
}
...
...
library/Plugin/DataProcess/NewSaleProcess.php
View file @
76acb1a
...
...
@@ -43,8 +43,7 @@ class NewSaleProcess
// 处理商品
if
(
isset
(
$products
[
'product_list'
]))
{
foreach
(
$products
[
'product_list'
]
as
$single
)
{
$result
[
'goods'
][]
=
Helpers
::
formatProduct
(
$single
,
true
,
false
,
false
);
$result
[
'goods'
][]
=
Helpers
::
formatProduct
(
$single
,
true
,
false
,
false
,
290
,
388
);
}
}
...
...
script/nginx/conf/vhosts/nginx.test.yohobuy.conf
View file @
76acb1a
...
...
@@ -201,6 +201,14 @@ server
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
location
^~ /
plustar
{
proxy_redirect
off
;
proxy_pass
http
://
yohobuy
;
proxy_set_header
Host
$
host
;
proxy_set_header
X
-
Real
-
IP
$
remote_addr
;
proxy_set_header
X
-
Forwarded
-
For
$
proxy_add_x_forwarded_for
;
proxy_set_header
Accept
-
Encoding
"gzip"
;
}
# 搜索相关
location
^~ /
search
{
...
...
yohobuy/m.yohobuy.com/application/controllers/Search.php
View file @
76acb1a
...
...
@@ -149,6 +149,9 @@ class SearchController extends AbstractAction
$this
->
setTitle
(
'搜索'
);
$this
->
setNavHeader
(
'搜索'
,
true
,
SITE_MAIN
);
}
// 右下角的购物车链接
$data
[
'goodList'
][
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
,
null
);
// // 查询数据
// if (!isset($condition['query'])) {
...
...
yohobuy/m.yohobuy.com/application/models/Product/Newsale.php
View file @
76acb1a
...
...
@@ -46,7 +46,6 @@ class NewsaleModel
switch
(
intval
(
$channel
))
{
case
1
:
// 男生
$result
=
self
::
cacheControl
(
CacheConfig
::
KEY_ACTION_PRODUCT_NEWSALE_INDEX_BOYS
,
self
::
CODE_TOP_NEW_BOYS
);
break
;
case
2
:
// 女生
$result
=
self
::
cacheControl
(
CacheConfig
::
KEY_ACTION_PRODUCT_NEWSALE_INDEX_GIRLS
,
self
::
CODE_TOP_NEW_GIRLS
);
...
...
@@ -214,7 +213,7 @@ class NewsaleModel
if
(
isset
(
$data
[
'code'
])
&&
$data
[
'code'
]
===
200
)
{
foreach
(
$data
[
'data'
][
'product_list'
]
as
$val
)
{
$result
[
'goods'
][]
=
Helpers
::
formatProduct
(
$val
,
true
,
false
,
false
);
$result
[
'goods'
][]
=
Helpers
::
formatProduct
(
$val
,
true
,
false
,
false
,
299
,
388
);
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Category/controllers/Class.php
View file @
76acb1a
...
...
@@ -25,7 +25,7 @@ class ClassController extends AbstractAction
'showDownloadApp'
=>
true
,
'category'
=>
array
(
'class'
=>
$classes
,
'searchUrl'
=>
Helpers
::
url
(
'/search
.html
'
,
null
,
'search'
),
'searchUrl'
=>
Helpers
::
url
(
'/search'
,
null
,
'search'
),
)
);
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
76acb1a
...
...
@@ -51,6 +51,10 @@ class IndexController extends AbstractAction
$this
->
setTitle
(
$name
);
$this
->
setNavHeader
(
$name
,
true
,
SITE_MAIN
);
$goodList
=
array
();
$goodList
[
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
,
null
);
$goodList
+=
$condition
;
// $goodList = Product\ListModel::getClassData($condition);
// if (!empty($condition) && !empty($goodList)) {
// $goodList = array_merge($goodList, $condition);
...
...
@@ -58,8 +62,8 @@ class IndexController extends AbstractAction
$this
->
_view
->
display
(
'index'
,
array
(
'goodListPage'
=>
true
,
'showDownloadApp'
=>
true
,
'goodList'
=>
$condition
,
'pageFooter'
=>
true
,
'goodList'
=>
$goodList
,
'pageFooter'
=>
true
,
));
}
...
...
@@ -84,8 +88,9 @@ class IndexController extends AbstractAction
/* 通过品牌域名找到对应的品牌ID */
$domainList
=
Product\ListModel
::
getAllBrandDomains
();
$brandIds
=
array_keys
(
$domainList
,
$domain
);
if
(
!
isset
(
$brandIds
[
0
]))
{
$this
->
go
(
SITE_MAIN
);
$brandId
=
0
;
if
(
isset
(
$brandIds
[
0
]))
{
$brandId
=
$brandIds
[
0
];
}
// 当前的登录用户UID
...
...
@@ -108,8 +113,8 @@ class IndexController extends AbstractAction
'discount'
=>
FILTER_VALIDATE_INT
,
'gender'
=>
FILTER_DEFAULT
,
'p_d'
=>
FILTER_DEFAULT
,),
false
);
$condition
[
'brand'
]
=
$brandIds
[
0
];
$condition
[
'brand'
]
=
$brandId
;
if
(
isset
(
$condition
[
'gender'
]))
{
$condition
[
'gender'
]
=
rawurldecode
(
$condition
[
'gender'
]);
}
...
...
@@ -120,15 +125,18 @@ class IndexController extends AbstractAction
// 从搜索页过来的,显示搜索框, 和进入品牌引导信息
if
(
$from
===
'search'
)
{
$data
[
'goodList'
]
=
array
();
$data
[
'goodList'
][
'brandWay'
]
=
\Product\ListModel
::
getBrandLogoByIds
(
$brandId
s
[
0
]
,
$title
);
$data
[
'goodList'
][
'brandWay'
]
=
\Product\ListModel
::
getBrandLogoByIds
(
$brandId
,
$title
);
$data
[
'goodList'
][
'search'
][
'default'
]
=
$query
;
$data
[
'goodList'
][
'search'
][
'url'
]
=
Helpers
::
url
(
''
,
null
,
'search'
);
}
// 品牌一览过来的展示品牌介绍和LOGO
else
{
$data
[
'brandHome'
]
=
\Product\ListModel
::
getBrandIntro
(
$brandId
s
[
0
]
,
$uid
,
$title
);
$data
[
'brandHome'
]
=
\Product\ListModel
::
getBrandIntro
(
$brandId
,
$uid
,
$title
);
$data
[
'goodList'
]
=
array
();
}
// 右下角的购物车链接
$data
[
'goodList'
][
'cartUrl'
]
=
Helpers
::
url
(
'/cart/index/index'
,
null
);
$data
[
'goodList'
]
+=
$condition
;
$data
[
'pageFooter'
]
=
true
;
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Newsale.php
View file @
76acb1a
...
...
@@ -33,7 +33,8 @@ class NewsaleController extends AbstractAction
'price'
=>
'0'
,
'size'
=>
'0'
,
'dayLimit'
=>
1
,
'discount'
=>
''
'discount'
=>
''
,
'goodList'
=>
array
(
'cartUrl'
=>
Helpers
::
url
(
'/cart/index/index'
,
null
)),
);
$this
->
_view
->
display
(
'new'
,
$data
);
...
...
@@ -61,7 +62,8 @@ class NewsaleController extends AbstractAction
'gender'
=>
Helpers
::
getGenderByCookie
(),
'price'
=>
'0'
,
'size'
=>
'0'
,
'discount'
=>
'0.1,0.9'
'discount'
=>
'0.1,0.9'
,
'goodList'
=>
array
(
'cartUrl'
=>
Helpers
::
url
(
'/cart/index/index'
,
null
)),
);
$this
->
_view
->
display
(
'sale'
,
$data
);
...
...
@@ -97,7 +99,7 @@ class NewsaleController extends AbstractAction
$channel
=
Helpers
::
getChannelByCookie
();
$data
=
NewsaleData
::
selectNewSaleProducts
(
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
,
$dayLimit
,
$limit
,
$page
,
$order
$gender
,
$brand
,
$sort
,
$color
,
$size
,
$price
,
$p_d
,
$channel
,
$dayLimit
,
$limit
,
$page
,
$order
);
$result
=
\Product\NewsaleModel
::
selectData
(
$data
);
}
...
...
yohobuy/m.yohobuy.com/configs/routes.index.ini
View file @
76acb1a
...
...
@@ -104,10 +104,10 @@ routes.goodsfilter.route.controller = Search
routes.goodsfilter.route.action
=
Filter
; 品牌搜索
routes.productnew.type
=
"rewrite"
routes.productnew.match
=
"/brands/search$"
routes.productnew.route.module
=
Category
routes.productnew.route.controller
=
Brand
routes.productnew.route.action
=
Search
routes.brandsearch.type
=
"rewrite"
routes.brandsearch.match
=
"/brands/search$"
routes.brandsearch.route.module
=
Category
routes.brandsearch.route.controller
=
Brand
routes.brandsearch.route.action
=
Search
...
...
Please
register
or
login
to post a comment