MasterWorkerMessageLists.php 1007 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\lists\ListsSearchInterface;
  4. use app\common\model\master_worker_message\MasterWorkerMessage;
  5. /**
  6. * @author 林海涛
  7. * @date 2024/7/11 下午6:21
  8. */
  9. class MasterWorkerMessageLists extends BaseWorkerDataLists implements ListsSearchInterface
  10. {
  11. public function setSearch(): array
  12. {
  13. return [
  14. '=' => ['msg_type'],
  15. ];
  16. }
  17. public function queryWhere()
  18. {
  19. $where = [];
  20. $where[] = ['user_id', '=', $this->userId];
  21. return $where;
  22. }
  23. public function lists():array
  24. {
  25. return MasterWorkerMessage::where($this->searchWhere)
  26. ->where($this->queryWhere())
  27. ->field(['id', 'title','describe','create_time','update_time'])
  28. ->order(['id' => 'asc'])
  29. ->select()
  30. ->toArray();
  31. }
  32. public function count(): int
  33. {
  34. return MasterWorkerMessage::where($this->searchWhere)->where($this->queryWhere())->count();
  35. }
  36. }