PlatformRuleLists.php 944 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @author 林海涛
  4. * @date 2024/7/11 下午1:40
  5. */
  6. namespace app\workerapi\lists;
  7. use app\common\enum\YesNoEnum;
  8. use app\common\lists\ListsSearchInterface;
  9. use app\common\model\platform_rule\PlatformRule;
  10. class PlatformRuleLists extends BaseWorkerDataLists implements ListsSearchInterface
  11. {
  12. /**
  13. * 设置搜索条件
  14. * @return array[]
  15. * @author 林海涛
  16. * @date 2024/7/11 下午1:46
  17. */
  18. public function setSearch(): array
  19. {
  20. return [
  21. '=' => ['rule_name'],
  22. ];
  23. }
  24. public function lists():array
  25. {
  26. $data = PlatformRule::where($this->searchWhere)
  27. ->field(['id', 'rule_name','description', 'sort'])
  28. ->order(['sort' => 'desc','id' => 'desc'])
  29. ->select()
  30. ->toArray();
  31. return $data;
  32. }
  33. public function count(): int
  34. {
  35. return PlatformRule::where($this->searchWhere)->count();
  36. }
  37. }