Browse Source

销售每日roi汇总

sunhao 5 years ago
parent
commit
33de2afe41

+ 1 - 1
app/Console/Commands/DayGrandSalerTotal.php

@@ -51,7 +51,7 @@ class DayGrandSalerTotal extends Command {
51 51
                 //总加粉
52 52
                 $data['fan_count'] = CustDetail::where('is_del',0)->where('admin_id', $admin_id)->where('dtime','<',$_end)->where('dtime','>=',$_start)->sum('fan_add');
53 53
                 //预估总投入                   
54
-                $data['throw_cost'] = round($data['fan_count']/$wx_fan_total * $team_throw_cost, 2); 
54
+                $data['throw_cost'] = $wx_fan_total>0 ? round($data['fan_count']/$wx_fan_total * $team_throw_cost, 2) : 0; 
55 55
 
56 56
                 //订单信息
57 57
                 $order = Order::select(DB::raw('sum(cost) as goods_cost, sum(freight_cost) as freight_cost, sum(aftersale_fee) as aftersale_cost, count(1) as order_count, sum(receivedAmount) as order_amount, count(distinct(receiverMobile)) as cust_count, sum(refund_price) as refund_fee'))->where('is_del',0)->where('admin_id', $admin_id)->where('createTime','<',$_end)->where('createTime','>=',$_start)->first();

+ 1 - 1
app/Console/Commands/DayGrandSalerTotalHistory.php

@@ -53,7 +53,7 @@ class DayGrandSalerTotalHistory extends Command {
53 53
                     //总加粉
54 54
                     $data['fan_count'] = CustDetail::where('is_del',0)->where('admin_id', $admin_id)->where('dtime','<',$_end)->where('dtime','>=',$_start)->sum('fan_add');
55 55
                     //预估总投入                   
56
-                    $data['throw_cost'] = round($data['fan_count']/$wx_fan_total * $team_throw_cost, 2); 
56
+                    $data['throw_cost'] = $wx_fan_total>0 ? round($data['fan_count']/$wx_fan_total * $team_throw_cost, 2) : 0; 
57 57
                     //订单信息
58 58
                     $order = Order::select(DB::raw('sum(cost) as goods_cost, sum(freight_cost) as freight_cost, sum(aftersale_fee) as aftersale_cost, count(1) as order_count, sum(receivedAmount) as order_amount, count(distinct(receiverMobile)) as cust_count, sum(refund_price) as refund_fee'))->where('is_del',0)->where('admin_id', $admin_id)->where('createTime','<',$_end)->where('createTime','>=',$_start)->first();
59 59
                     $data['goods_cost'] = $order->goods_cost;