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
yangyang
9 years ago
Commit
f73e1d99afa90054b42cd056e0d11e8d774e2890
1 parent
58d4d312
并行搜索地址写到helpersrarch文件中
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
152 additions
and
4 deletions
library/Plugin/HelperSearch.php
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
library/Plugin/HelperSearch.php
View file @
f73e1d9
...
...
@@ -3,6 +3,7 @@
namespace
Plugin
;
use
Plugin\Paging
;
use
LibModels\Web\Product\BrandData
;
use
Api\Yohobuy
;
/**
* 搜索辅助类
*/
...
...
@@ -1112,4 +1113,151 @@ class HelperSearch
}
}
/**
* 并行调接口url获取(搜索产品数据)
* @param
*/
public static function getProductUrl(
$condition
)
{
// 排序数据映射表
$orderMaps
= array(
's_t_desc' => 'shelve_time:desc',
's_t_asc' => 'shelve_time:asc',
's_p_asc' => 'sales_price:asc',
's_p_desc' => 'sales_price:desc',
'p_d_desc' => 'discount:desc',
'p_d_asc' => 'discount:asc',
'skn_desc' => 'product_skn:desc',
'skn_asc' => 'product_skn:asc',
'activities_desc' => 'activities.order_by:desc',
'activities_asc' => 'activities.order_by:asc',
's_n_asc' => 'sales_num:asc',
's_n_desc' => 'sales_num:desc',
'activities_id_desc' => 'activities.activity_id:desc',
'activities_id_asc' => 'activities.activity_id:asc',
);
$param
= array();
$param['status']
= 1; // 是否上架,1表示在架,2表示不在
$param['sales']
= 'Y'; // 只搜索销售的产品
$param['stocknumber']
= 1; // 过滤掉已售罄的商品
//
$param['needFilter']
= 1; // 是否需要返回筛选条件
if (!isset(
$condition['order']
)) {
$param['order']
=
$orderMaps['s_t_desc']
;
} else {
$param['order']
=
$orderMaps[$condition['order']]
;
}
if (!isset(
$condition['page']
)) {
$param['page']
= 1;
}
if(isset(
$condition['viewNum']
)) {
$param['viewNum']
=
$condition['viewNum']
;
} else if (!isset(
$condition['limit']
)) {
$param['viewNum']
= 60;
} else {
$param['viewNum']
=
$condition['limit']
;
unset(
$condition['limit']
);
}
if (!empty(
$condition
)) {
$param
+=
$condition
;
}
return Yohobuy::httpBuildQuery(self::getUrl(),
$param
);
}
/**
* 并行调接口url获取(产品分类)
* @param
*/
public static function getClassesUrl(
$condition
)
{
$condition['sales']
= 'Y'; //在销售商品分类
$condition['status']
= 1; //上架商品分类
$condition['stocknumber']
= 1; //过滤掉已售罄
return Yohobuy::httpBuildQuery(self::getUrl('sort'),
$condition
);
}
/**
* 并行调接口url获取(获取折扣区间)
* @param
*/
public static function getDiscountUrl(
$param
= array())
{
return Yohobuy::httpBuildQuery(self::getUrl('discount'),
$param
);
}
/**
* 并行调接口url获取(获取最新上架)
*/
public static function getRecentShelveUrl(
$param
= array())
{
return Yohobuy::httpBuildQuery(self::getUrl('recent'),
$param
);
}
/**
* 并行调接口url获取(获取用户浏览记录)
*/
// public static function getReviewUrl(
$param
= array())
// {
// return Yohobuy::httpBuildQuery(self::getUrl('review'),
$param
);
// }
/**
* 获取搜索的服务地址
*
* 备注:此处是根据环境来确定使用阿里云内网还是外网的URL
*
* @return string
*/
private static function getUrl(
$type
= 'search')
{
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
switch (APPLICATION_ENV) {
case 'release':
if (
$type
== 'sort') {
return 'http://100.98.132.63/yohosearch/sortgroup.json';
}
elseif (
$type
== 'discount') {
return 'http://100.98.132.63/yohosearch/discount.json';
}
elseif (
$type
== 'recent') {
return 'http://100.98.132.63/yohosearch/recent.json';
}
// elseif (
$type
== 'review') {
//
// }
elseif (
$type
== 'shop') {
return 'http://100.98.132.63/yohosearch/shops.json';
}
return 'http://100.98.132.63/yohosearch/search.json';
case 'test':
case 'preview':
case 'developer':
default:
if (
$type
== 'sort') {
return 'http://101.200.31.165/yohosearch/sortgroup.json';
}
elseif (
$type
== 'discount') {
return 'http://101.200.31.165/yohosearch/discount.json';
}
elseif (
$type
== 'recent') {
return 'http://101.200.31.165/yohosearch/recent.json';
}
// elseif (
$type
== 'review') {
//
// }
elseif (
$type
== 'shop') {
return 'http://101.200.31.165/yohosearch/shops.json';
}
return 'http://101.200.31.165/yohosearch/search.json';
}
}
}
...
...
yohobuy/www.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
f73e1d9
...
...
@@ -17,10 +17,10 @@ class IndexController extends WebAction
$uid
=
$this
->
getUid
();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效)
$brandInfo
=
BrandData
::
getBrandLogoByDomain
(
$domain
);
if
(
!
empty
(
$brandInfo
[
'data'
])
&&
$brandInfo
[
'code'
]
===
200
)
{
if
(
!
empty
(
$brandInfo
[
'data'
])
&&
$brandInfo
[
'code'
]
===
200
)
{
$brandId
=
$brandInfo
[
'data'
][
'id'
];
$node
=
isset
(
$brandInfo
[
'static_content_code'
])
?
$brandInfo
[
'static_content_code'
]
:
false
;
}
else
{
}
else
{
$this
->
go
(
SITE_MAIN
);
}
...
...
@@ -60,7 +60,7 @@ class IndexController extends WebAction
$condition
[
'gender'
]
=
$gender
;
//每页显示商品数
if
(
!
isset
(
$condition
[
'viewNum'
])
||
empty
(
$condition
[
'viewNum'
]))
{
if
(
!
isset
(
$condition
[
'viewNum'
])
||
empty
(
$condition
[
'viewNum'
]))
{
$condition
[
'viewNum'
]
=
60
;
}
$view_num_arr
=
array
(
60
,
100
,
200
);
...
...
@@ -68,7 +68,7 @@ class IndexController extends WebAction
$condition
[
'viewNum'
]
=
60
;
}
//每行显示的商品数量
if
(
!
isset
(
$condition
[
'rowNum'
])
||
empty
(
$condition
[
'rowNum'
]))
{
if
(
!
isset
(
$condition
[
'rowNum'
])
||
empty
(
$condition
[
'rowNum'
]))
{
$condition
[
'rowNum'
]
=
5
;
}
if
(
$condition
[
'rowNum'
]
==
6
)
{
...
...
Please
register
or
login
to post a comment