package fix

import (
	"eta/eta_index_lib/controllers"
	"eta/eta_index_lib/models"
	"eta/eta_index_lib/services/fix"
)

// CustomAnalysisController 自定义分析
type CustomAnalysisController struct {
	controllers.BaseAuthController
}

var fixTable = false

// FixTableV1
// @Title 指标详情接口
// @Description  指标详情接口
// @Success 200 {object} models.EdbInfoDetailReq
// @router /v1 [post]
func (this *CustomAnalysisController) FixTableV1() {
	br := new(models.BaseResponse).Init()
	defer func() {
		this.Data["json"] = br
		this.ServeJSON()
	}()

	if fixTable {
		br.Ret = 200
		br.Success = true
		br.Msg = "请不要重复修复"
		return
	}
	fixTable = true
	//ETA1.0.2 自定义分析（生成指标数据修复）
	fix.FixTableData()
	//ETA1.0.2 自定义分析（修复excel与指标的关系）
	fix.FixTableDataMapping()

	br.Ret = 200
	br.Success = true
	br.Msg = "修复成功"
}
