Commit 62fb1ede by Li Feifei

debug

parent 22e832ce
Pipeline #15677 passed with stages
in 31 seconds
...@@ -34,11 +34,11 @@ func parseURL(ossFileLink string) (*parser, error) { ...@@ -34,11 +34,11 @@ func parseURL(ossFileLink string) (*parser, error) {
return nil, gerror.New("上传URL格式不正确") return nil, gerror.New("上传URL格式不正确")
} }
f := &parser{ f := &parser{
ext: path.Ext(ParserFileLink), ext: path.Ext(ossFileLink),
url: ossFileLink, url: ossFileLink,
path: parseURLPath["path"], path: parseURLPath["path"],
slicePath: slicePath, slicePath: slicePath,
name: path.Base(ParserFileLink), name: path.Base(ossFileLink),
} }
return f, nil return f, nil
...@@ -46,7 +46,7 @@ func parseURL(ossFileLink string) (*parser, error) { ...@@ -46,7 +46,7 @@ func parseURL(ossFileLink string) (*parser, error) {
//解析课件的URL //解析课件的URL
func (f *parser) splitFileInfoLink() string { func (f *parser) splitFileInfoLink() string {
return fmt.Sprintf("%s?info=0&ssl=1&furl=%s%s", return fmt.Sprintf("%s?info=0&ssl=1&furl=%s/%s",
ParserFileLink, g.Cfg().GetString("oss.url"), f.dataPath()) ParserFileLink, g.Cfg().GetString("oss.url"), f.dataPath())
} }
...@@ -77,7 +77,7 @@ func (f *parser) contentHash() string { ...@@ -77,7 +77,7 @@ func (f *parser) contentHash() string {
// 数据库存储path // 数据库存储path
func (f *parser) dataPath() string { func (f *parser) dataPath() string {
return "/" + f.splitUploadPath() + gurl.Encode(f.slicePath[len(f.slicePath)-1:][0]) return f.splitUploadPath() + gurl.Encode(f.slicePath[len(f.slicePath)-1:][0])
} }
// 解析doctype // 解析doctype
...@@ -100,5 +100,6 @@ func (f *parser) docType() string { ...@@ -100,5 +100,6 @@ func (f *parser) docType() string {
func (f *parser) mineType() string { func (f *parser) mineType() string {
_ = mime.AddExtensionType(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation") _ = mime.AddExtensionType(".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")
_ = mime.AddExtensionType(".ppt", "application/vnd.ms-powerpoint") _ = mime.AddExtensionType(".ppt", "application/vnd.ms-powerpoint")
fmt.Println("ext == ", f.ext)
return mime.TypeByExtension(f.ext) return mime.TypeByExtension(f.ext)
} }
...@@ -199,7 +199,7 @@ func (f *ObtainFile) Worker(err error) { ...@@ -199,7 +199,7 @@ func (f *ObtainFile) Worker(err error) {
} }
// 清理ZIP包 // 清理ZIP包
defer os.Remove(f.parser.splitTempZipLink()) defer os.Remove(f.parser.splitTempZipLink())
g.Log().Async().Infof("file: %s Zip Donwload Complete", f.parser.name) g.Log().Async().Infof("file: %s Zip Donwload Complete", f.parser.filename())
// 解析ZIP包并上传图片到OSS // 解析ZIP包并上传图片到OSS
if err = f.uploadPicture(); err != nil { if err = f.uploadPicture(); err != nil {
......
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