|
@@ -0,0 +1,512 @@
|
|
|
+package ai_predict_model
|
|
|
+
|
|
|
+import (
|
|
|
+ "encoding/json"
|
|
|
+ "eta/eta_api/controllers"
|
|
|
+ "eta/eta_api/models"
|
|
|
+ data_manage "eta/eta_api/models/ai_predict_model"
|
|
|
+ "eta/eta_api/models/ai_predict_model/request"
|
|
|
+ "eta/eta_api/models/ai_predict_model/response"
|
|
|
+ "eta/eta_api/services"
|
|
|
+ "eta/eta_api/utils"
|
|
|
+ "fmt"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+// AiPredictModelIndexConfigController AI预测模型标的配置项
|
|
|
+type AiPredictModelIndexConfigController struct {
|
|
|
+ controllers.BaseAuthController
|
|
|
+}
|
|
|
+
|
|
|
+// List
|
|
|
+// @Title 列表
|
|
|
+// @Description 列表
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Param AiPredictModelIndexId query int true "标的id"
|
|
|
+// @Success 200 {object} []*data_manage.AiPredictModelIndexConfigView
|
|
|
+// @router /index_config/list [get]
|
|
|
+func (c *AiPredictModelIndexConfigController) List() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ pageSize, _ := c.GetInt("PageSize")
|
|
|
+ currentIndex, _ := c.GetInt("CurrentIndex")
|
|
|
+ indexId, _ := c.GetInt("AiPredictModelIndexId")
|
|
|
+
|
|
|
+ if indexId <= 0 {
|
|
|
+ br.Msg = "标的id不能为空"
|
|
|
+ br.ErrMsg = "标的id不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ var total int
|
|
|
+ viewList := make([]data_manage.AiPredictModelIndexConfigView, 0)
|
|
|
+
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ condition += fmt.Sprintf(` AND %s = ? `, data_manage.AiPredictModelIndexConfigColumns.AiPredictModelIndexId)
|
|
|
+ pars = append(pars, indexId)
|
|
|
+
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+ tmpTotal, list, err := obj.GetPageListByCondition(condition, pars, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ total = tmpTotal
|
|
|
+
|
|
|
+ if list != nil && len(list) > 0 {
|
|
|
+ viewList = list[0].ListToViewList(list)
|
|
|
+ }
|
|
|
+
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp := response.AiPredictModelIndexConfigListResp{
|
|
|
+ List: viewList,
|
|
|
+ Paging: page,
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// CurrVersion
|
|
|
+// @Title 获取当前版本参数信息
|
|
|
+// @Description 获取当前版本参数信息
|
|
|
+// @Param IndexId query int true "标的ID"
|
|
|
+// @Success 200 {object} []*data_manage.AiPredictModelIndexConfigView
|
|
|
+// @router /index_config/version/curr [get]
|
|
|
+func (c *AiPredictModelIndexConfigController) CurrVersion() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ indexId, _ := c.GetInt("IndexId")
|
|
|
+ if indexId <= 0 {
|
|
|
+ br.Msg = "标的id不能为空"
|
|
|
+ br.ErrMsg = "标的id不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询标的情况
|
|
|
+ indexOb := new(data_manage.AiPredictModelIndex)
|
|
|
+ indexItem, e := indexOb.GetItemById(indexId)
|
|
|
+ if e != nil {
|
|
|
+ if utils.IsErrNoRow(e) {
|
|
|
+ br.Msg = "标的已被删除,请刷新页面"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取标的失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if indexItem.AiPredictModelIndexConfigId <= 0 {
|
|
|
+ br.Msg = "标的默认配置为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+ configItem, err := obj.GetById(indexItem.AiPredictModelIndexConfigId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = configItem.ToView()
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+}
|
|
|
+
|
|
|
+// SetCurr
|
|
|
+// @Title 设置为当前版本
|
|
|
+// @Description 设置为当前版本
|
|
|
+// @Param request body request.DelConfigReq true "type json string"
|
|
|
+// @Success 200 Ret=200 设置成功
|
|
|
+// @router /index_config/version/set_curr [post]
|
|
|
+func (c *AiPredictModelIndexConfigController) SetCurr() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var req request.DelConfigReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ // 查找配置
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+ configItem, err := obj.GetById(req.AiPredictModelIndexConfigId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "修改失败"
|
|
|
+ br.ErrMsg = "修改失败,查找配置失败,Err:" + err.Error()
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "配置不存在"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询标的情况
|
|
|
+ indexOb := new(data_manage.AiPredictModelIndex)
|
|
|
+ indexItem, e := indexOb.GetItemById(configItem.AiPredictModelIndexId)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取失败,根据配置ID获取标的信息失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ indexItem.AiPredictModelIndexConfigId = configItem.AiPredictModelIndexConfigId
|
|
|
+ indexItem.ModifyTime = time.Now()
|
|
|
+ err = indexItem.Update([]string{indexOb.Cols().ModifyTime, indexOb.Cols().AiPredictModelIndexConfigId})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "操作失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("配置失败,Err:%v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|
|
|
+
|
|
|
+// Del
|
|
|
+// @Title 删除模型配置
|
|
|
+// @Description 删除模型配置
|
|
|
+// @Param request body request.DelConfigReq true "type json string"
|
|
|
+// @Success 200 Ret=200 删除成功
|
|
|
+// @router /index_config/del [post]
|
|
|
+func (c *AiPredictModelIndexConfigController) Del() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+ var req request.DelConfigReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.AiPredictModelIndexConfigId <= 0 {
|
|
|
+ br.Msg = "配置id不能为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找配置
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+ item, err := obj.GetById(req.AiPredictModelIndexConfigId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "修改失败"
|
|
|
+ br.ErrMsg = "修改失败,查找配置失败,Err:" + err.Error()
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "配置不存在"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找是否被标的引用为默认模型
|
|
|
+ {
|
|
|
+ // 查询标的情况
|
|
|
+ indexOb := new(data_manage.AiPredictModelIndex)
|
|
|
+ count, e := indexOb.GetCountByCondition(fmt.Sprintf(` AND %s = ? `, indexOb.Cols().AiPredictModelIndexConfigId), []interface{}{item.AiPredictModelIndexConfigId})
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "删除失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("删除失败,根据配置ID获取标的信息失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if count > 0 {
|
|
|
+ br.Msg = "删除失败,该版本配置正在被使用"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if !utils.InArrayByStr([]string{data_manage.TrainStatusSuccess, data_manage.TrainStatusFailed}, item.TrainStatus) {
|
|
|
+ br.Msg = "删除失败,该版本配置正在训练中"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ item.IsDeleted = 1
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ err = item.Update([]string{"IsDeleted", "ModifyTime"})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "删除失败"
|
|
|
+ br.ErrMsg = "删除失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = `删除成功`
|
|
|
+}
|
|
|
+
|
|
|
+// ChartDetail
|
|
|
+// @Title 获取当前版本的图表信息
|
|
|
+// @Description 获取当前版本的图表信息
|
|
|
+// @Param AiPredictModelIndexConfigId query int true "标的配置ID"
|
|
|
+// @Success 200 {object} []*data_manage.AiPredictModelIndexConfigView
|
|
|
+// @router /index_config/chart/detail [get]
|
|
|
+func (c *AiPredictModelIndexConfigController) ChartDetail() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ indexConfigId, _ := c.GetInt("AiPredictModelIndexConfigId")
|
|
|
+ if indexConfigId <= 0 {
|
|
|
+ br.Msg = "标的配置id不能为空"
|
|
|
+ br.ErrMsg = "标的配置id不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ resp := response.AiPredictModelDetailResp{}
|
|
|
+
|
|
|
+ // TODO 后面加上数据缓存
|
|
|
+
|
|
|
+ // 查找配置
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+ configItem, err := obj.GetById(indexConfigId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "修改失败"
|
|
|
+ br.ErrMsg = "修改失败,查找配置失败,Err:" + err.Error()
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "配置不存在"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查找是否被标的引用为默认模型
|
|
|
+ // 查询标的情况
|
|
|
+ indexOb := new(data_manage.AiPredictModelIndex)
|
|
|
+ indexItem, e := indexOb.GetItemByConfigId(configItem.AiPredictModelIndexConfigId)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取失败,根据配置ID获取标的信息失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取标的数据
|
|
|
+ dailyData := make([]*data_manage.AiPredictModelIndexConfigTrainData, 0)
|
|
|
+ {
|
|
|
+ dataOb := new(data_manage.AiPredictModelIndexConfigTrainData)
|
|
|
+ dataCond := fmt.Sprintf(` AND %s = ?`, data_manage.AiPredictModelIndexConfigTrainDataColumns.AiPredictModelIndexConfigId)
|
|
|
+ dataPars := make([]interface{}, 0)
|
|
|
+ dataPars = append(dataPars, configItem.AiPredictModelIndexConfigId)
|
|
|
+ list, e := dataOb.GetAllListByCondition(dataCond, dataPars, []string{}, fmt.Sprintf("%s DESC", data_manage.AiPredictModelIndexConfigTrainDataColumns.DataTime))
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取标的数据失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ // 日度数据
|
|
|
+ if v.Source == data_manage.ModelDataSourceDaily {
|
|
|
+ dailyData = append(dailyData, v)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 日度图表
|
|
|
+ if len(dailyData) > 0 {
|
|
|
+ dailyChartDetail, e := services.GetAiPredictConfigChartDetailByData(indexItem.IndexName, configItem, dailyData, data_manage.ModelDataSourceDaily)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("获取日度图表失败, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resp.DailyChartView = dailyChartDetail
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|
|
|
+
|
|
|
+// Train
|
|
|
+// @Title 训练模型
|
|
|
+// @Description 训练模型
|
|
|
+// @Param request body request.TrainReq true "type json string"
|
|
|
+// @Success 200 Ret=200 训练中
|
|
|
+// @router /index_config/train [post]
|
|
|
+func (c *AiPredictModelIndexConfigController) Train() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+ var req request.TrainReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.AiPredictModelIndexId <= 0 {
|
|
|
+ br.Msg = "标的id不能为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ paramsStrByte, err := json.Marshal(req.Params)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败!"
|
|
|
+ br.ErrMsg = "训练失败,参数转json失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 查询标的情况
|
|
|
+ indexOb := new(data_manage.AiPredictModelIndex)
|
|
|
+ indexItem, err := indexOb.GetItemById(req.AiPredictModelIndexId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败,查找标的失败"
|
|
|
+ br.ErrMsg = fmt.Sprintf("训练失败,查找标的失败, %v", err)
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "标的不存在"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if indexItem.ScriptPath == `` {
|
|
|
+ br.Msg = "训练失败,脚本路径不能为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ obj := new(data_manage.AiPredictModelIndexConfig)
|
|
|
+
|
|
|
+ // 查找当前标的是否存在待训练/训练中的模型
|
|
|
+ count, err := obj.GetCountByCondition(fmt.Sprintf(` AND %s = ? AND %s IN (?,?)`, data_manage.AiPredictModelIndexConfigColumns.AiPredictModelIndexId, data_manage.AiPredictModelIndexConfigColumns.TrainStatus), []interface{}{indexItem.AiPredictModelIndexId, data_manage.TrainStatusWaiting, data_manage.TrainStatusTraining})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败"
|
|
|
+ br.ErrMsg = "训练失败,查找待训练的模型失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if count > 0 {
|
|
|
+ br.Msg = "该标的存在待训练/训练中的模型,不允许重复训练"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.AiPredictModelIndexConfigId > 0 {
|
|
|
+ // 查找配置
|
|
|
+ item, err := obj.GetById(req.AiPredictModelIndexConfigId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败"
|
|
|
+ br.ErrMsg = "训练失败,查找配置失败,Err:" + err.Error()
|
|
|
+ if utils.IsErrNoRow(err) {
|
|
|
+ br.Msg = "配置不存在"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if item.AiPredictModelIndexId != indexItem.AiPredictModelIndexId {
|
|
|
+ br.Msg = "训练失败"
|
|
|
+ br.ErrMsg = "训练失败,配置与标的不匹配"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if item.TrainStatus != data_manage.TrainStatusFailed {
|
|
|
+ br.Msg = "该模型训练状态异常,不允许重新训练"
|
|
|
+ br.ErrMsg = "该模型训练状态异常,不允许重新训练,当前状态:" + item.TrainStatus
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.Params = string(paramsStrByte)
|
|
|
+ item.ModifyTime = time.Now()
|
|
|
+ err = item.Update([]string{"params", "modify_time"})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败"
|
|
|
+ br.ErrMsg = "训练失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 新增训练模型
|
|
|
+ item := &data_manage.AiPredictModelIndexConfig{
|
|
|
+ AiPredictModelIndexConfigId: 0,
|
|
|
+ AiPredictModelIndexId: indexItem.AiPredictModelIndexId,
|
|
|
+ TrainStatus: data_manage.TrainStatusWaiting,
|
|
|
+ Params: string(paramsStrByte),
|
|
|
+ TrainMse: "",
|
|
|
+ TrainR2: "",
|
|
|
+ TestMse: "",
|
|
|
+ TestR2: "",
|
|
|
+ Remark: "",
|
|
|
+ IsDeleted: 0,
|
|
|
+ LeftMin: "",
|
|
|
+ LeftMax: "",
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ }
|
|
|
+ err = item.Create()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "训练失败"
|
|
|
+ br.ErrMsg = "训练失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO 加入训练任务中
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = `训练中`
|
|
|
+}
|