Commit 1189b39b authored by luhongguang's avatar luhongguang

update:es增加生活号id搜索

parent 8352818c
......@@ -91,6 +91,7 @@ class GoodsToEsController extends Cli
"category_2_id" => $goodsSkuInfo["category_2_id"],
"category_1_name" => $nameList[0],
"category_2_name" => $nameList[1],
"life_account_id" => $goodsSkuInfo["life_account_id"],
"life_account_name" => empty($lifeAccountRes["response"]["result"]["life_account_name"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_name"],
"life_account_icon" => empty($lifeAccountRes["response"]["result"]["life_account_icon"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_icon"],
"shop_name" => $subShop["shop_name"],
......
......@@ -150,6 +150,7 @@ class ElasticGoodService
$result["list"][$key]["online_status"] = $source["_source"]["online_status"];
$result["list"][$key]["shop_name"] = $source["_source"]["shop_name"];
$result["list"][$key]["shop_location"] = $source["_source"]["shop_location"];
$result["list"][$key]["life_account_id"] = $source["_source"]["life_account_id"];
$result["list"][$key]["life_account_name"] = $source["_source"]["life_account_name"];
$result["list"][$key]["life_account_icon"] = $source["_source"]["life_account_icon"];
$result["list"][$key]["distance"] = empty($source["sort"][1]) ? "" : round($source["sort"][1], 2) . "km";
......@@ -219,6 +220,7 @@ class ElasticGoodService
$longitude = empty($params["longitude"]) ? "" : $params["longitude"];
$searchContent = empty($params["search_content"]) ? "" : $params["search_content"];
$subjectName = empty($params["subject_name"]) ? "" : $params["subject_name"];
$lifeAccountId = empty($params["life_account_id"]) ? "" : $params["life_account_id"];
$data = [
"from" => ($from - 1) * $size,
......@@ -229,7 +231,7 @@ class ElasticGoodService
["term" => ["audit_status" => GoodsSku::STATUS_PASS]],
["term" => ["online_status" => GoodsSku::ONLINE_STATUS_ONLINE]],
];
if (!empty($searchContent)) {
if (!empty($searchContent) || (!empty($subjectName) && $subjectName != "本周上新")) {
$multiMatch = [["multi_match" => [
"query" => $searchContent.$subjectName,
"fields" => ["goods_name", "category_1_name", "category_2_name", "desc", "life_account_name", "shop_name"],
......@@ -240,6 +242,11 @@ class ElasticGoodService
$data["query"]["bool"]["must"] = $mustInit;
}
if (!empty($lifeAccountId)) {
$lifeAccountData = [["term" => ["life_account_id" => $lifeAccountId]]];
$data["query"]["bool"]["must"] = array_merge($data["query"]["bool"]["must"], $lifeAccountData);
}
if (!empty($latitude) && !empty($longitude)) {
$data["query"]["bool"]["filter"]["geo_distance"] = [
"distance" => "50km",
......
......@@ -983,6 +983,7 @@ class GoodsService
"category_2_id" => $goodsSkuInfo["category_2_id"],
"category_1_name" => $nameList[0],
"category_2_name" => $nameList[1],
"life_account_id" => $goodsSkuInfo["life_account_id"],
"life_account_name" => empty($lifeAccountRes["response"]["result"]["life_account_name"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_name"],
"life_account_icon" => empty($lifeAccountRes["response"]["result"]["life_account_icon"]) ? "" : $lifeAccountRes["response"]["result"]["life_account_icon"],
"shop_name" => $subShop["shop_name"],
......@@ -1237,6 +1238,7 @@ class GoodsService
foreach ($strList as $key => $str) {
$arr = explode("/", $str);
if (count($arr) != 2) {
$data[$key] = "";
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment