Commit 40ae5b42 authored by jianghaiming's avatar jianghaiming

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

parents b380575f daddd249
...@@ -13,12 +13,12 @@ use App\Services\shop\ShopService; ...@@ -13,12 +13,12 @@ use App\Services\shop\ShopService;
/** /**
* 同步商品数据到es * 同步商品数据到es
* php public/cli.php goodsToEs index * php public/cli.php goodstoes index
* Class GoodsToEsController * Class GoodsToEsController
*/ */
class GoodsToEsController extends Cli class GoodstoesController extends Cli
{ {
public function IndexAction() public function indexAction()
{ {
$this->initEsIndex(); $this->initEsIndex();
......
...@@ -15,10 +15,10 @@ use \App\Models\shop\mysql\Shop; ...@@ -15,10 +15,10 @@ use \App\Models\shop\mysql\Shop;
/** /**
* 导入老商品数据 * 导入老商品数据
* php public/cli.php GoodsToInit run * php public/cli.php goodstoinit run
* Class GoodsToInitController * Class GoodsToInitController
*/ */
class GoodsToInitController extends Cli class GoodstoinitController extends Cli
{ {
public function runAction() public function runAction()
{ {
...@@ -32,7 +32,7 @@ class GoodsToInitController extends Cli ...@@ -32,7 +32,7 @@ class GoodsToInitController extends Cli
//处理 shop 数据 //处理 shop 数据
$this->dealShopData($list); $this->dealShopData($list);
//处理商品数据 //处理商品数据
// $this->dealGoodsData($list); $this->dealGoodsData($list);
} }
} }
...@@ -228,6 +228,8 @@ class GoodsToInitController extends Cli ...@@ -228,6 +228,8 @@ class GoodsToInitController extends Cli
$originalPrice = $item["price"] * 100; $originalPrice = $item["price"] * 100;
$price = $item["rawPrice"] * 100; $price = $item["rawPrice"] * 100;
$goodsSpu = GoodsSpu::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
if (empty($goodsSpu)) {
$spuParams = [ $spuParams = [
"goods_spu_id" => $goodsSpuId, "goods_spu_id" => $goodsSpuId,
"shop_id" => $shopId, "shop_id" => $shopId,
...@@ -244,7 +246,10 @@ class GoodsToInitController extends Cli ...@@ -244,7 +246,10 @@ class GoodsToInitController extends Cli
"rule_refund" => $ruleRefund, "rule_refund" => $ruleRefund,
]; ];
GoodsSpu::save($spuParams); GoodsSpu::save($spuParams);
}
$goodsSku = GoodsSku::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
if (empty($goodsSku)) {
$skuParams = [ $skuParams = [
"goods_sku_id" => $goodsSkuId, "goods_sku_id" => $goodsSkuId,
"goods_spu_id" => $goodsSpuId, "goods_spu_id" => $goodsSpuId,
...@@ -273,8 +278,9 @@ class GoodsToInitController extends Cli ...@@ -273,8 +278,9 @@ class GoodsToInitController extends Cli
"price" => $price, "price" => $price,
"is_import" => 1, "is_import" => 1,
]; ];
GoodsSku::save($skuParams); GoodsSku::save($skuParams);
}
$subShop = json_decode($item["shopJson"], true); $subShop = json_decode($item["shopJson"], true);
if (!empty($subShop)) { if (!empty($subShop)) {
......
...@@ -214,7 +214,7 @@ class GoodsService ...@@ -214,7 +214,7 @@ class GoodsService
"rule_end_time" => empty($skuData["rule_end_time"]) ? "" : $skuData["rule_end_time"], "rule_end_time" => empty($skuData["rule_end_time"]) ? "" : $skuData["rule_end_time"],
"inventory_total" => $skuData["inventory"], "inventory_total" => $skuData["inventory"],
"inventory_rest" => $skuData["inventory"], "inventory_rest" => $skuData["inventory"],
"original_price" => $skuData["original_price"] * 100, "original_price" => empty($skuData["original_price"]) ? 0 : $skuData["original_price"] * 100,
"price" => $skuData["price"] * 100, "price" => $skuData["price"] * 100,
]; ];
if (!empty($skuData["setmeal"])) { if (!empty($skuData["setmeal"])) {
...@@ -937,12 +937,11 @@ class GoodsService ...@@ -937,12 +937,11 @@ class GoodsService
} }
if (!empty($lastId)) { if (!empty($lastId)) {
$where["goods_spu_id[>]"] = $lastId; $where["goods_spu_id[<]"] = $lastId;
} }
$where["life_account_id"] = $lifeAccountId; $where["life_account_id"] = $lifeAccountId;
$where["inventory_rest[>]"] = 0;
$where["LIMIT"] = $limit; $where["LIMIT"] = $limit;
$where["ORDER"] = ["update_time" => "DESC"]; $where["ORDER"] = ["goods_spu_id" => "DESC"];
$list = GoodsSku::select(["goods_spu_id", "goods_sku_id", "goods_name", "desc", "desc_pic_url", "total_amount_sold", "inventory_rest", "original_price", $list = GoodsSku::select(["goods_spu_id", "goods_sku_id", "goods_name", "desc", "desc_pic_url", "total_amount_sold", "inventory_rest", "original_price",
"price", "audit_status", "online_status"], $where); "price", "audit_status", "online_status"], $where);
......
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