Commit 12b7d656 authored by 陈子龙's avatar 陈子龙

异常列表导出 fix

parent ee7f2b3d
...@@ -30,7 +30,7 @@ type Config struct { ...@@ -30,7 +30,7 @@ type Config struct {
MinioAccessKey string MinioAccessKey string
MinioSecretKey string MinioSecretKey string
MinioBucket string MinioBucket string
TempDirPrefix string //TempDirPrefix string
PrometheusHost string PrometheusHost string
} }
......
...@@ -7,7 +7,6 @@ import ( ...@@ -7,7 +7,6 @@ import (
json "github.com/json-iterator/go" json "github.com/json-iterator/go"
"github.com/spf13/cast" "github.com/spf13/cast"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
...@@ -390,7 +389,7 @@ func ExportIp(c *gin.Context) { ...@@ -390,7 +389,7 @@ func ExportIp(c *gin.Context) {
c.Writer.Header().Add("Content-Transfer-Encoding", "binary") c.Writer.Header().Add("Content-Transfer-Encoding", "binary")
c.Writer.Header().Add("Content-Disposition", "filename="+fileName) c.Writer.Header().Add("Content-Disposition", "filename="+fileName)
c.File(conf.Options.TempDirPrefix + fileName) c.File("/app/xlsx/" + fileName)
} }
// ListHostManage 列表 // ListHostManage 列表
......
...@@ -70,7 +70,7 @@ func initConfig() { ...@@ -70,7 +70,7 @@ func initConfig() {
MinioAccessKey: util.SetEnvStr("MINIO_ACCESS_KEY", "beagleadmin"), // Minio Access Key MinioAccessKey: util.SetEnvStr("MINIO_ACCESS_KEY", "beagleadmin"), // Minio Access Key
MinioSecretKey: util.SetEnvStr("MINIO_SECRET_KEY", "H76cPmwvH7vJ"), // Minio Secret MinioSecretKey: util.SetEnvStr("MINIO_SECRET_KEY", "H76cPmwvH7vJ"), // Minio Secret
MinioBucket: util.SetEnvStr("MINIO_BUCKET", "so-operation"), // Minio Bucket MinioBucket: util.SetEnvStr("MINIO_BUCKET", "so-operation"), // Minio Bucket
TempDirPrefix: util.SetEnvStr("TEMP_DIR_PREFIX", "/app/xlsx/"), //模板目录前缀 //TempDirPrefix: util.SetEnvStr("TEMP_DIR_PREFIX", "/app/xlsx/"), //模板目录前缀
PrometheusHost: util.SetEnvStr("PROMETHEUS_HOST", "https://prometheus.wodcloud.com"), // Prometheus Host PrometheusHost: util.SetEnvStr("PROMETHEUS_HOST", "https://prometheus.wodcloud.com"), // Prometheus Host
} }
} }
...@@ -132,7 +132,7 @@ func initAnsibleHosts() { ...@@ -132,7 +132,7 @@ func initAnsibleHosts() {
} }
func initTempDirPrefix() { func initTempDirPrefix() {
err := os.Mkdir(conf.Options.TempDirPrefix, os.ModePerm) err := os.Mkdir("/app/xlsx/", os.ModePerm)
if err != nil { if err != nil {
fmt.Println("创建目录失败!") fmt.Println("创建目录失败!")
} }
......
...@@ -10,7 +10,6 @@ import ( ...@@ -10,7 +10,6 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/response" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/response"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/tools" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/tools"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp" "gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"os/exec" "os/exec"
...@@ -670,7 +669,7 @@ func generatePushExportXlsx(push []ExportIpStr) (string, error) { ...@@ -670,7 +669,7 @@ func generatePushExportXlsx(push []ExportIpStr) (string, error) {
} }
saveFileName := "IP列表导出数据.xlsx" saveFileName := "IP列表导出数据.xlsx"
err := file.Save(conf.Options.TempDirPrefix + saveFileName) err := file.Save("/app/xlsx/" + saveFileName)
return saveFileName, err return saveFileName, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment