dealerOrderModel = new Order(); } public function getCommissionData($startDate = null, $endDate = null): array { return [ 'settleTotalMoney' => $this->getSettTotalMoney($startDate, $endDate), 'noSettleTotalMoney' => $this->getNoSettleTotalMoney($startDate, $endDate) ]; } public function getSettTotalMoney($startDate = null, $endDate = null) { $filter = []; if (!is_null($startDate) && !is_null($endDate)) { $filter[] = ['create_time', '>=', strtotime($startDate)]; $filter[] = ['create_time', '<', strtotime($endDate) + 86400]; } $first = $this->dealerOrderModel->where($filter)->where('is_settled','=', 1)->sum('first_money'); $two = $this->dealerOrderModel->where($filter)->where('is_settled','=', 1)->sum('second_money'); $three = $this->dealerOrderModel->where($filter)->where('is_settled','=', 1)->sum('third_money'); return helper::number2($first + $two + $three); } public function getNoSettleTotalMoney($startDate = null, $endDate = null) { $filter = []; if (!is_null($startDate) && !is_null($endDate)) { $filter[] = ['create_time', '>=', strtotime($startDate)]; $filter[] = ['create_time', '<', strtotime($endDate) + 86400]; } $first = $this->dealerOrderModel->where($filter)->where('is_settled','=', 0)->sum('first_money'); $two = $this->dealerOrderModel->where($filter)->where('is_settled','=', 0)->sum('second_money'); $three = $this->dealerOrderModel->where($filter)->where('is_settled','=', 0)->sum('third_money'); return helper::number2($first + $two + $three); } }