UserAddressDao.php 821 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020-05-07
  7. *
  8. *
  9. */
  10. namespace app\common\dao\user;
  11. use app\common\dao\BaseDao;
  12. use app\common\model\user\UserAddress as model;
  13. class UserAddressDao extends BaseDao
  14. {
  15. /**
  16. * @return string
  17. * @author Qinii
  18. */
  19. protected function getModel(): string
  20. {
  21. return model::class;
  22. }
  23. public function userFieldExists($field, $value,$uid): bool
  24. {
  25. return (($this->getModel()::getDB())->where('uid',$uid)->where($field,$value)->count()) > 0;
  26. }
  27. public function changeDefault(int $uid)
  28. {
  29. return ($this->getModel()::getDB())->where('uid',$uid)->update(['is_default' => 0]);
  30. }
  31. public function getAll(int $uid)
  32. {
  33. return (($this->getModel()::getDB())->where('uid',$uid));
  34. }
  35. }