getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50); } /** * @param $owner_id * @param $counting_month * @return Builder */ public function getSql($owner_id, $counting_month): Builder { list($start, $end) = $this->getStartAndEnd($counting_month); return OwnerFeeExpress::query() ->with(['province', 'logistic']) ->where('owner_id', $owner_id) ->whereBetween('created_at', [$start, $end]) ->orderBy('logistic_id'); } public function switchType($type) { } public function buildExport($details): array { $result = []; foreach ($details as $key => $detail) { // $row = ['主键', '快递公司', '省份', '快递单号', '重量', '首重价格', '续重价格', '快递费',]; $result[] = [ $detail->id, $detail->logistic->name ?? '', $detail->province->name ?? '', $detail->logistic_number ?? '', $detail->weight ?? '', $detail->initial_weight_price ?? '', $detail->additional_weight_price ?? '', $detail->total_fee ?? '', ]; } return $result; } public function add(array $model) { } public function getTotalFee($owner_id, $counting_month) { } }