['type', 'statkey', 'createtime'], ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/04/12 11:05 */ public function lists(): array { $list = LogDownload::where($this->searchWhere) ->field(['id', 'type', 'statkey', 'filename', 'createtime', 'updatetime']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); if ($list) { if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') { $protocol = 'https'; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') { $protocol = 'https'; } else { $protocol = 'http'; } $url = $protocol . '://' . $_SERVER['HTTP_HOST']; foreach ($list as $k => $l) { $list[$k]['url'] = $url . $l['filename']; } } return $list; } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2024/04/12 11:05 */ public function count(): int { return LogDownload::where($this->searchWhere)->count(); } }