params['action'] == 1){ $where = ' action = 1 '; }else if( $this->params['action'] == 2){ $where = ' action = 2 '; } if( $this->params['frozen'] == 1){ $where .= ' AND frozen = 1 '; } $field = 'id,sn,change_type as type,change_amount as amount,remark,action,create_time'; $lists = UserFinance::field($field) ->where($where) ->where([ 'user_id' => $this->userId, ]) ->limit($this->limitOffset, $this->limitLength) ->order(['create_time' => 'desc','id' => 'desc']) ->select() ->toArray(); //查询语言 $timeFormat = 'Y-m-d H:i:s'; $language = Language::where(['symbol' => $this->params['lang']])->findOrEmpty(); if (!$language->isEmpty()) { $timeFormat = $language['time_format']; } foreach ($lists as &$item) { $item['create_time'] = date($timeFormat, strtotime($item['create_time'])); } return $lists; } /** * @notes 获取充值记录数量 * @return int * @author bd * @date 2024/01/31 14:07 */ public function count(): int { return UserFinance::where([ 'user_id' => $this->userId, ]) ->count(); } }