导入商品的详情

This commit is contained in:
mkm 2023-05-20 18:22:04 +08:00
parent f4b8f07160
commit 5be0c7ce07

View File

@ -12,7 +12,7 @@ class ProductCreate
public function handle($event)
{
$merchant=Db::name('merchant')->where('mer_id',$event['product']['mer_id'])->find();
$merchant=Db::name('merchant')->where('status',1)->where('mer_state',1)->where('mer_id',$event['product']['mer_id'])->find();
if ($merchant['type_id']==11){
$this->CloudMerchanSpu($merchant,$event);
}
@ -20,9 +20,8 @@ class ProductCreate
return false;
}
$product_find=Db::name('store_product')->where('product_id',$event['product']['product_id'])->where('mer_id',$event['product']['mer_id'])->find();
//市级云仓
$cityMerchantId = Db::name('merchant')->where('category_id',$merchant['category_id'])->where('type_id',13)->value('mer_id');
$cityMerchantId = Db::name('merchant')->where('status',1)->where('mer_state',1)->where('category_id',$merchant['category_id'])->where('type_id',13)->value('mer_id');
if ($cityMerchantId) {
$is_product=0;
if ($product_find['bar_code']!='' &&in_array($product_find['product_type'],[0,98]) &&$product_find['spec_type']==0){
@ -42,24 +41,26 @@ class ProductCreate
}
//镇街云仓
$is_product=0;
if ($merchant['type_id']==11){
$townMerchantId = Db::name('merchant')->where('category_id',$merchant['category_id'])->where('type_id',11)->value('mer_id');
if ($product_find['bar_code']!='' &&in_array($product_find['product_type'],[0,98]) &&$product_find['spec_type']==0){
$find=Db::name('store_product')->where('bar_code',$product_find['bar_code'])->where('mer_id',$townMerchantId)->find();
if (!$find){
$is_product=1;
if ($merchant['type_id']==10){
$townMerchantId = Db::name('merchant')->where('status',1)->where('mer_state',1)->where('category_id',$merchant['category_id'])->where('type_id',11)->value('mer_id');
if ($townMerchantId){
if ($product_find['bar_code']!='' &&in_array($product_find['product_type'],[0,98]) &&$product_find['spec_type']==0){
$find=Db::name('store_product')->where('bar_code',$product_find['bar_code'])->where('mer_id',$townMerchantId)->find();
if (!$find){
$is_product=1;
}
}else{
$find=Db::name('store_product')->where('store_name',$product_find['store_name'])->where('mer_id',$townMerchantId)->find();
if (!$find){
$is_product=1;
}
}
}else{
$find=Db::name('store_product')->where('store_name',$product_find['store_name'])->where('mer_id',$townMerchantId)->find();
if (!$find){
$is_product=1;
if ($is_product==1){
$this->AddProduct($townMerchantId,$product_find,$event);
}
}
if ($is_product==1){
$this->AddProduct($townMerchantId,$product_find,$event);
}
}
return false;
}
public function CloudMerchanSpu($data,$event){