Commit f1b063a3 authored by hj's avatar hj

更新

parent e6d907e3
...@@ -137,12 +137,10 @@ class RhawnProductRepositoryEloquent extends BaseRepository implements RhawnProd ...@@ -137,12 +137,10 @@ class RhawnProductRepositoryEloquent extends BaseRepository implements RhawnProd
public function getProductIsHotByPid($pid) public function getProductIsHotByPid($pid)
{ {
$promotions = DB::connection($this->getConnectionName()) $result =DB::connection($this->getConnectionName())->select(DB::raw("SELECT sum(`pstk_num` - `pstk_lock_num`) as `real_num` FROM `pstock` where `si_ids` = '' AND `p_id` = ".$pid));
->raw("SELECT sum(`pstk_num` - `pstk_lock_num`) as `real_num` FROM `pstock` where `si_ids` = '' AND `p_id` = ".$pid)->getValue(); if(!empty($result)){
if($promotions){ return $result;
$promotions = $promotions->toArray();
return $promotions;
} }
return null; return null
} }
} }
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