OrderEffectiveLogLists.php 900 B

12345678910111213141516171819202122232425262728293031323334
  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::where($this->queryWhere())
  20. ->limit($this->limitOffset, $this->limitLength)
  21. ->field(['id','goods_id','sn','effective_unit','effective_num','remark','end_effective_time'])
  22. ->append(['effective_unit_text'])
  23. ->order('create_time desc')
  24. ->select()
  25. ->toArray();
  26. }
  27. public function count(): int
  28. {
  29. return OrderEffectiveLog::where($this->queryWhere())->count();
  30. }
  31. }