CardRidingUseLogRepository.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Repositories;
  3. use App\Models\CardRidingUseLog;
  4. class CardRidingUseLogRepository extends BaseRepository
  5. {
  6. public function __construct(CardRidingUseLog $cardRidingUseLog)
  7. {
  8. $this->model = $cardRidingUseLog;
  9. }
  10. /**
  11. * 该订单是否使用过骑行卡
  12. * @param $order_id int 订单id
  13. * @param $card_id int 用户骑行卡id
  14. * @return mixed
  15. * User:Fx
  16. * */
  17. public function isUseThisCard($order_id, $card_id)
  18. {
  19. return $this->model->where('card_riding_user_bags_id', $card_id)->where('order_id', $order_id)->first();
  20. }
  21. /**
  22. * 该订单是否使用过骑行卡
  23. * @param $order_id int 订单id
  24. * @return mixed
  25. * User:Fx
  26. * */
  27. public function isUseThisCardByOrderId($order_id)
  28. {
  29. return $this->model->where('order_id', $order_id)->first();
  30. }
  31. public function isUseDayNumsByCardId($card_id)
  32. {
  33. return $this->model->where('card_riding_user_bags_id', $card_id)->whereDate('created_at', date('Y-m-d'))->count();
  34. }
  35. }