UserReceiptRepository.php 885 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\repositories\user;
  3. use app\common\repositories\BaseRepository;
  4. use app\common\dao\user\UserReceiptDao;
  5. class UserReceiptRepository extends BaseRepository
  6. {
  7. protected $dao;
  8. public function __construct(UserReceiptDao $dao)
  9. {
  10. $this->dao = $dao;
  11. }
  12. public function uidExists(int $id,int $uid)
  13. {
  14. return $this->dao->getWhereCount(['uid' => $uid,$this->dao->getPk() => $id,'is_del' => 0]);
  15. }
  16. public function getIsDefault(int $uid)
  17. {
  18. return $this->dao->getWhere(['uid' => $uid,'is_default' => 1]);
  19. }
  20. public function getList(array $where)
  21. {
  22. $where['is_del'] = 0;
  23. return $this->dao->getSearch($where)->order('is_default DESC , create_time ASC')->select();
  24. }
  25. public function detail(array $where)
  26. {
  27. return $this->dao->getSearch($where)->find();
  28. }
  29. }