|
@@ -1,10 +1,11 @@
|
|
package handler
|
|
package handler
|
|
|
|
|
|
import (
|
|
import (
|
|
- c_oss "cicv-data-closedloop/aarch64/plugin-compile/package/config"
|
|
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
|
|
+ "cicv-data-closedloop/common/config/c_oss"
|
|
"cicv-data-closedloop/common/entity"
|
|
"cicv-data-closedloop/common/entity"
|
|
util2 "cicv-data-closedloop/common/util"
|
|
util2 "cicv-data-closedloop/common/util"
|
|
|
|
+ "cicv-data-closedloop/tools/plugin-compile/package/config"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/google/uuid"
|
|
"github.com/google/uuid"
|
|
@@ -90,7 +91,7 @@ func (h *CompileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
}
|
|
}
|
|
c_log.GlobalLogger.Error("插件 ", soLocalPath, " 校验成功。")
|
|
c_log.GlobalLogger.Error("插件 ", soLocalPath, " 校验成功。")
|
|
// 5 如果插件能用,将插件上传到 oss
|
|
// 5 如果插件能用,将插件上传到 oss
|
|
- if err := util2.LimitUpload(c_oss.OssBucket, 41943040, soObjectKey, soLocalPath); err != nil {
|
|
|
|
|
|
+ if err := util2.LimitUpload(config.OssBucket, 41943040, soObjectKey, soLocalPath); err != nil {
|
|
c_log.GlobalLogger.Error("上传插件 ", soObjectKey, " 出错:", err)
|
|
c_log.GlobalLogger.Error("上传插件 ", soObjectKey, " 出错:", err)
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1008", Message: "上传插件 " + soObjectKey + " 出错。"})
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1008", Message: "上传插件 " + soObjectKey + " 出错。"})
|
|
_, _ = fmt.Fprintf(w, string(result))
|
|
_, _ = fmt.Fprintf(w, string(result))
|
|
@@ -138,7 +139,7 @@ func (h *PjiCompileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
tempMiddlePath := uuid.New().String()[:8]
|
|
tempMiddlePath := uuid.New().String()[:8]
|
|
goLocalPath := codeDir + tempMiddlePath + "/main/" + tempMiddlePath + ".go"
|
|
goLocalPath := codeDir + tempMiddlePath + "/main/" + tempMiddlePath + ".go"
|
|
c_log.GlobalLogger.Infof("下载源代码 %v --> %v", goObjectKey, goLocalPath)
|
|
c_log.GlobalLogger.Infof("下载源代码 %v --> %v", goObjectKey, goLocalPath)
|
|
- if err := util2.LimitDownload(c_oss.OssBucket2, 41943040, goObjectKey, goLocalPath); err != nil {
|
|
|
|
|
|
+ if err := util2.LimitDownload(config.OssBucket2, 41943040, goObjectKey, goLocalPath); err != nil {
|
|
c_log.GlobalLogger.Error("下载源代码 ", goObjectKey, " 出错:", err)
|
|
c_log.GlobalLogger.Error("下载源代码 ", goObjectKey, " 出错:", err)
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1004", Message: "下载源代码 " + goObjectKey + " 出错。"})
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1004", Message: "下载源代码 " + goObjectKey + " 出错。"})
|
|
_, _ = fmt.Fprintf(w, string(result))
|
|
_, _ = fmt.Fprintf(w, string(result))
|
|
@@ -173,7 +174,7 @@ func (h *PjiCompileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
}
|
|
}
|
|
c_log.GlobalLogger.Error("插件 ", soLocalPath, " 校验成功。")
|
|
c_log.GlobalLogger.Error("插件 ", soLocalPath, " 校验成功。")
|
|
// 5 如果插件能用,将插件上传到 oss
|
|
// 5 如果插件能用,将插件上传到 oss
|
|
- if err := util2.LimitUpload(c_oss.OssBucket2, 41943040, soObjectKey, soLocalPath); err != nil {
|
|
|
|
|
|
+ if err := util2.LimitUpload(config.OssBucket2, 41943040, soObjectKey, soLocalPath); err != nil {
|
|
c_log.GlobalLogger.Error("上传插件 ", soObjectKey, " 出错:", err)
|
|
c_log.GlobalLogger.Error("上传插件 ", soObjectKey, " 出错:", err)
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1008", Message: "上传插件 " + soObjectKey + " 出错。"})
|
|
result, _ := json.Marshal(entity.HttpResult{Status: false, Code: "1008", Message: "上传插件 " + soObjectKey + " 出错。"})
|
|
_, _ = fmt.Fprintf(w, string(result))
|
|
_, _ = fmt.Fprintf(w, string(result))
|