1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Repositories;
- use App\Models\CardRidingUseLog;
- class CardRidingUseLogRepository extends BaseRepository
- {
- public function __construct(CardRidingUseLog $cardRidingUseLog)
- {
- $this->model = $cardRidingUseLog;
- }
- /**
- * 该订单是否使用过骑行卡
- * @param $order_id int 订单id
- * @param $card_id int 用户骑行卡id
- * @return mixed
- * User:Fx
- * */
- public function isUseThisCard($order_id, $card_id)
- {
- return $this->model->where('card_riding_user_bags_id', $card_id)->where('order_id', $order_id)->first();
- }
- /**
- * 该订单是否使用过骑行卡
- * @param $order_id int 订单id
- * @return mixed
- * User:Fx
- * */
- public function isUseThisCardByOrderId($order_id)
- {
- return $this->model->where('order_id', $order_id)->first();
- }
- public function isUseDayNumsByCardId($card_id)
- {
- return $this->model->where('card_riding_user_bags_id', $card_id)->whereDate('created_at', date('Y-m-d'))->count();
- }
- }
|