coachId]; $type = $this->params['type'] ?? ''; switch ($type){ case 1: $where[] = ['change_type','in',CoachAccountLogEnum::MONEY_DESC]; break; case 2: $where[] = ['change_type','in',CoachAccountLogEnum::DEPOSIT_DESC]; break; } return $where; } public function lists(): array { $lists = CoachAccountLog::where($this->setWhere()) ->field('id,sn,action,change_object,change_type,action,change_amount,left_amount,create_time') ->append(['change_type_desc']) ->order('id desc') ->limit($this->limitOffset, $this->limitLength) ->select()->toArray(); return $lists; } public function count(): int { return CoachAccountLog::where($this->setWhere())->count(); } public function extend() { $coach = Coach::where(['id'=>$this->coachId])->field('deposit,money')->findOrEmpty(); return [ 'money' => $coach['money'], 'deposit' => $coach['deposit'], ]; } }