Commit a01e99a2 authored by Steven杜宇's avatar Steven杜宇

// pdf 名字

parent b8009176
......@@ -136,8 +136,8 @@ class YHPlanShareViewController: YHBaseViewController {
} else if type == .pdf {
if let sourceUrl = URL(string: pdfDownloadUrl) {
let lastComponent = sourceUrl.lastPathComponent
let destinationURL = self.planDocumentFileUrl.appendingPathComponent(lastComponent)
let fileName = getPDFFileName()
let destinationURL = self.planDocumentFileUrl.appendingPathComponent(fileName)
if eventType == .wechat {
if FileManager.default.fileExists(atPath: destinationURL.path) {
let fileName = destinationURL.lastPathComponent
......@@ -264,13 +264,20 @@ class YHPlanShareViewController: YHBaseViewController {
task.resume()
}
func getPDFFileName() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd" // HH:mm:ss
let dateString = dateFormatter.string(from: Date())
return "香港续签至永居方案" + dateString + ".pdf"
}
func savePDF(sourceUrl: URL, locationUrl: URL, isShowLoading: Bool) {
let fileManager = FileManager.default
// 保存文件到 plan 目录
let lastComponent = sourceUrl.lastPathComponent
let destinationURL = self.planDocumentFileUrl.appendingPathComponent(lastComponent)
let fileName = getPDFFileName()
let destinationURL = self.planDocumentFileUrl.appendingPathComponent(fileName)
do {
// 如果文件已存在,先移除
if fileManager.fileExists(atPath: destinationURL.path) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment