|
@@ -1497,7 +1497,7 @@ class StatisticsController extends Controller
|
1497
|
1497
|
$result = AdCost::select(DB::raw('sum(cost) as total_cost, city, ad_time'))->where(function($query) use($stime, $etime, $city){
|
1498
|
1498
|
if($stime) $query->where('ad_time', '>=', $stime);
|
1499
|
1499
|
if($etime) $query->where('ad_time', '<=', $etime);
|
1500
|
|
- if($city) $query->where('city', 'like', $city.'%');
|
|
1500
|
+ if($city) $query->where('city', 'like', '%'.$city.'%');
|
1501
|
1501
|
})->groupBy('ad_time')->groupBy('city')->orderBy('ad_time', 'desc')->offset($offset)->limit($pageSize)->get();
|
1502
|
1502
|
|
1503
|
1503
|
$result = json_decode(json_encode($result), true);
|
|
@@ -1505,11 +1505,11 @@ class StatisticsController extends Controller
|
1505
|
1505
|
//新粉收入
|
1506
|
1506
|
//当日加粉
|
1507
|
1507
|
$city_name = str_replace('市', '', $v['city']);
|
1508
|
|
- $phones = DB::table('customers')->where('fanTime', $v['ad_time'])->where('receiverCity', $city_name)->lists('phone');
|
|
1508
|
+ $phones = DB::table('customers')->where('fanTime', $v['ad_time'])->where('receiverCity','like', '%'.$city_name.'%')->lists('phone');
|
1509
|
1509
|
#当日加粉订单总计:
|
1510
|
1510
|
$order = DB::table('order')->select(DB::raw('sum(receivedAmount) as order_amount, count(1) as order_count'))->whereIn('receiverMobile', $phones)->where('is_del', 0)->first();
|
1511
|
1511
|
#当日新粉成单:
|
1512
|
|
- $new_order = DB::table('order')->select(DB::raw('sum(receivedAmount) as order_amount, count(1) as order_count'))->where('createTime','>=', $v['ad_time'])->where('createTime','<', $v['ad_time'].' 23:59:59')->where('is_del', 0)->whereIn('receiverMobile', $phones)->first();
|
|
1512
|
+ $new_order = DB::table('order')->select(DB::raw('sum(receivedAmount) as order_amount, count(1) as order_count'))->where('createTime','>=', $v['ad_time'])->where('createTime','<=', $v['ad_time'].' 23:59:59')->where('is_del', 0)->whereIn('receiverMobile', $phones)->first();
|
1513
|
1513
|
// 1.当日新粉成单数
|
1514
|
1514
|
$v['new_order_count'] = $new_order->order_count;
|
1515
|
1515
|
// 2.当日新粉成交额
|
|
@@ -1522,6 +1522,7 @@ class StatisticsController extends Controller
|
1522
|
1522
|
$v['new_roi'] = $v['total_cost']>0 ? round($v['new_order_amount'] / $v['total_cost'], 4) * 100 .'%' : '';
|
1523
|
1523
|
//累计roi
|
1524
|
1524
|
$v['total_roi'] = $v['total_cost']>0 ? round($v['order_amount'] / $v['total_cost'], 4) * 100 .'%' : '';
|
|
1525
|
+ $v['new_fan_count'] = count($phones);
|
1525
|
1526
|
}
|
1526
|
1527
|
|
1527
|
1528
|
return view('statistics/districtRoi', ['result' =>$result,
|