Commit 0e7eb861 authored by hj's avatar hj

更新提交

parent a1cb8b20
......@@ -40,7 +40,7 @@ class ChemsiteProductRepositoryEloquent extends BaseRepository implements Chemsi
return null;
}
public function getProductByPcodeAndBid($pCode,$bId, $comId)
public function getProductByPcodeAndBid($pCode,$bId)
{
$productsModel = ChemsiteProducts::query();
if(!is_array($pCode)){
......@@ -49,7 +49,7 @@ class ChemsiteProductRepositoryEloquent extends BaseRepository implements Chemsi
$productsModel->whereIn('products.p_code',$pCode);
}
$productsModel->where('products.b_id',$bId);
$productsModel->where('products.com_id',$comId);
//$productsModel->where('products.com_id',$comId);
$product = $productsModel->get();
if($product){
return $product->toArray();
......
......@@ -39,11 +39,14 @@ class ChemsiteOrdersService
$weight = 0;
$productRepository = app(ChemsiteProductRepositoryEloquent::class);
foreach($soItems as $k => $v){
$productInfo = $productRepository->getProductByPcodeAndBid($v['p_code'],$v['brand_id'], $comId);
$productInfo = $productRepository->getProductByPcodeAndBid($v['p_code'],$v['brand_id']);
if(!$productInfo){
throw new \Exception($v['p_code'].'产品不存在!',500);
}
$productInfo = current($productInfo);
if($productInfo['com_id'] != $comId && $productInfo['com_id'] != 0){
throw new \Exception($v['p_code'].'产品已下架!',500);
}
if($productInfo['p_status'] == 0 || $productInfo['p_show'] == 0){
throw new \Exception($v['p_code'].'产品已下架!',500);
}
......
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