Authored by 郭成尧

'search-activity'

... ... @@ -245,4 +245,18 @@ class SearchData
return $result;
}
/**
* 查询关键词是否正参加活动
* @param $queryWords
* @return mixed
*/
public static function searchKeyActivity($queryWords)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.word';
$param['query'] = $queryWords;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(API_URL, $param);
}
}
... ...
... ... @@ -237,6 +237,13 @@ class SearchController extends AbstractAction
{
header('Access-Control-Allow-Origin:*');
if ($this->get('query')) {
$activity = SearchData::searchKeyActivity($this->get('query'));
if ($activity['code'] === 200 && isset($activity['data']) && isset($activity['data']['url'])) {
$this->go($activity['data']['url']);
}
}
$data = \Product\SearchModel::search();
if (empty($data['new'])) {
... ...