ShopAddressLists.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\workerapi\lists\shops;
  3. use app\common\enum\YesNoEnum;
  4. use app\common\lists\ListsSearchInterface;
  5. use app\common\model\shops\ShopAddress;
  6. use app\common\model\shops\ShopGoods;
  7. use app\workerapi\lists\BaseWorkerDataLists;
  8. use think\db\Query;
  9. class ShopAddressLists extends BaseWorkerDataLists implements ListsSearchInterface
  10. {
  11. /**
  12. * @notes 设置搜索条件
  13. * @return \string[][]
  14. * @author likeadmin
  15. * @date 2024/07/07 18:23
  16. */
  17. public function setSearch(): array
  18. {
  19. return [
  20. '%like%' => ['contact_people'],
  21. ];
  22. }
  23. public function querySearch():array
  24. {
  25. $where = [];
  26. $where[] = ['worker_id','=',$this->userId];
  27. return $where;
  28. }
  29. public function lists(): array
  30. {
  31. return ShopAddress::where($this->searchWhere)
  32. ->where($this->querySearch())
  33. ->field(['id','area' ,'address', 'house_number','house_number','contact_number','contact_people'])
  34. ->limit($this->limitOffset, $this->limitLength)
  35. ->order('id','desc')
  36. ->select()
  37. ->toArray();
  38. }
  39. public function count(): int
  40. {
  41. return ShopAddress::where($this->searchWhere)->where($this->querySearch())->count();
  42. }
  43. }