ua
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"main/utils"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/gorilla/websocket"
|
||||
@@ -134,19 +135,25 @@ func ModelItemPatch(w http.ResponseWriter, r *http.Request) {
|
||||
if model_new.Status != "" && model_new.Status != model.Status {
|
||||
model.Status = model_new.Status
|
||||
// 如果狀態被改變爲 ready, 將模型發送到訓練隊列
|
||||
//if model.Status == "ready" {
|
||||
// model.SendToTrain()
|
||||
//}
|
||||
if model.Status == "ready" {
|
||||
model.Status = "training"
|
||||
go model.Train()
|
||||
}
|
||||
}
|
||||
if model_new.Image != "" && model_new.Image != model.Image {
|
||||
model.Image = model_new.Image
|
||||
}
|
||||
|
||||
// 更新時間
|
||||
model.UpdatedAt = time.Now().Format("2006-01-02 15:04:05")
|
||||
|
||||
// 執行更新
|
||||
if err := configs.ORMDB().Save(&model).Error; err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// 返回更新後的數據
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.Write(utils.ToJSON(model))
|
||||
}
|
||||
|
Reference in New Issue
Block a user