Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
a9d5a4ec
Commit
a9d5a4ec
authored
May 24, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// 优化上传大文件 UI显示异常问题
parent
b32c8ff5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
34 deletions
+38
-34
YHCertificateUploadSheetView.swift
...MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
+4
-3
YHOSSManager.swift
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
+34
-31
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/MyCertificates(我的证书)/V/YHCertificateUploadSheetView.swift
View file @
a9d5a4ec
...
...
@@ -538,15 +538,16 @@ extension YHCertificateUploadSheetView: UIDocumentPickerDelegate {
fileCoordinator
.
coordinate
(
readingItemAt
:
url
,
options
:[
.
forUploading
],
error
:
&
error
)
{
fileUrl
in
uploadFilesBlock
?(
fileUrl
)
dismiss
()
uploadFilesBlock
?(
fileUrl
)
}
url
.
stopAccessingSecurityScopedResource
()
if
let
error
=
error
{
printLog
(
"
\(
error
.
localizedDescription
)
"
)
}
}
else
{
print
(
"
授权失败"
)
YHHUD
.
flash
(
message
:
"文件
授权失败"
)
dismiss
()
}
}
...
...
galaxy/galaxy/Classes/Tools/Upload/YHOSSManager.swift
View file @
a9d5a4ec
...
...
@@ -111,39 +111,42 @@ class YHOSSManager: NSObject, URLSessionDelegate {
callBackBlock
(
nil
,
YHErrorModel
())
return
}
let
fileExtension
=
URL
(
fileURLWithPath
:
file
)
.
pathExtension
.
lowercased
()
request
.
uploadingData
=
fileData
request
.
bucketName
=
self
.
model
.
bucket
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
".
\(
fileExtension
)
"
self
.
fileName
.
append
(
name
)
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
request
.
contentDisposition
=
"inline"
request
.
uploadProgress
=
{
(
bytesSent
:
Int64
,
totalBytesSent
:
Int64
,
totalBytesExpectedToSend
:
Int64
)
->
Void
in
printLog
(
"bytesSent:
\(
bytesSent
)
,totalBytesSent:
\(
totalBytesSent
)
,totalBytesExpectedToSend:
\(
totalBytesExpectedToSend
)
"
)
}
let
task
=
self
.
mClient
.
putObject
(
request
)
task
.
continue
({
(
t
)
->
Any
?
in
let
result
=
t
if
(
result
.
error
!=
nil
)
{
let
error
:
NSError
=
(
task
.
error
)
!
as
NSError
let
result
=
error
.
description
callBackBlock
(
nil
,
YHErrorModel
())
}
else
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
self
.
fileName
.
removeFirst
()
callBackBlock
(
string
,
YHErrorModel
())
DispatchQueue
.
global
()
.
async
{
let
fileExtension
=
URL
(
fileURLWithPath
:
file
)
.
pathExtension
.
lowercased
()
request
.
uploadingData
=
fileData
request
.
bucketName
=
self
.
model
.
bucket
let
timestamp
=
Date
()
.
timeIntervalSince1970
let
name
=
"
\(
UInt64
(
timestamp
)
)
"
+
".
\(
fileExtension
)
"
self
.
fileName
.
append
(
name
)
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
request
.
objectKey
=
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
name
)
"
request
.
contentDisposition
=
"inline"
request
.
uploadProgress
=
{
(
bytesSent
:
Int64
,
totalBytesSent
:
Int64
,
totalBytesExpectedToSend
:
Int64
)
->
Void
in
printLog
(
"bytesSent:
\(
bytesSent
)
,totalBytesSent:
\(
totalBytesSent
)
,totalBytesExpectedToSend:
\(
totalBytesExpectedToSend
)
"
)
}
return
})
.
waitUntilFinished
()
let
task
=
self
.
mClient
.
putObject
(
request
)
task
.
continue
({
(
t
)
->
Any
?
in
let
result
=
t
if
(
result
.
error
!=
nil
)
{
let
error
:
NSError
=
(
task
.
error
)
!
as
NSError
let
result
=
error
.
description
callBackBlock
(
nil
,
YHErrorModel
())
}
else
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
dateFormat
=
"yyyyMMdd"
let
currentDateMMdd
=
dateFormatter
.
string
(
from
:
Date
())
let
string
=
"https://"
+
self
.
model
.
bucket
+
"."
+
"oss-cn-shenzhen.aliyuncs.com/"
+
"4001001"
+
"/"
+
currentDateMMdd
+
"/"
+
"
\(
self
.
fileName
.
first
??
""
)
"
self
.
fileName
.
removeFirst
()
callBackBlock
(
string
,
YHErrorModel
())
}
return
})
.
waitUntilFinished
()
}
}
func
getPublic
(
url
:
String
,
callBackBlock
:
@escaping
(
_
success
:
String
?,
_
error
:
YHErrorModel
?)
->
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment