Skip to content

Commit

Permalink
Update NetworkFixView.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Jan 18, 2024
1 parent d9a8bcf commit ff02881
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions DarockBili Watch App/Errors/NetworkFixView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -444,18 +444,14 @@ let errorCodeTextDic = [
-8888: "对不起,服务器开小差了~"
]

public func CheckBApiError(from input: JSON) -> Bool {
public func CheckBApiError(from input: JSON, noTip: Bool = false) -> Bool {
let code = input["code"].int ?? 0
if code == 0 {
return true
}
let msg = errorCodeTextDic[code] ?? (input["message"].string ?? "")
tipWithText(msg, symbol: "xmark.circle.fill")
let headers: HTTPHeaders = [
"User-Agent": "Mozilla/5.0"
]
DarockKit.Network.shared.requestString("https://api.bilibili.com/x/web-interface/zone", headers: headers) { respStr, _ in
DarockKit.Network.shared.requestString("https://api.darock.top/bili/error/upload/\("Code: \(code)|Message: \(msg)|Build: \(Bundle.main.infoDictionary?["CFBundleVersion"] as! String)|IsLoggedIn: \((UserDefaults.standard.string(forKey: "DedeUserID") ?? "") == "" ? "Yes" : "No")|Loc: \(respStr)".base64Encoded().replacingOccurrences(of: "/", with: "{slash}"))") { _, _ in return}
if !noTip {
tipWithText(msg, symbol: "xmark.circle.fill")
}
return false
}
Expand Down

0 comments on commit ff02881

Please sign in to comment.