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;
/**
* 同步商品数据到es
* php public/cli.php goodsToEs index
* php public/cli.php goodstoes index
* Class GoodsToEsController
*/
class GoodsToEsController extends Cli
class GoodstoesController extends Cli
{
public function IndexAction()
public function indexAction()
{
$this->initEsIndex();
......
......@@ -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 extends Cli
class GoodstoinitController extends Cli
{
public function runAction()
{
......@@ -32,7 +32,7 @@ class GoodsToInitController extends Cli
//处理 shop 数据
$this->dealShopData($list);
//处理商品数据
// $this->dealGoodsData($list);
$this->dealGoodsData($list);
}
}
......@@ -228,53 +228,59 @@ class GoodsToInitController extends Cli
$originalPrice = $item["price"] * 100;
$price = $item["rawPrice"] * 100;
$spuParams = [
"goods_spu_id" => $goodsSpuId,
"shop_id" => $shopId,
"life_account_id" => $lifeAccountId,
"publish_user_id" => $publicUserId,
"goods_name" => $goodsName,
"desc_pic_url" => $descPicUrl,
"desc" => $desc,
"goods_type" => GoodsSpu::TYPE_VIRTUAL,
"goods_sub_type" => GoodsSpu::SUB_TYPE_TO_SHOP,
"goods_sale_type" => GoodsSpu::SALE_TYPE_NO_COMBINATION,
"rule_limit" => $ruleLimit,
"rule_desc" => $ruleDesc,
"rule_refund" => $ruleRefund,
];
GoodsSpu::save($spuParams);
$goodsSpu = GoodsSpu::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
if (empty($goodsSpu)) {
$spuParams = [
"goods_spu_id" => $goodsSpuId,
"shop_id" => $shopId,
"life_account_id" => $lifeAccountId,
"publish_user_id" => $publicUserId,
"goods_name" => $goodsName,
"desc_pic_url" => $descPicUrl,
"desc" => $desc,
"goods_type" => GoodsSpu::TYPE_VIRTUAL,
"goods_sub_type" => GoodsSpu::SUB_TYPE_TO_SHOP,
"goods_sale_type" => GoodsSpu::SALE_TYPE_NO_COMBINATION,
"rule_limit" => $ruleLimit,
"rule_desc" => $ruleDesc,
"rule_refund" => $ruleRefund,
];
GoodsSpu::save($spuParams);
}
$skuParams = [
"goods_sku_id" => $goodsSkuId,
"goods_spu_id" => $goodsSpuId,
"life_account_id" => $lifeAccountId,
"shop_id" => $shopId,
"publish_user_id" => $publicUserId,
"category_1_id" => $categoryOneId,
"category_2_id" => $categoryTwoId,
"goods_name" => $goodsName,
"desc_pic_url" => $descPicUrl,
"desc" => $desc,
"introduce" => $introduce,
"introduce_pic_url" => $introducePicUrl,
"expiration_time" => $expirationTime,
"rule_limit" => $ruleLimit,
"rule_desc" => $ruleDesc,
"rule_refund" => $ruleRefund,
"rule_date_type" => $ruleDateType,
"rule_start_time" => $ruleStartTime,
"rule_end_time" => $ruleEndTime,
"inventory_total" => $inventoryTotal,
"inventory_rest" => $inventoryRest,
"total_amount_order" => $totalAmountOrder,
"total_amount_sold" => $totalAmountOrder,
"original_price" => $originalPrice,
"price" => $price,
"is_import" => 1,
];
$goodsSku = GoodsSku::getRecord(["life_account_id"=>$lifeAccountId, "goods_name"=>$goodsName]);
if (empty($goodsSku)) {
$skuParams = [
"goods_sku_id" => $goodsSkuId,
"goods_spu_id" => $goodsSpuId,
"life_account_id" => $lifeAccountId,
"shop_id" => $shopId,
"publish_user_id" => $publicUserId,
"category_1_id" => $categoryOneId,
"category_2_id" => $categoryTwoId,
"goods_name" => $goodsName,
"desc_pic_url" => $descPicUrl,
"desc" => $desc,
"introduce" => $introduce,
"introduce_pic_url" => $introducePicUrl,
"expiration_time" => $expirationTime,
"rule_limit" => $ruleLimit,
"rule_desc" => $ruleDesc,
"rule_refund" => $ruleRefund,
"rule_date_type" => $ruleDateType,
"rule_start_time" => $ruleStartTime,
"rule_end_time" => $ruleEndTime,
"inventory_total" => $inventoryTotal,
"inventory_rest" => $inventoryRest,
"total_amount_order" => $totalAmountOrder,
"total_amount_sold" => $totalAmountOrder,
"original_price" => $originalPrice,
"price" => $price,
"is_import" => 1,
];
GoodsSku::save($skuParams);
}
GoodsSku::save($skuParams);
$subShop = json_decode($item["shopJson"], true);
if (!empty($subShop)) {
......
......@@ -214,7 +214,7 @@ class GoodsService
"rule_end_time" => empty($skuData["rule_end_time"]) ? "" : $skuData["rule_end_time"],
"inventory_total" => $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,
];
if (!empty($skuData["setmeal"])) {
......@@ -937,12 +937,11 @@ class GoodsService
}
if (!empty($lastId)) {
$where["goods_spu_id[>]"] = $lastId;
$where["goods_spu_id[<]"] = $lastId;
}
$where["life_account_id"] = $lifeAccountId;
$where["inventory_rest[>]"] = 0;
$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",
"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