Toggle navigation
Toggle navigation
This project
Loading...
Sign in
wangshusheng
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to dashboard
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
周少峰
9 years ago
Commit
6107d347dd218e372e75c08a885de1bedf754aab
1 parent
df678f04
修改接口地址
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
36 deletions
library/LibModels/Web/Product/SearchData.php
library/WebPlugin/HelperSearch.php
yohobuy/www.yohobuy.com/application/models/Product/Search.php
library/LibModels/Web/Product/SearchData.php
View file @
6107d34
...
...
@@ -39,26 +39,26 @@ class SearchData extends \LibModels\Wap\Product\SearchData
default
:
if
(
$type
==
'sort'
)
{
//return 'http://101.200.31.165/yohosearch/sortgroup.json';
return
'http://1
92.168.10.64
:8080/yohosearch/sortgroup.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/sortgroup.json'
;
}
elseif
(
$type
==
'discount'
)
{
//return 'http://101.200.31.165/yohosearch/discount.json';
return
'http://1
92.168.10.64
:8080/yohosearch/discount.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/discount.json'
;
}
elseif
(
$type
==
'recent'
)
{
//return 'http://101.200.31.165/yohosearch/recent.json';
return
'http://1
92.168.10.64
:8080/yohosearch/recent.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/recent.json'
;
}
elseif
(
$type
==
'suggest'
)
{
// return 'http://101.200.31.165/yohosearch/suggest.json';
return
'http://1
92.168.10.64
:8080/yohosearch/suggest.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/suggest.json'
;
}
elseif
(
$type
==
'shop'
)
{
//return 'http://101.200.31.165/yohosearch/shops.json';
return
'http://1
92.168.10.64
:8080/yohosearch/shops.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/shops.json'
;
}
// return 'http://101.200.31.165/yohosearch/search.json';
return
'http://1
92.168.10.64
:8080/yohosearch/search-once.json'
;
return
'http://1
82.92.99.119
:8080/yohosearch/search-once.json'
;
}
}
...
...
library/WebPlugin/HelperSearch.php
View file @
6107d34
...
...
@@ -77,23 +77,31 @@ class HelperSearch
$result
[
'hasNextPage'
]
=
self
::
next
(
$data
[
'product'
][
'page_total'
]);
}
//全部折扣
if
(
$data
[
'discount'
][
'discount'
]
&&
!
empty
(
$data
[
'discount'
][
'discount'
]))
{
if
(
isset
(
$data
[
'discount'
][
'discount'
])
&&
!
empty
(
$data
[
'discount'
][
'discount'
]))
{
$result
[
'leftContent'
][][
'allDiscount'
]
=
self
::
getDiscount
(
$data
[
'discount'
][
'discount'
]);
}
//分类条件(搜索页面)
if
(
isset
(
$data
[
'sort'
])
&&
isset
(
$options
[
'controller'
])
&&
$options
[
'controller'
]
!=
'Search'
)
{
$result
[
'filters'
][
'sort'
]
=
self
::
searchSort
(
$data
[
'sort'
][
'sort'
]);
if
(
isset
(
$data
[
'sort'
][
'sort'
]))
{
//分类条件(搜索页面)
if
(
isset
(
$options
[
'controller'
])
&&
$options
[
'controller'
]
!=
'Search'
)
{
$result
[
'filters'
][
'sort'
]
=
self
::
searchSort
(
$data
[
'sort'
][
'sort'
]);
}
else
{
//左侧分类分类
$result
[
'leftContent'
][][
'allSort'
]
=
self
::
groupSort
(
$data
[
'sort'
][
'sort'
]);
}
}
//左侧分类分类
$result
[
'leftContent'
][][
'allSort'
]
=
isset
(
$data
[
'sort'
])
?
self
::
groupSort
(
$data
[
'sort'
][
'sort'
])
:
array
();
//一周新品上架
$result
[
'leftContent'
][][
'newSales'
]
=
isset
(
$data
[
'recent'
])
?
self
::
recentShelve
(
$data
[
'recent'
][
'recent'
])
:
array
();
if
(
isset
(
$data
[
'recent'
][
'recent'
])
&&
!
empty
(
$data
[
'recent'
][
'recent'
]))
{
$result
[
'leftContent'
][][
'newSales'
]
=
self
::
recentShelve
(
$data
[
'recent'
][
'recent'
]);
}
//品牌banner
$result
[
'brandBanner'
]
=
isset
(
$data
[
'brand'
])
?
self
::
getBannerFormat
(
$data
[
'brand'
],
$options
[
'brandBanner'
])
:
array
();
//总记录数
$result
[
'totalCount'
]
=
$data
[
'product'
][
'total'
];
//品牌店铺信息
$result
[
'shopEntry'
]
=
isset
(
$data
[
'shop'
])
&&
!
empty
(
$data
[
'shop'
])
?
self
::
shop
(
$data
[
'shop'
],
$data
[
'sort'
][
'sort'
])
:
array
();
if
(
isset
(
$data
[
'shop'
])
&&
!
empty
(
$data
[
'shop'
]))
{
$result
[
'shopEntry'
]
=
self
::
shop
(
$data
[
'shop'
],
$data
[
'sort'
][
'sort'
]);
}
//分页
$result
[
'pager'
]
=
self
::
pager
(
$result
[
'totalCount'
],
$options
[
'viewNum'
]
-
1
);
//浏览记录
...
...
yohobuy/www.yohobuy.com/application/models/Product/Search.php
View file @
6107d34
...
...
@@ -2,10 +2,11 @@
namespace
Product
;
use
Api\Yohobuy
;
use
Plugin\Helpers
;
use
Plugin\HelperSearch
;
use
WebPlugin\Helpers
;
use
WebPlugin\HelperSearch
;
use
\LibModels\Web\Product\SearchData
;
use
Configs\CacheConfig
;
use
WebPlugin\Cache
;
/**
* sale首页模板数据模型
...
...
@@ -166,17 +167,17 @@ class SearchModel
{
$urlList
=
array
();
$searchCondition
=
self
::
searchCondition
(
$customCondition
,
$customOptions
);
if
(
USE_CACHE
)
{
$key
=
CacheConfig
::
KEY_WEB_PRODUCT_SEARCH_DATA
;
if
(
!
empty
(
$condition
))
{
$key
.=
http_build_query
(
$searchCondition
[
'condition'
],
null
,
'&'
);
}
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result
=
Cache
::
get
(
$key
,
'master'
);
if
(
!
empty
(
$result
))
{
return
$result
;
}
}
// if (USE_CACHE) {
// $key = CacheConfig::KEY_WEB_PRODUCT_SEARCH_DATA;
// if (!empty($condition)) {
// $key .= http_build_query($searchCondition['condition'], null, '&');
// }
// // 先尝试获取一级缓存(master), 有数据则直接返回.
// $result = Cache::get($key, 'master');
// if (!empty($result)) {
// return $result;
// }
// }
// 组合搜索商品url
$urlList
[
'product'
]
=
HelperSearch
::
getProductUrl
(
$searchCondition
[
'condition'
]);
// 组合搜索分类url
...
...
@@ -190,16 +191,16 @@ class SearchModel
// 组织模板数据
$result
=
HelperSearch
::
getList
(
$data
,
$searchCondition
[
'options'
]);
if
(
USE_CACHE
)
{
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
}
// if (USE_CACHE) {
// // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
// if (empty($result)) {
// $result = Cache::get($key, 'slave');
// }
// // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
// else {
// Cache::set($key, $result, 1800); // 缓存30分钟
// }
// }
return
$result
;
}
/**
...
...
Please
register
or
login
to post a comment