OwnerLogisticFeeDetailService.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace App\Services;
  3. use App\Logistic;
  4. use App\OwnerFeeDetail;
  5. use App\OwnerFeeExpress;
  6. use App\Traits\ServiceAppAop;
  7. use App\OwnerLogisticFeeDetail;
  8. use App\Traits\SettlementBillServiceTrait;
  9. use Carbon\Carbon;
  10. use Illuminate\Database\Eloquent\Builder;
  11. use Illuminate\Pagination\LengthAwarePaginator;
  12. class OwnerLogisticFeeDetailService implements \App\Interfaces\SettlementBillDetailInterface
  13. {
  14. use SettlementBillServiceTrait;
  15. const TYPE = '快递费-明细';
  16. use ServiceAppAop;
  17. /**
  18. * @var $modelClass OwnerFeeExpress
  19. */
  20. protected $modelClass = OwnerFeeExpress::class;
  21. /**
  22. * 根据货主查询 和时间段查询
  23. * @param array $kvPairs
  24. * @return LengthAwarePaginator
  25. */
  26. public function get(array $kvPairs): LengthAwarePaginator
  27. {
  28. return $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
  29. }
  30. /**
  31. * @param $owner_id
  32. * @param $counting_month
  33. * @return Builder
  34. */
  35. public function getSql($owner_id, $counting_month): Builder
  36. {
  37. list($start, $end) = $this->getStartAndEnd($counting_month);
  38. return OwnerFeeExpress::query()
  39. ->with(['province', 'logistic'])
  40. ->where('owner_id', $owner_id)
  41. ->whereBetween('created_at', [$start, $end])
  42. ->orderBy('logistic_id');
  43. }
  44. public function switchType($type)
  45. {
  46. }
  47. public function buildExport($details): array
  48. {
  49. }
  50. public function add(array $model)
  51. {
  52. }
  53. public function getTotalFee($owner_id, $counting_month)
  54. {
  55. }
  56. }