1
0

OrderEffectiveLogLists.php 1011 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\api\lists;
  3. use app\common\model\orders\OrderEffectiveLog;
  4. /**
  5. * @author 林海涛
  6. * @date 2024/7/24 下午3:29
  7. */
  8. class OrderEffectiveLogLists extends BaseApiDataLists
  9. {
  10. public function queryWhere()
  11. {
  12. $where = [];
  13. $where[] = ['user_id','=',$this->userId];
  14. $where[] = ['end_effective_time','>=',time()];
  15. return $where;
  16. }
  17. public function lists():array
  18. {
  19. return OrderEffectiveLog::with(['goods'=>function ($query) {
  20. $query->with(['goodsCategory'=>function ($query1) {
  21. $query1->field(['name','picture']);
  22. }]);
  23. },'serviceWork'])->where($this->queryWhere())
  24. ->limit($this->limitOffset, $this->limitLength)
  25. ->field(['*'])
  26. ->append(['effective_unit_text'])
  27. ->order('create_time desc')
  28. ->select()
  29. ->toArray();
  30. }
  31. public function count(): int
  32. {
  33. return OrderEffectiveLog::where($this->queryWhere())->count();
  34. }
  35. }