refactor(sdk): 审计 P2 卫生项清理——请求层收敛与死代码清除

- 删除旧 sdk/request.ts,全部 import 收敛到 sdk/common/request.ts(85 文件)
- 注释死代码 630+ 行、裸 console.log 吞错 6 处、未使用符号 26 处清零
- bili 状态校验去重;utils DNS 预解析失败日志改 warn 带上下文
- CODE-AUDIT.md:第四节 P2 清理记录 + 第八节线索逐条复核结论(kw/kg/tx/wy parse 骨架相似实质各异,不抽公共层)
This commit is contained in:
snowy-yang committed 2026-10-03 20:48:54 +08:00
1 parent ecca1b8458
commit 8c02fb5c15
85 files changed
+112 -839

No files matched your search

+1 -7
View File
@@ -1,5 +1,5 @@
import type { HttpRequestObject, SongType, Quality, QualityInfo } from '../types.ts'
import { httpFetch } from '../request.ts'
import { httpFetch } from '../common/request.ts'
import { decodeName, formatPlayTime, sizeFormate, dateFormat, formatPlayCount } from '../index.ts'
import { formatSingerName } from '../utils.ts'
@@ -120,7 +120,6 @@ export default {
this._requestObj_list = httpFetch(
this.getListUrl(sortId, tagId, page),
)
// console.log(this.getListUrl(sortId, tagId, page))
return this._requestObj_list!.promise.then(({ body }) => {
if (body.code !== this.successCode) return this.getList(sortId, tagId, page, ++tryNum)
return tagId ? this.filterList2(body.playlist.data, page) : this.filterList(body.playlist.data, page)
@@ -148,7 +147,6 @@ export default {
}
},
filterList2({ content }, page) {
// console.log(content.v_item)
return {
list: content.v_item.map(({ basic }) => ({
play_count: formatPlayCount(basic.play_cnt),
@@ -173,7 +171,6 @@ export default {
const requestObj_listDetailLink = httpFetch(link)
const { headers: { location }, statusCode } = await requestObj_listDetailLink.promise
// console.log(headers)
if (statusCode > 400) return this.handleParseId(link, ++retryNum)
return location == null ? link : location
},
@@ -189,7 +186,6 @@ export default {
if (!result) throw new Error('failed')
}
id = result[1]
// console.log(id)
}
return id
},
@@ -225,7 +221,6 @@ export default {
}
},
filterListDetail(rawList) {
// console.log(rawList)
return rawList.map(item => {
let types: SongType[] = []
let _types: Partial<Record<Quality, QualityInfo>> = {}
@@ -300,7 +295,6 @@ export default {
})
.promise.then(({ body }) => {
if (body.code != 0) return this.search(text, page, limit, ++retryNum)
// console.log(body.data.list)
return {
list: body.data.list.map(item => {
return {