PropertyOrderLists.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\api\lists\property;
  3. use app\api\lists\BaseApiDataLists;
  4. use app\common\lists\ListsSearchInterface;
  5. use app\common\model\property\PropertyCommission;
  6. use app\common\model\property\PropertyHead;
  7. use app\common\model\property\PropertyOrder;
  8. use app\common\model\property\PropertySurplusLog;
  9. /**
  10. * 订单列表
  11. */
  12. class PropertyOrderLists extends BaseApiDataLists implements ListsSearchInterface
  13. {
  14. public function setSearch(): array
  15. {
  16. return [
  17. '=' => ['id','order_status'],
  18. ];
  19. }
  20. public function queryWhere()
  21. {
  22. // 指定用户
  23. $propertyHeadId = PropertyHead::where('user_id',$this->userId)->value('id');
  24. $where[] = ['property_head_id', '=', $propertyHeadId];
  25. return $where;
  26. }
  27. public function lists(): array
  28. {
  29. $lists = PropertyOrder::with(['propertyHead','propertyUser','propertyWork'])->where($this->searchWhere)
  30. ->where($this->queryWhere())
  31. ->limit($this->limitOffset, $this->limitLength)
  32. ->field(['id','property_head_id','property_user_id','remark','order_status','work_id','create_time','update_time'])
  33. ->order('create_time desc')
  34. ->select()
  35. ->toArray();
  36. return $lists;
  37. }
  38. /**
  39. * @notes 获取数量
  40. * @return int
  41. */
  42. public function count(): int
  43. {
  44. return PropertyOrder::where($this->searchWhere)->where($this->queryWhere())->count();
  45. }
  46. }