Commit b06794b0 authored by hj's avatar hj

更新

parent 381957ab
......@@ -128,6 +128,7 @@ class RhawnProductService
$products = $this->rhawnProductRepository->getProductsByCas($cas);
if($products){
foreach($products as $product){
$product = $this->getHotProducts($product);
$promotions = $this->rhawnProductRepository->getProductPromotionByPid($product['p_id']);
$productPromotions = [];
if($promotions){
......@@ -152,6 +153,36 @@ class RhawnProductService
}
}
public function getHotProducts($product)
{
$result = $this->rhawnProductRepository->getProductIsHotByPid($product['p_id']);
if($result){
$result = current($result);
if(!$result->real_num){
$product['real_num'] = 0;
}else{
$product['real_num'] = $result->real_num;
}
}
if($product['p_per_raw'] > 0){
if($product['r_stock'] >= $product['p_per_raw']){
$product['if_r_stock'] = 1;
}else{
$product['if_r_stock'] = 0;
}
}else{
$product['if_r_stock'] = 0;
}
if($product['real_num'] > 0 || $product['if_r_stock']){
$product['if_hot'] = '1';
}else{
$product['if_hot'] = '0';
}
return $product;
}
/**
* 获取产品详情(含促销价格及会员价格)
* @param $pCode
......
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