OpenAuthDao.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 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\openapi;
  12. use app\common\model\openapi\OpenAuth;
  13. use app\common\dao\BaseDao;
  14. class OpenAuthDao extends BaseDao
  15. {
  16. protected function getModel(): string
  17. {
  18. return OpenAuth::class;
  19. }
  20. /**
  21. * 查询按照创建时间排序
  22. * @param array $where
  23. * @return mixed
  24. * @author wuhaotian
  25. * @email 442384644@qq.com
  26. * @date 2024/7/13
  27. */
  28. public function search(array $where)
  29. {
  30. $query = $this->getModel()::getDB()
  31. ->when(isset($where['type']) && $where['type'] !== '',function($query) use($where){
  32. $query->where('type',$where['type']);
  33. })
  34. ->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query) use($where){
  35. $query->where('mer_id',$where['mer_id']);
  36. });
  37. $query->order('create_time DESC');
  38. return $query;
  39. }
  40. }