UserAddressDao.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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\dao\user;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\user\UserAddress as model;
  14. class UserAddressDao extends BaseDao
  15. {
  16. /**
  17. * @return string
  18. * @author Qinii
  19. */
  20. protected function getModel(): string
  21. {
  22. return model::class;
  23. }
  24. public function userFieldExists($field, $value,$uid): bool
  25. {
  26. return (($this->getModel()::getDB())->where('uid',$uid)->where($field,$value)->count()) > 0;
  27. }
  28. public function changeDefault(int $uid)
  29. {
  30. return ($this->getModel()::getDB())->where('uid',$uid)->update(['is_default' => 0]);
  31. }
  32. public function getAll(int $uid)
  33. {
  34. return (($this->getModel()::getDB())->where('uid',$uid));
  35. }
  36. }