| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace app\workerapi\lists;
- use app\common\enum\worker\WorkerAccountLogEnum;
- use app\common\model\master_worker\MasterWorkerAccountLog;
- /**
- * @author 林海涛
- * @date 2024/7/23 下午2:16
- */
- class MasterWorkerAccountLogLists extends BaseWorkerDataLists
- {
- public function queryWhere()
- {
- $where = [];
- if(isset($this->params['month'])){
- $firstDay =date("Y-m-d 00:00:00", strtotime("first day of {$this->params['month']}"));
- $lastDay = date("Y-m-d 23:59:59", strtotime("{$this->params['month']} +1 month -1 day"));
- $firstTime = strtotime($firstDay);
- $lastTime = strtotime($lastDay);
- $where[] = ['create_time','between',[$firstTime,$lastTime]];
- }
- $where[] = ['worker_id', '=', $this->userId];
- if(isset($this->params['change_types']) && is_array($this->params['change_types'])){
- $where[] = ['change_type','in',$this->params['change_types']];
- }
- return $where;
- }
- public function lists():array
- {
- return MasterWorkerAccountLog::where($this->queryWhere())
- ->field('sn,title,change_type,action,work_sn,change_amount,create_time')
- ->order(['id' => 'dasc'])
- ->append(['action_text'])
- ->limit($this->limitOffset, $this->limitLength)
- ->select()
- ->toArray();
- }
- public function count(): int
- {
- return MasterWorkerAccountLog::where($this->queryWhere())->count();
- }
- }
|