Commit fe548a28 authored by jianghaiming's avatar jianghaiming

Merge branch 'develop' of https://gitlab.yidian-inc.com/bp/goods into develop

parents c7c297ff 254008a0
......@@ -3,6 +3,7 @@
namespace App\Services\goods;
use Api\PhpUtils\Common\BaseConvert;
use Api\PhpUtils\Common\IP;
use Api\PhpUtils\Elastic\ElasticUtil;
use App\Models\goods\mysql\GoodsSku;
......@@ -15,6 +16,11 @@ class ElasticGoodService
const SORT_TYPE_SALES = 2;
const SORT_TYPE_PRICE = 3;
//添加生活号id,这里的生活号id发的商品,es查不出来
const TEST_LIFE_ACCOUNT_ID = [];
//公司内网wifi ip
const WIFI_IPS = ['123.103.40.112','123.103.40.113','123.103.40.114','123.103.40.115','123.103.40.116','123.103.40.117'];
public static function createIndex()
{
$elasticClient = ElasticUtil::getInstance();
......@@ -221,6 +227,7 @@ class ElasticGoodService
$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"];
$ip = empty($params["ip"]) ? "" : $params["ip"];
$data = [
"from" => ($from - 1) * $size,
......@@ -231,6 +238,13 @@ class ElasticGoodService
["term" => ["audit_status" => GoodsSku::STATUS_PASS]],
["term" => ["online_status" => GoodsSku::ONLINE_STATUS_ONLINE]],
];
//线上环境,配置不允许发现的生活号发布的商品
$env = \Yaf\Application::app()->environ();
if (in_array($env, ['dev'])) {
if (!empty(self::TEST_LIFE_ACCOUNT_ID) && !in_array($ip, self::WIFI_IPS)) {
$data["query"]["bool"]["must_not"] = ["terms" => ["life_account_id" => self::TEST_LIFE_ACCOUNT_ID]];
}
}
//gte 是大于等于; gt是大于; lte是小于等于; lt是小于
$data["query"]["bool"]["filter"][]["range"] = ["inventory_rest" => [["gt" => 0]]];
//$data["query"]["bool"]["filter"][]["range"] = ["price" => [["gt" => 0]]];
......
......@@ -655,7 +655,7 @@ class GoodsService
"inventory_total" => $skuData["inventory_total"] + $params["inventory_add"],
//"inventory_total" => $params["inventory"],
"inventory_rest" => $inventoryCount,
"original_price" => $params["original_price"] * 100,
"original_price" => empty($params["original_price"]) ? 0 : $params["original_price"] * 100,
"price" => $params["price"] * 100,
"goods_version" => (int)$skuData["goods_version"] + 1,
];
......
......@@ -2,8 +2,8 @@
application.directory = APPLICATION_PATH"/application"
application.library = APPLICATION_PATH"/application/library"
application.bootstrap = APPLICATION_PATH"/application/BootstrapCli.php"
application.dispatcher.catchException = true
application.dispatcher.throwException = true
application.dispatcher.catchException = false
application.dispatcher.throwException = false
daemon.script_dir = "\\Daemon\\"
appid = "goods"
......
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