PropertyCommissionLists.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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\PropertySurplusLog;
  8. /**
  9. * 订单列表
  10. */
  11. class PropertyCommissionLists extends BaseApiDataLists implements ListsSearchInterface
  12. {
  13. public function setSearch(): array
  14. {
  15. return [
  16. '=' => ['id'],
  17. ];
  18. }
  19. public function queryWhere()
  20. {
  21. // 指定用户
  22. $propertyHeadId = PropertyHead::where('user_id',$this->userId)->value('id');
  23. $where[] = ['property_head_id', '=', $propertyHeadId];
  24. return $where;
  25. }
  26. public function lists(): array
  27. {
  28. $lists = PropertyCommission::where($this->searchWhere)
  29. ->where($this->queryWhere())
  30. ->limit($this->limitOffset, $this->limitLength)
  31. ->field(['id','property_head_id','property_user_id','property_order_id','work_id','create_time','update_time','order_amount','commission_amount'])
  32. ->order('create_time desc')
  33. ->select()
  34. ->toArray();
  35. return $lists;
  36. }
  37. /**
  38. * @notes 获取数量
  39. * @return int
  40. */
  41. public function count(): int
  42. {
  43. return PropertyCommission::where($this->searchWhere)->where($this->queryWhere())->count();
  44. }
  45. }