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,53 +228,59 @@ class GoodsToInitController extends Cli ...@@ -228,53 +228,59 @@ class GoodsToInitController extends Cli
$originalPrice = $item["price"] * 100; $originalPrice = $item["price"] * 100;
$price = $item["rawPrice"] * 100; $price = $item["rawPrice"] * 100;
$spuParams = [ $goodsSpu = GoodsSpu::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
"goods_spu_id" => $goodsSpuId, if (empty($goodsSpu)) {
"shop_id" => $shopId, $spuParams = [
"life_account_id" => $lifeAccountId, "goods_spu_id" => $goodsSpuId,
"publish_user_id" => $publicUserId, "shop_id" => $shopId,
"goods_name" => $goodsName, "life_account_id" => $lifeAccountId,
"desc_pic_url" => $descPicUrl, "publish_user_id" => $publicUserId,
"desc" => $desc, "goods_name" => $goodsName,
"goods_type" => GoodsSpu::TYPE_VIRTUAL, "desc_pic_url" => $descPicUrl,
"goods_sub_type" => GoodsSpu::SUB_TYPE_TO_SHOP, "desc" => $desc,
"goods_sale_type" => GoodsSpu::SALE_TYPE_NO_COMBINATION, "goods_type" => GoodsSpu::TYPE_VIRTUAL,
"rule_limit" => $ruleLimit, "goods_sub_type" => GoodsSpu::SUB_TYPE_TO_SHOP,
"rule_desc" => $ruleDesc, "goods_sale_type" => GoodsSpu::SALE_TYPE_NO_COMBINATION,
"rule_refund" => $ruleRefund, "rule_limit" => $ruleLimit,
]; "rule_desc" => $ruleDesc,
GoodsSpu::save($spuParams); "rule_refund" => $ruleRefund,
];
GoodsSpu::save($spuParams);
}
$skuParams = [ $goodsSku = GoodsSku::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
"goods_sku_id" => $goodsSkuId, if (empty($goodsSku)) {
"goods_spu_id" => $goodsSpuId, $skuParams = [
"life_account_id" => $lifeAccountId, "goods_sku_id" => $goodsSkuId,
"shop_id" => $shopId, "goods_spu_id" => $goodsSpuId,
"publish_user_id" => $publicUserId, "life_account_id" => $lifeAccountId,
"category_1_id" => $categoryOneId, "shop_id" => $shopId,
"category_2_id" => $categoryTwoId, "publish_user_id" => $publicUserId,
"goods_name" => $goodsName, "category_1_id" => $categoryOneId,
"desc_pic_url" => $descPicUrl, "category_2_id" => $categoryTwoId,
"desc" => $desc, "goods_name" => $goodsName,
"introduce" => $introduce, "desc_pic_url" => $descPicUrl,
"introduce_pic_url" => $introducePicUrl, "desc" => $desc,
"expiration_time" => $expirationTime, "introduce" => $introduce,
"rule_limit" => $ruleLimit, "introduce_pic_url" => $introducePicUrl,
"rule_desc" => $ruleDesc, "expiration_time" => $expirationTime,
"rule_refund" => $ruleRefund, "rule_limit" => $ruleLimit,
"rule_date_type" => $ruleDateType, "rule_desc" => $ruleDesc,
"rule_start_time" => $ruleStartTime, "rule_refund" => $ruleRefund,
"rule_end_time" => $ruleEndTime, "rule_date_type" => $ruleDateType,
"inventory_total" => $inventoryTotal, "rule_start_time" => $ruleStartTime,
"inventory_rest" => $inventoryRest, "rule_end_time" => $ruleEndTime,
"total_amount_order" => $totalAmountOrder, "inventory_total" => $inventoryTotal,
"total_amount_sold" => $totalAmountOrder, "inventory_rest" => $inventoryRest,
"original_price" => $originalPrice, "total_amount_order" => $totalAmountOrder,
"price" => $price, "total_amount_sold" => $totalAmountOrder,
"is_import" => 1, "original_price" => $originalPrice,
]; "price" => $price,
"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