['user_id', 'type', 'status'], '%like%' => ['name'], // 其他搜索条件 ]; } public function lists(): array { $this->searchWhere[] = ['user_id', '=', $this->userId]; $list = SvVideoSetting::where($this->searchWhere) ->order(['id' => 'desc']) ->limit($this->limitOffset, $this->limitLength) ->select() ->toArray(); // 处理特定字段,将JSON字符串转为数组 foreach ($list as &$item) { // 转换6个特定字段为数组 $jsonFields = ['anchor', 'voice', 'title', 'subtitle', 'copywriting', 'topic','extra']; foreach ($jsonFields as $field) { if (!empty($item[$field])) { $item[$field] = json_decode($item[$field], true); } else { $item[$field] = []; } } } return $list; } public function count(): int { return SvVideoSetting::where($this->searchWhere)->count(); } }