|
@@ -860,105 +860,6 @@ func (this *YanxuanSpecialController) AuthorHeadImg() {
|
|
|
br.Msg = "保存成功"
|
|
|
}
|
|
|
|
|
|
-//ResourceUpload 上传文件
|
|
|
-//@Title 上传文件
|
|
|
-//@Description 上传文件
|
|
|
-//@Param MenuId query int true "目录ID"
|
|
|
-//@Param File query file true "文件"
|
|
|
-//@Success 200 Ret=200 操作成功
|
|
|
-//@router /doc/upload [post]
|
|
|
-//func (this *YanxuanSpecialController) ResourceUpload() {
|
|
|
-// br := new(models.BaseResponse).Init()
|
|
|
-// defer func() {
|
|
|
-// this.Data["json"] = br
|
|
|
-// this.ServeJSON()
|
|
|
-// }()
|
|
|
-//
|
|
|
-// originName := this.GetString("OriginName", "")
|
|
|
-// if originName == "" {
|
|
|
-// br.Msg = "请上传文件名"
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if !strings.Contains(originName, ".") {
|
|
|
-// br.Msg = "文件名有误"
|
|
|
-// return
|
|
|
-// }
|
|
|
-// f, h, e := this.GetFile("file")
|
|
|
-// if e != nil {
|
|
|
-// br.Msg = "获取资源信息失败"
|
|
|
-// br.ErrMsg = "获取资源信息失败, Err:" + e.Error()
|
|
|
-// return
|
|
|
-// }
|
|
|
-// defer func() {
|
|
|
-// _ = f.Close()
|
|
|
-// }()
|
|
|
-//
|
|
|
-// extIndex := strings.LastIndex(originName, ".")
|
|
|
-// fileName := originName[:extIndex]
|
|
|
-// ext := path.Ext(h.Filename)
|
|
|
-//
|
|
|
-// uploadDir := utils.STATIC_DIR + "hongze/" + time.Now().Format("20060102")
|
|
|
-// if e = os.MkdirAll(uploadDir, 766); e != nil {
|
|
|
-// br.Msg = "存储目录创建失败"
|
|
|
-// br.ErrMsg = "存储目录创建失败, Err:" + e.Error()
|
|
|
-// return
|
|
|
-// }
|
|
|
-// ossFileName := utils.GetRandStringNoSpecialChar(28) + ext
|
|
|
-// filePath := uploadDir + "/" + ossFileName
|
|
|
-// if e = this.SaveToFile("file", filePath); e != nil {
|
|
|
-// br.Msg = "文件保存失败"
|
|
|
-// br.ErrMsg = "文件保存失败, Err:" + e.Error()
|
|
|
-// return
|
|
|
-// }
|
|
|
-// defer func() {
|
|
|
-// _ = os.Remove(filePath)
|
|
|
-// }()
|
|
|
-// // 上传到阿里云
|
|
|
-// ossDir := "static/cloud_disk/"
|
|
|
-// resourceUrl, e := services.UploadAliyunToDir(ossFileName, filePath, ossDir, "")
|
|
|
-// if e != nil {
|
|
|
-// br.Msg = "文件上传失败"
|
|
|
-// br.ErrMsg = "文件上传失败, Err:" + e.Error()
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 新增云盘资源
|
|
|
-// extMap := services.GetCloudDiskResourceFileTypeExtMap()
|
|
|
-// resourceIcon := extMap[ext]
|
|
|
-// if resourceIcon == "" {
|
|
|
-// resourceIcon = models.CloudDiskResourceFileTypeIconUnknown
|
|
|
-// }
|
|
|
-// resourceItem := &models.CloudDiskResource{
|
|
|
-// MenuId: menuId,
|
|
|
-// ResourceName: fileName,
|
|
|
-// ResourceSuffix: ext,
|
|
|
-// ResourceUrl: resourceUrl,
|
|
|
-// ResourceIcon: resourceIcon,
|
|
|
-// AdminId: this.SysUser.AdminId,
|
|
|
-// AdminName: this.SysUser.RealName,
|
|
|
-// Size: h.Size,
|
|
|
-// CreateTime: time.Now().Local(),
|
|
|
-// ModifyTime: time.Now().Local(),
|
|
|
-// }
|
|
|
-// if e = resourceItem.Create(); e != nil {
|
|
|
-// br.Msg = "上传失败"
|
|
|
-// br.ErrMsg = "新增云盘资源失败, Err: " + e.Error()
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// // 更新目录大小
|
|
|
-// go func() {
|
|
|
-// if e = services.UpdateCloudDiskMenuSize(menuId); e != nil {
|
|
|
-// alarm_msg.SendAlarmMsg("更新云盘目录大小失败, Err: "+e.Error(), 3)
|
|
|
-// }
|
|
|
-// }()
|
|
|
-//
|
|
|
-// br.Msg = "上传成功"
|
|
|
-// br.Ret = 200
|
|
|
-// br.Success = true
|
|
|
-// br.Data = resourceItem
|
|
|
-//}
|
|
|
-
|
|
|
// @Title 删除专栏
|
|
|
// @Description 删除专栏
|
|
|
// @Param request body help_doc.AddHelpDocReq true "type json string"
|