修复产品销量排行计算总额bug

This commit is contained in:
sugar1569 2018-11-02 16:04:13 +08:00
parent 6581722fed
commit b460166b8c

View File

@ -71,13 +71,7 @@ class StoreProduct extends ModelBasic
$model = $model->where('p.store_name|p.keyword|p.id','LIKE',"%$where[store_name]%");
}
if(isset($where['cate_id']) && trim($where['cate_id'])!=''){
$cate=CategoryModel::where('id',$where['cate_id'])->find();
if($cate['pid']==0){
$arr=CategoryModel::where('pid',$cate['id'])->column('id');
$model = $model->where('p.cate_id','in',$arr);
}else{
$model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%");
}
$model = $model->where('p.cate_id','LIKE',"%$where[cate_id]%");
}
if(isset($where['order']) && $where['order']!=''){
$model = $model->order(self::setOrder($where['order']));
@ -386,7 +380,7 @@ class StoreProduct extends ModelBasic
->select();
$count=self::setWhere($where)->where('a.is_pay',1)->group('a.product_id')->count();
foreach ($data as &$item){
$item['sum_price']=bcdiv($item['num_product'],$item['price'],2);
$item['sum_price']=bcmul($item['num_product'],$item['price'],2);
}
return compact('data','count');
}