Commit d911f63d by 岑成威

fix:ios

1 parent 08292f4c
...@@ -3,12 +3,15 @@ ...@@ -3,12 +3,15 @@
"configurations" : [ "configurations" : [
{ {
"customPlaygroundType" : "local", "customPlaygroundType" : "local",
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
}, },
{ {
"customPlaygroundType" : "device", "bundleId" : "uni.app.UNIB602BFA",
"playground" : "standard", "certificateFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/证书.p12",
"certificateProfileFile" : "/Users/cenchengwei/Desktop/uniapp-x-tape/uniappxtapeProfiles.mobileprovision",
"playground" : "custom",
"runSignStatus" : 1,
"type" : "uni-app:app-ios" "type" : "uni-app:app-ios"
} }
] ]
......
import { UploadConfig } from "@/services/logger/index";
export const LoggerUploadServerUrl: string = "http://192.168.1.237:3000/file/upload"; export const LoggerUploadServerUrl: string = "http://192.168.1.237:3000/file/upload";
export const LoggerUploadHeaders: null | UTSJSONObject = null; export const LoggerUploadHeaders: null | UTSJSONObject = null;
export const LoggerUploadDays: number = 7; export const LoggerUploadDays: number = 7;
type LoggerUploadConfig = {
days?: number
headers?: null | UTSJSONObject
serverUrl: string
}
type LoggerDefaultConfig = {
upload: LoggerUploadConfig
}
/** /**
* 日志服务默认配置 * 日志服务默认配置
*/ */
...@@ -27,5 +35,5 @@ export const LoggerConfig = { ...@@ -27,5 +35,5 @@ export const LoggerConfig = {
* 默认上传最近几天的日志 * 默认上传最近几天的日志
*/ */
days: LoggerUploadDays days: LoggerUploadDays
} as UploadConfig } as LoggerUploadConfig
}; } as LoggerDefaultConfig;
import services from "@/services"; import { logger } from "../../logger/index.uts";
/** /**
* 消费缓存:读取缓存 -> 返回数据 -> 删除缓存 * 消费缓存:读取缓存 -> 返回数据 -> 删除缓存
*/ */
...@@ -29,15 +29,15 @@ export async function consumeAll(recordId: string, cacheConfig: string[]): Promi ...@@ -29,15 +29,15 @@ export async function consumeAll(recordId: string, cacheConfig: string[]): Promi
uni.removeStorage({ uni.removeStorage({
key: storageKey, key: storageKey,
fail: (res) => { fail: (res) => {
services.logger.warn(`RecordCacheManager: Remove ${storageKey} failed: ${res.errMsg}`, "RecordCache"); logger.warn(`RecordCacheManager: Remove ${storageKey} failed: ${res.errMsg}`, "RecordCache");
} }
}); });
} }
}).catch((error) => { }).catch((error) => {
services.logger?.warn(`RecordCacheManager: Consume ${fieldName} failed: ${error}`, "RecordCache"); logger.warn(`RecordCacheManager: Consume ${fieldName} failed: ${error}`, "RecordCache");
}); });
} catch (error) { } catch (error) {
services.logger?.warn(`RecordCacheManager: Consume ${fieldName} failed: ${error}`, "RecordCache"); logger.warn(`RecordCacheManager: Consume ${fieldName} failed: ${error}`, "RecordCache");
} }
}); });
...@@ -96,10 +96,10 @@ export function set(recordId: string, keyPrefix: string, data: any) { ...@@ -96,10 +96,10 @@ export function set(recordId: string, keyPrefix: string, data: any) {
key: keyPrefix + recordId, key: keyPrefix + recordId,
data, data,
fail: (res) => { fail: (res) => {
services.logger?.error(`RecordCacheManager: Set ${keyPrefix} failed: ${res.errMsg}`, "RecordCache"); logger.error(`RecordCacheManager: Set ${keyPrefix} failed: ${res.errMsg}`, "RecordCache");
} }
}); });
} catch (error) { } catch (error) {
services.logger?.error(`RecordCacheManager: Set ${keyPrefix} failed: ${error}`, "RecordCache"); logger.error(`RecordCacheManager: Set ${keyPrefix} failed: ${error}`, "RecordCache");
} }
} }
...@@ -113,15 +113,15 @@ public class UniAudioRecorderManager: NSObject, RecorderManager { ...@@ -113,15 +113,15 @@ public class UniAudioRecorderManager: NSObject, RecorderManager {
self.stop() self.stop()
let durationMs = options.duration ?? Double.greatestFiniteMagnitude let durationMs = options.duration?.doubleValue ?? Double.greatestFiniteMagnitude
let duration = durationMs == Double.greatestFiniteMagnitude ? durationMs : durationMs / 1000.0 let duration = durationMs == Double.greatestFiniteMagnitude ? durationMs : durationMs / 1000.0
let sampleRate = options.sampleRate ?? 44100 let sampleRate = options.sampleRate ?? NSNumber(value: 44100)
guard sampleRates.contains(sampleRate.int32Value) else { guard sampleRates.contains(sampleRate.int32Value) else {
failedAction(1107602) failedAction(1107602)
return return
} }
let channels = options.numberOfChannels ?? 1 let channels = options.numberOfChannels ?? NSNumber(value: 1)
let bitRate = options.encodeBitRate ?? 128000 let bitRate = options.encodeBitRate ?? NSNumber(value: 128000)
let (valid, error) = isValidEncodeBitRate(bitRate.int32Value, compare: sampleRate.int32Value) let (valid, error) = isValidEncodeBitRate(bitRate.int32Value, compare: sampleRate.int32Value)
guard valid else { guard valid else {
...@@ -490,4 +490,3 @@ extension UniAudioRecorderManager { ...@@ -490,4 +490,3 @@ extension UniAudioRecorderManager {
} }
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!