Bläddra i källkod

refactor(ai_predict_model): 更新指数数据和配置

- 新增 UpdateIndexAndData 方法,用于导入数据并更新指数
- 在 AiPredictModelIndexConfig 中添加模型框架、预测日期等字段
- 实现 SetCurrIndexConfig 方法,用于设置当前指数配置
- 优化数据更新逻辑,支持批量插入和删除
Roc 3 dagar sedan
förälder
incheckning
3eab11621f

+ 8 - 3
controllers/data_manage/ai_predict_model/index_config.go

@@ -227,9 +227,14 @@ func (c *AiPredictModelIndexConfigController) SetCurr() {
 		return
 	}
 
-	indexItem.AiPredictModelIndexConfigId = configItem.AiPredictModelIndexConfigId
-	indexItem.ModifyTime = time.Now()
-	err = indexItem.Update([]string{indexOb.Cols().ModifyTime, indexOb.Cols().AiPredictModelIndexConfigId})
+	if indexItem.AiPredictModelIndexConfigId == configItem.AiPredictModelIndexConfigId {
+		br.Msg = `已经是当前版本`
+		br.IsSendEmail = false
+		return
+	}
+
+	//  设置为当前版本
+	err = services.SetCurrIndexConfig(indexItem, configItem)
 	if err != nil {
 		br.Msg = "操作失败"
 		br.ErrMsg = fmt.Sprintf("配置失败,Err:%v", e)

+ 5 - 0
services/ai_predict_model_index.go

@@ -655,6 +655,11 @@ func GetCurrentRunningAiPredictModelIndexCount() (total int, err error) {
 	return
 }
 
+// SetCurrIndexConfig
+// @Description: 设置当前为当前版本
+// @param indexItem
+// @param indexConfigItem
+// @return err
 func SetCurrIndexConfig(indexItem *aiPredictModel.AiPredictModelIndex, indexConfigItem *aiPredictModel.AiPredictModelIndexConfig) (err error) {
 	indexOb := aiPredictModel.AiPredictModelIndex{}