|
@@ -8,10 +8,6 @@ import (
|
|
|
"hongze/hongze_cygx/utils"
|
|
|
"html"
|
|
|
"os"
|
|
|
-
|
|
|
- //"os"
|
|
|
-
|
|
|
- //"os"
|
|
|
"rdluck_tools/http"
|
|
|
"regexp"
|
|
|
"strconv"
|
|
@@ -736,11 +732,6 @@ func (this *ArticleController) Pdfwatermark() {
|
|
|
if mobile == "" {
|
|
|
mobile = user.Email
|
|
|
}
|
|
|
-
|
|
|
- fmt.Println(fileLink)
|
|
|
- //getUrl := "http://127.0.0.1:5000/pdfwatermark?Mobile=" + mobile + "&Name=" + user.RealName + "&FileLink=" + fileLink //
|
|
|
- //result, err := http.Get(getUrl)
|
|
|
-
|
|
|
dataMap := make(map[string]interface{})
|
|
|
dataMap["Mobile"] = mobile
|
|
|
//dataMap["Name"] = user.RealName
|
|
@@ -769,26 +760,34 @@ func (this *ArticleController) Pdfwatermark() {
|
|
|
br.ErrMsg = "Unmarshal,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ resp := new(models.ArticleDetailFileLink)
|
|
|
filePathName := strings.TrimLeft(pdfResult.FilePath, ".")
|
|
|
filePathOldName := strings.TrimLeft(pdfResult.FileOldPath, ".")
|
|
|
- filePath := "/home/code/python/hz_cygx_pdf" + filePathName
|
|
|
- filePathOld := "/home/code/python/hz_cygx_pdf" + filePathOldName
|
|
|
+ filePath := pdfResult.Pdfpath + filePathName
|
|
|
+ filePathOld := pdfResult.Pdfpath + filePathOldName
|
|
|
+ fmt.Println(filePath)
|
|
|
+ fmt.Println(filePathOld)
|
|
|
randStr := utils.GetRandStringNoSpecialChar(28)
|
|
|
fileName := randStr + ".pdf"
|
|
|
+ hzUploadDir := "static/pdf/"
|
|
|
+ savePath := hzUploadDir + time.Now().Format("200601/20060102/")
|
|
|
+ savePath += fileName
|
|
|
//上传到阿里云
|
|
|
- resourceUrl, err := services.UploadPdfAliyun(fileName, filePath)
|
|
|
+ err = services.UploadFileToAliyun(fileName, filePath, savePath)
|
|
|
if err != nil {
|
|
|
br.Msg = "文件上传失败"
|
|
|
br.ErrMsg = "文件上传失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ utils.FileLog.Info("%s:", time.Now().Format(utils.FormatDateTime))
|
|
|
+ utils.FileLog.Info("end update oss ")
|
|
|
+ fileHost := "https://hzstatic.hzinsights.com/"
|
|
|
+ resourceUrl := fileHost + savePath
|
|
|
defer func() {
|
|
|
os.Remove(filePath)
|
|
|
os.Remove(filePathOld)
|
|
|
}()
|
|
|
- resp := new(models.ArticleDetailFileLink)
|
|
|
resp.FileLink = resourceUrl
|
|
|
- //resp.FileLink = pdfResult.FilePath
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
@@ -799,4 +798,5 @@ type PublishPdfResult struct {
|
|
|
Result string `json:"result"`
|
|
|
FilePath string `json:"file_path"`
|
|
|
FileOldPath string `json:"file_old_path"`
|
|
|
+ Pdfpath string `json:"pdfpath"`
|
|
|
}
|