|
|
@@ -71,7 +71,7 @@ class MaterialLogic extends BaseLogic
|
|
|
SUM(pay_amount) as pay_amount
|
|
|
";
|
|
|
|
|
|
- $data = Db::connect('db_advert')->table("media_cost_material")->field($field)->whereRaw($whereRaw)->group($group)->select();
|
|
|
+ $data = Db::connect('db_advert')->table("media_cost_material")->field($field)->whereRaw($whereRaw)->group($group)->select()->toArray();
|
|
|
|
|
|
if(empty($data)){
|
|
|
return [
|
|
|
@@ -86,6 +86,7 @@ class MaterialLogic extends BaseLogic
|
|
|
$row['material_name'] = '';
|
|
|
$row['material_id'] = '';
|
|
|
}
|
|
|
+
|
|
|
$row['cost'] = round($row['cost'], 2);
|
|
|
$row['ad_click_rate'] = getPercent($row['click'], $row['ad_show'], 2);
|
|
|
$row['reg_cost'] = getRound($row['cost'], $row['register'], 2);
|
|
|
@@ -98,7 +99,6 @@ class MaterialLogic extends BaseLogic
|
|
|
$totalData['pay_count'] = !empty($totalData['pay_count']) ? $totalData['pay_count'] + $row['pay_count'] : $row['pay_count'];
|
|
|
$totalData['pay_amount'] = !empty($totalData['pay_amount']) ? $totalData['pay_amount'] + $row['pay_amount'] : $row['pay_amount'];
|
|
|
}
|
|
|
-
|
|
|
$totalData['ad_click_rate'] = getPercent($totalData['click']??0, $totalData['ad_show']??0, 2);
|
|
|
$totalData['reg_cost'] = getRound($totalData['cost']??0, $totalData['register']??0, 2);
|
|
|
$totalData['pay_cost'] = getRound($totalData['cost']??0, $totalData['pay_count']??0, 2);
|