diff --git a/app/admin/controller/WorkbenchController.php b/app/admin/controller/WorkbenchController.php index fb19d3f3f..53f0fdfc7 100644 --- a/app/admin/controller/WorkbenchController.php +++ b/app/admin/controller/WorkbenchController.php @@ -359,7 +359,8 @@ class WorkbenchController extends BaseAdminController //交易趋势 public function bottom_trade() { - $data=(new TradeStatisticLogic())->getBottomTrade(['data'=>'2024/05/21-2024/06/19']); + $date=$this->request->get('date',''); + $data=(new TradeStatisticLogic())->getBottomTrade(['data'=>$this->getDay($date)]); return $this->data($data); } diff --git a/app/admin/logic/statistic/TradeStatisticLogic.php b/app/admin/logic/statistic/TradeStatisticLogic.php index 3cd3e9631..e362f4011 100644 --- a/app/admin/logic/statistic/TradeStatisticLogic.php +++ b/app/admin/logic/statistic/TradeStatisticLogic.php @@ -172,7 +172,7 @@ class TradeStatisticLogic extends BaseLogic $query->group("FROM_UNIXTIME(create_time, '$timeUinx')"); }) ->order('create_time ASC')->select()->toArray(); - $monthCurveOrderCount = $this->trendYdata((array)$monthCurveOrderCount, $where['timeKey']); + $monthCurveOrderCount = $this->trendYdata((array)$monthCurveOrderCount, $timeKey); //上月订单数 $lastOrderCountWhere['timeKey'] = $this->TimeConvert("last_month"); $where['timeKey'] = [ @@ -228,14 +228,10 @@ class TradeStatisticLogic extends BaseLogic }) ->order('create_time ASC')->select()->toArray(); - $monthCurveOrderPeople = $this->trendYdata((array)$monthCurveOrderPeople, $where['timeKey']); + $monthCurveOrderPeople = $this->trendYdata((array)$monthCurveOrderPeople, $timeKey); //上月支付人数 - $timeKey = $this->TimeConvert("last_month"); - $where['timeKey'] = [ - "start_time" => strtotime($timeKey['start_time']), - "end_time" => strtotime($timeKey['end_time']), - "days" => $timeKey['days'] - ]; + // $timeKey = $this->TimeConvert("last_month"); + $lastPayOrderPeople = $storeOrder->where($monthOrderPeopleWhere)->whereMonth('create_time')->group('uid')->count(); //上月支付曲线 diff --git a/app/admin/logic/statistic/UserStatisticLogic.php b/app/admin/logic/statistic/UserStatisticLogic.php index e6f45ed20..b725b8575 100644 --- a/app/admin/logic/statistic/UserStatisticLogic.php +++ b/app/admin/logic/statistic/UserStatisticLogic.php @@ -135,8 +135,8 @@ class UserStatisticLogic extends BaseLogic $xAxis = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23']; $timeType = '%H'; } elseif ($num != 0) { - $dt_start = strtotime($time[0]); - $dt_end = strtotime($time[1]); + $dt_start = $time[0]; + $dt_end = $time[1]; while ($dt_start <= $dt_end) { if ($num == 30) { $xAxis[] = date('Y-m', $dt_start); @@ -149,7 +149,6 @@ class UserStatisticLogic extends BaseLogic } } } - $visitPeople = array_column($userVisit->getTrendData($time, $channelType, $timeType, 'count(distinct(uid))'), 'num', 'days'); $newPeople = array_column($user->getTrendData($time, $channelType, $timeType), 'num', 'days'); $paidPeople = array_column($order->getTrendData($time, $channelType, $timeType, 'count(distinct(uid))'), 'num', 'days');