diff --git a/app/controller/api/store/product/StoreMicro.php b/app/controller/api/store/product/StoreMicro.php index 5c06662e..59d0ff62 100644 --- a/app/controller/api/store/product/StoreMicro.php +++ b/app/controller/api/store/product/StoreMicro.php @@ -13,6 +13,9 @@ class StoreMicro extends BaseController $platformMerId = app()->make(MerchantDao::class)->getValidMerchant(['category_id' => $category_id, 'type_id' => Merchant::TypePlatform], 'mer_id')->value('mer_id'); $productWhere = ['is_show' => 1, 'status' => 1, 'mer_status' => 1, 'is_del' => 0]; if($code!=''){ + if (strlen($code) != 13) { + return app('json')->success('条形码长度不正确'); + } $product_id_arr=Db::name('store_product_attr_value')->where('mer_id',$platformMerId)->where('bar_code',$code)->column('product_id'); $product_id_arr=implode(',',$product_id_arr); $find=Db::name('store_product')->where('product_id',$product_id_arr)->where($productWhere)->select(); @@ -58,7 +61,7 @@ class StoreMicro extends BaseController if($exist){ return app('json')->fail('已经导入过该商品了'); } - $find['attrValue']=Db::name('store_product_attr_value')->where('product_id',$find['product_id'])->field('image,price,cost,ot_price,svip_price,stock,bar_code,weight,volume')->select(); + $find['attrValue']=[]; $find['content']=Db::name('store_product_content')->where('product_id',$find['product_id'])->value('content'); $find['is_show']=0; $find['mer_id']=$mer_id;