UserFriendsDao.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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\dao\user;
  12. use app\dao\BaseDao;
  13. use app\model\user\UserFriends;
  14. class UserFriendsDao extends BaseDao
  15. {
  16. /**
  17. * 设置模型
  18. * @return string
  19. */
  20. protected function setModel(): string
  21. {
  22. return UserFriends::class;
  23. }
  24. /**
  25. * 获取好友关系
  26. * @param array $where
  27. * @param int $page
  28. * @param int $limit
  29. * @return array
  30. * @throws \think\db\exception\DataNotFoundException
  31. * @throws \think\db\exception\DbException
  32. * @throws \think\db\exception\ModelNotFoundException
  33. */
  34. public function getFriendList(array $where, int $page, int $limit, array $with = [])
  35. {
  36. return $this->search($where)->when($with, function ($query) use ($with) {
  37. $query->with($with);
  38. })->page($page, $limit)->select()->toArray();
  39. }
  40. }