feat: 修改交易统计逻辑以支持按日期查询
This commit is contained in:
parent
283e8f1747
commit
4339cf481e
@ -359,7 +359,8 @@ class WorkbenchController extends BaseAdminController
|
|||||||
//交易趋势
|
//交易趋势
|
||||||
public function bottom_trade()
|
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);
|
return $this->data($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class TradeStatisticLogic extends BaseLogic
|
|||||||
$query->group("FROM_UNIXTIME(create_time, '$timeUinx')");
|
$query->group("FROM_UNIXTIME(create_time, '$timeUinx')");
|
||||||
})
|
})
|
||||||
->order('create_time ASC')->select()->toArray();
|
->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");
|
$lastOrderCountWhere['timeKey'] = $this->TimeConvert("last_month");
|
||||||
$where['timeKey'] = [
|
$where['timeKey'] = [
|
||||||
@ -228,14 +228,10 @@ class TradeStatisticLogic extends BaseLogic
|
|||||||
})
|
})
|
||||||
->order('create_time ASC')->select()->toArray();
|
->order('create_time ASC')->select()->toArray();
|
||||||
|
|
||||||
$monthCurveOrderPeople = $this->trendYdata((array)$monthCurveOrderPeople, $where['timeKey']);
|
$monthCurveOrderPeople = $this->trendYdata((array)$monthCurveOrderPeople, $timeKey);
|
||||||
//上月支付人数
|
//上月支付人数
|
||||||
$timeKey = $this->TimeConvert("last_month");
|
// $timeKey = $this->TimeConvert("last_month");
|
||||||
$where['timeKey'] = [
|
|
||||||
"start_time" => strtotime($timeKey['start_time']),
|
|
||||||
"end_time" => strtotime($timeKey['end_time']),
|
|
||||||
"days" => $timeKey['days']
|
|
||||||
];
|
|
||||||
$lastPayOrderPeople = $storeOrder->where($monthOrderPeopleWhere)->whereMonth('create_time')->group('uid')->count();
|
$lastPayOrderPeople = $storeOrder->where($monthOrderPeopleWhere)->whereMonth('create_time')->group('uid')->count();
|
||||||
|
|
||||||
//上月支付曲线
|
//上月支付曲线
|
||||||
|
@ -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'];
|
$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';
|
$timeType = '%H';
|
||||||
} elseif ($num != 0) {
|
} elseif ($num != 0) {
|
||||||
$dt_start = strtotime($time[0]);
|
$dt_start = $time[0];
|
||||||
$dt_end = strtotime($time[1]);
|
$dt_end = $time[1];
|
||||||
while ($dt_start <= $dt_end) {
|
while ($dt_start <= $dt_end) {
|
||||||
if ($num == 30) {
|
if ($num == 30) {
|
||||||
$xAxis[] = date('Y-m', $dt_start);
|
$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');
|
$visitPeople = array_column($userVisit->getTrendData($time, $channelType, $timeType, 'count(distinct(uid))'), 'num', 'days');
|
||||||
$newPeople = array_column($user->getTrendData($time, $channelType, $timeType), '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');
|
$paidPeople = array_column($order->getTrendData($time, $channelType, $timeType, 'count(distinct(uid))'), 'num', 'days');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user