修改商品创建的错误

This commit is contained in:
luofei 2023-05-18 14:22:10 +08:00
parent ecaad9b075
commit 4116d48afb

View File

@ -18,39 +18,41 @@ class ProductCreate
$product_find=Db::name('store_product')->where('product_id',$event['product']['product_id'])->where('mer_id',$event['product']['mer_id'])->find();
//市级云仓
$mer_id=Db::name('merchant')->where('category_id',$merchant['category_id'])->where('type_id',13)->value('mer_id');
$is_product=0;
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',$mer_id)->find();
if (!$find){
$is_product=1;
}
}else{
$find=Db::name('store_product')->where('store_name',$product_find['store_name'])->where('mer_id',$mer_id)->find();
if (!$find){
$is_product=1;
}
}
if ($is_product==1){
$this->AddProduct($mer_id,$product_find,$event);
}
//镇街云仓
$is_product=0;
if ($merchant['type_id']==11){
$mer_id=Db::name('merchant')->where('category_id',$merchant['category_id'])->where('type_id',11)->value('mer_id');
$cityMerchantId = Db::name('merchant')->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){
$find=Db::name('store_product')->where('bar_code',$product_find['bar_code'])->where('mer_id',$mer_id)->find();
$find=Db::name('store_product')->where('bar_code',$product_find['bar_code'])->where('mer_id',$cityMerchantId)->find();
if (!$find){
$is_product=1;
}
}else{
$find=Db::name('store_product')->where('store_name',$product_find['store_name'])->where('mer_id',$mer_id)->find();
$find=Db::name('store_product')->where('store_name',$product_find['store_name'])->where('mer_id',$cityMerchantId)->find();
if (!$find){
$is_product=1;
}
}
if ($is_product==1){
$this->AddProduct($mer_id,$product_find,$event);
$this->AddProduct($cityMerchantId,$product_find,$event);
}
}
//镇街云仓
$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;
}
}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);
}
}
return false;