Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

WorkWelcomeDao.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\dao\work;
  3. use app\dao\BaseDao;
  4. use app\model\work\WorkWelcome;
  5. use crmeb\basic\BaseAuth;
  6. use crmeb\traits\SearchDaoTrait;
  7. /**
  8. * Class WorkWelcomeDao
  9. * @package app\dao\wechat\work
  10. */
  11. class WorkWelcomeDao extends BaseDao
  12. {
  13. use SearchDaoTrait;
  14. /**
  15. * @return string
  16. */
  17. protected function setModel(): string
  18. {
  19. return WorkWelcome::class;
  20. }
  21. /**
  22. * 搜索
  23. * @param array $where
  24. * @param bool $authWhere
  25. */
  26. public function searchWhere(array $where, bool $authWhere = true)
  27. {
  28. [$with] = app()->make(BaseAuth::class)->________(array_keys($where), $this->setModel());
  29. return $this->getModel()->withSearch($with, $where)->when(!empty($where['userids']), function ($query) use ($where) {
  30. $query->whereIn('id', function ($query) use ($where) {
  31. $query->name('wechat_work_welcome_relation')->whereIn('userid', $where['userids'])->field(['welcome_id']);
  32. });
  33. })->when(!empty($where['id']), function ($query) use ($where) {
  34. if (is_array($where['id'])) {
  35. $query->whereIn('id', $where['id']);
  36. } else {
  37. $query->where('id', $where['id']);
  38. }
  39. });
  40. }
  41. }