UserReceiptRepository.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\repositories\user;
  12. use app\common\repositories\BaseRepository;
  13. use app\common\dao\user\UserReceiptDao;
  14. class UserReceiptRepository extends BaseRepository
  15. {
  16. protected $dao;
  17. public function __construct(UserReceiptDao $dao)
  18. {
  19. $this->dao = $dao;
  20. }
  21. public function uidExists(int $id,int $uid)
  22. {
  23. return $this->dao->getWhereCount(['uid' => $uid,$this->dao->getPk() => $id,'is_del' => 0]);
  24. }
  25. public function getIsDefault(int $uid)
  26. {
  27. return $this->dao->getWhere(['uid' => $uid,'is_default' => 1]);
  28. }
  29. public function getList(array $where)
  30. {
  31. $where['is_del'] = 0;
  32. return $this->dao->getSearch($where)->order('is_default DESC , create_time ASC')->select();
  33. }
  34. public function detail(array $where)
  35. {
  36. return $this->dao->getSearch($where)->find();
  37. }
  38. }