|
@@ -1214,47 +1214,6 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
|
br.Data = resp
|
|
|
}
|
|
|
|
|
|
-// UpdateExcelInfoFileUrl 更新excel表格的下载地址
|
|
|
-func UpdateExcelInfoFileUrl(excelInfo *excel3.ExcelInfo) {
|
|
|
- var err error
|
|
|
- defer func() {
|
|
|
- if err != nil {
|
|
|
- go alarm_msg.SendAlarmMsg(fmt.Sprintf("更新excel表格的下载地址失败,表格id:%d;表格名称:%s; ERR:%s", excelInfo.ExcelInfoId, excelInfo.ExcelName, err), 3)
|
|
|
- }
|
|
|
- }()
|
|
|
- fileName := excelInfo.ExcelName + "_" + excelInfo.UniqueCode + ".xlsx"
|
|
|
- luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
|
|
|
- if err != nil {
|
|
|
- fmt.Println("err:", err)
|
|
|
- return
|
|
|
- }
|
|
|
- //_, err = luckySheetData.GetTableDataByLuckySheetDataStr()
|
|
|
- downloadFilePath, err := luckySheetData.ToExcel()
|
|
|
- defer func() {
|
|
|
- _ = os.Remove(downloadFilePath)
|
|
|
- }()
|
|
|
- if err != nil {
|
|
|
- fmt.Println("err:", err)
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- resourceUrl := ``
|
|
|
- //上传到阿里云 和 minio
|
|
|
- if utils.ObjectStorageClient == "minio" {
|
|
|
- resourceUrl, err = services.UploadImgToMinIo(fileName, downloadFilePath)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- } else {
|
|
|
- resourceUrl, err = services.UploadAliyunV2(fileName, downloadFilePath)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- excelInfo.FileUrl = resourceUrl
|
|
|
- err = excelInfo.Update([]string{"FileUrl"})
|
|
|
-}
|
|
|
-
|
|
|
//func init() {
|
|
|
//
|
|
|
// excelInfo, err := data_manage.GetExcelInfoById(52)
|