MasterWorkerCaseOutLogLists.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace app\workerapi\lists;
  3. use app\common\model\finance\MasterWorkerCaseOutLog;
  4. /**
  5. * @author 林海涛
  6. * @date 2024/7/23 下午2:17
  7. */
  8. class MasterWorkerCaseOutLogLists extends BaseWorkerDataLists
  9. {
  10. public function queryWhere()
  11. {
  12. $where = [];
  13. if(isset($this->params['month'])){
  14. $firstDay = date("Y-m-d 00:00:00", strtotime("first day of {$this->params['month']}"));
  15. $lastDay = date("Y-m-d 23:59:59", strtotime("{$this->params['month']} +1 month -1 day"));
  16. $firstTime = strtotime($firstDay);
  17. $lastTime = strtotime($lastDay);
  18. $where[] = ['create_time','between',[$firstTime,$lastTime]];
  19. }
  20. $where[] = ['worker_id', '=', $this->userId];
  21. return $where;
  22. }
  23. public function lists():array
  24. {
  25. return MasterWorkerCaseOutLog::where($this->searchWhere)
  26. ->where($this->queryWhere())
  27. ->field('sn,change_amount,review_status,create_time')
  28. ->append(['review_status_text'])
  29. ->limit($this->limitOffset, $this->limitLength)
  30. ->order(['id' => 'desc'])
  31. ->select()
  32. ->toArray();
  33. }
  34. public function count(): int
  35. {
  36. return MasterWorkerCaseOutLog::where($this->queryWhere())->count();
  37. }
  38. }