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

+2 -23
View File
@@ -1,4 +1,4 @@
import { httpFetch } from '../request.ts'
import { httpFetch } from '../common/request.ts'
import { decodeName, formatPlayTime, sizeFormate } from '../index.ts'
import { formatSingerName } from '../utils.ts'
import type { HttpRequestObject, SongType, QualityInfo } from '../types.ts'
@@ -91,7 +91,6 @@ export default {
return arr.join('、')
},
filterData(rawList) {
// console.log(rawList)
return rawList.map(item => {
const types: Array<SongType & { hash?: string }> = []
const _types: Record<string, QualityInfo & { hash?: string }> = {}
@@ -147,7 +146,6 @@ export default {
},
filterBoardsData(rawList) {
// console.log(rawList)
let list: Array<{ id: string; name: string; bangid: string }> = []
for (const board of rawList) {
if (board.isvol != 1) continue
@@ -159,24 +157,7 @@ export default {
}
return list
},
async getBoards(retryNum = 0) {
// if (++retryNum > 3) return Promise.reject(new Error('try max num'))
// let response
// try {
// response = await this.getBoardsData()
// } catch (error) {
// return this.getBoards(retryNum)
// }
// // console.log(response.body)
// if (response.statusCode !== 200 || response.body.errcode !== 0) return this.getBoards(retryNum)
// const list = this.filterBoardsData(response.body.data.info)
// console.log(list)
// // console.log(JSON.stringify(list))
// this.list = list
// return {
// list,
// source: 'kg',
// }
async getBoards() {
this.list = boardList
return {
list: boardList,
@@ -189,11 +170,9 @@ export default {
if (body.errcode != 0) return this.getList(bangid, page, retryNum)
// console.log(body)
let total = body.data.total
let limit = 100
let listData = this.filterData(body.data.info)
// console.log(listData)
return {
total,
list: listData,