2
3
Prechádzať zdrojové kódy

上传url 返回的处理

yuedefeng 6 rokov pred
rodič
commit
b29175e1a6

+ 6 - 4
src/dashoo.cn/backend/api/business/workflow/ActivitiService.go

@@ -331,8 +331,9 @@ func (this *ActivitiService) ExcelToPdf(addressUrl string) string {
 	}
 	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
 	//_, fID, err := sw.Upload(retVal.Body, "tmp.pdf", int64(len(pdfByte)), "", "")
-	_, _, fID, err := sw.UploadFile(_dir, "", "")
-	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	_, filePart, fID, err := sw.UploadFile(_dir, "", "")
+	//retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	retDocUrl := filePart.Server + "/" + fID
 	os.Remove(_dir)
 	fmt.Println("==retDocUrl==", retDocUrl)
 	return retDocUrl
@@ -380,8 +381,9 @@ func (this *ActivitiService) FillWordTemplate(datas map[string]interface{}, temp
 	}
 	sw = NewSeaweed("http", utils.Cfg.MustValue("file", "upFileHost"), filer, 2*1024*1024, 5*time.Minute)
 	//_, fID, err := sw.Upload(retVal.Body, "tmp.pdf", int64(len(pdfByte)), "", "")
-	_, _, fID, err := sw.UploadFile(_dir, "", "")
-	retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	_, filePart, fID, err := sw.UploadFile(_dir, "", "")
+	//retDocUrl := utils.Cfg.MustValue("file", "downFileHost") + "/" + fID
+	retDocUrl := filePart.Server + "/" + fID
 	os.Remove(_dir)
 	fmt.Println("==retDocUrl==", retDocUrl)
 	return retDocUrl

BIN
src/dashoo.cn/backend/api/static/limsdoc/dataentry/template/word/tmp_1559117243.docx


BIN
src/dashoo.cn/backend/api/static/limsdoc/dataentry/template/word/tmp_1559118291.docx


+ 3 - 2
src/dashoo.cn/frontend_web/src/pages/select/companyselect/index.vue

@@ -886,11 +886,12 @@ export default {
             })
             let docurl = res.data.item
             // 内网服务器专用
-            if (process.client) {
+            if (process.client && docurl.indexOf('/upfile') === 0) {
               const myDomain = window.location.host
               location.href = 'http://' + myDomain + '/' + docurl
+            } else {
+              location.href = 'http://' + docurl
             }
-            // location.href = 'http://' + docurl
           }
         }).catch(err => {
           console.error(err)