CategoryService.php 869 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\extra\service\blue;
  3. use app\extra\basic\Service;
  4. use app\model\blue\BlueCategory;
  5. class CategoryService extends Service
  6. {
  7. /**
  8. * 列表
  9. * @param array $param
  10. */
  11. public function getList(array $param = [])
  12. {
  13. $this->mode = new BlueCategory();
  14. return $this->searchVal($param,$this->searchFilter($param))->select()->toArray();
  15. }
  16. /**
  17. *
  18. * @param array $param
  19. * @return array
  20. */
  21. public function searchFilter(array $param = []): array
  22. {
  23. $filter = [];
  24. !empty($param['type']) && $filter[] = ["type", '=', $param['type']];
  25. !empty($param['status']) && $filter[] = ["status", '=', $param['status']];
  26. !empty($param['name']) && $filter[] = ["name", 'like', "%{$param['name']}%"];
  27. return $filter;
  28. }
  29. }