转存指定对应文件
This commit is contained in:
@@ -77,13 +77,14 @@ func (s *CommontController) SysConfig(c *gin.Context) {
|
|||||||
c.JSON(200, result.OkData(data))
|
c.JSON(200, result.OkData(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 转存帮助文档
|
// 转存指定对应文件
|
||||||
//
|
//
|
||||||
// POST /helpDoc
|
// POST /transferStaticFile
|
||||||
func (s *CommontController) HelpDoc(c *gin.Context) {
|
func (s *CommontController) TransferStaticFile(c *gin.Context) {
|
||||||
language := ctx.AcceptLanguage(c)
|
language := ctx.AcceptLanguage(c)
|
||||||
var body struct {
|
var body struct {
|
||||||
UploadPath string `json:"uploadPath" binding:"required"`
|
UploadPath string `json:"uploadPath" binding:"required"`
|
||||||
|
StaticPath string `json:"staticPath" binding:"required"`
|
||||||
Language string `json:"language" binding:"required"`
|
Language string `json:"language" binding:"required"`
|
||||||
}
|
}
|
||||||
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
if err := c.ShouldBindBodyWith(&body, binding.JSON); err != nil {
|
||||||
@@ -102,8 +103,9 @@ func (s *CommontController) HelpDoc(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
newFile := fmt.Sprintf("%s/helpDoc/%s_doc.pdf", dir, lang)
|
delPrefix := strings.Replace(body.StaticPath, static["prefix"].(string), "", 1)
|
||||||
fmt.Println(newFile)
|
staticPath := strings.Replace(delPrefix, "{language}", lang, 1)
|
||||||
|
newFile := fmt.Sprintf("%s%s", dir, staticPath)
|
||||||
|
|
||||||
err = file.CopyUploadFile(body.UploadPath, newFile)
|
err = file.CopyUploadFile(body.UploadPath, newFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user