浏览代码

修改指标生成

longyu 2 年之前
父节点
当前提交
2ff6a9c4d8
共有 1 个文件被更改,包括 11 次插入101 次删除
  1. 11 101
      controller/index/index.go

+ 11 - 101
controller/index/index.go

@@ -11,6 +11,7 @@ import (
 	"hongze/mysteel_watch/models/index"
 	"hongze/mysteel_watch/utils"
 	"hongze/mysteel_watch/watch"
+	"time"
 )
 
 type IndexController struct {
@@ -55,7 +56,15 @@ func (s *IndexController) Create(c *gin.Context) {
 		templateFile.Close()
 	}()
 
-	commentStr := `"BlankValue":"0","CanMark":true,"ChartLineType":"0","DateBlock":0,"DateBlockCount":1,"DateFormat":0,"DateTimeTag":"637979007914770000","EndDate":"","ExportType":0,"HasDescription":true,"HasEmptyRows":false,"HasFrequency":true,"HasIndexID":true,"HasLastDate":true,"HasSourceName":true,"HasTimeInterval":true,"HasUnit":true,"HasUpdateDate":true,"IsCreateChart":false,"IsDataSort":true,"IsNewSheet":false,"IsNewWorkbook":false,"Models":[{"DataFormat":0,"DataStartDate":"2011-03-25","DefineName":"","DefineUnit":"","DisplayIndexCode":"ID01027043","IndexCode":"ID01027043","IndexFormula":"ID01027043","PointValue":0,"UnionStart":""}],"Position":"A1","RangeData":"A2:B2791","ShowBlankLines":false,"StartDate":"","Transpose":false,"UpdateMode":0,"lookModel":{"IsLast":false,"LookValue":0,"lookType":0},"ver":3}`
+	timeTag := time.Now().UnixNano() / 1e6
+	timeTagStr := fmt.Sprintf("%d", timeTag)
+	//UpdateMode:1:增量更新,0:全量更新
+	commentStr := `"BlankValue":"0","CanMark":true,"ChartLineType":"0","DateBlock":0,"DateBlockCount":1,"DateFormat":0,"DateTimeTag":` + timeTagStr + `,"EndDate":"",
+                   "ExportType":0,"HasDescription":true,"HasEmptyRows":false,"HasFrequency":true,"HasIndexID":true,"HasLastDate":true,"HasSourceName":true,"HasTimeInterval":true,
+                   "HasUnit":true,"HasUpdateDate":true,"IsCreateChart":false,"IsDataSort":true,"IsNewSheet":false,"IsNewWorkbook":false,
+                   "Models":[{"DataFormat":0,"DataStartDate":"2011-03-25","DefineName":"","DefineUnit":"","DisplayIndexCode":` + req.IndexCode + `,
+                   "IndexCode":` + req.IndexCode + `,"IndexFormula":` + req.IndexCode + `,"PointValue":0,"UnionStart":""}],"Position":"A1","RangeData":"A2:B2791",
+                   "ShowBlankLines":false,"StartDate":"","Transpose":false,"UpdateMode":1,"lookModel":{"IsLast":false,"LookValue":0,"lookType":0},"ver":3}`
 
 	commentMap := make(map[string]interface{})
 	commentMap["author"] = "{"
@@ -84,103 +93,4 @@ func (s *IndexController) Test(c *gin.Context) {
 	watch.TestWatch()
 	resp.OkData("检测成功", 1, c)
 	return
-}
-
-type IndexComment struct {
-	BlankValue      string       `json:"BlankValue"`
-	CanMark         bool         `json:"CanMark"`
-	ChartLineType   string       `json:"ChartLineType"`
-	DateBlock       int64        `json:"DateBlock"`
-	DateBlockCount  int64        `json:"DateBlockCount"`
-	DateFormat      int64        `json:"DateFormat"`
-	DateTimeTag     string       `json:"DateTimeTag"`
-	EndDate         string       `json:"EndDate"`
-	ExportType      int64        `json:"ExportType"`
-	HasDescription  bool         `json:"HasDescription"`
-	HasEmptyRows    bool         `json:"HasEmptyRows"`
-	HasFrequency    bool         `json:"HasFrequency"`
-	HasIndexID      bool         `json:"HasIndexID"`
-	HasLastDate     bool         `json:"HasLastDate"`
-	HasSourceName   bool         `json:"HasSourceName"`
-	HasTimeInterval bool         `json:"HasTimeInterval"`
-	HasUnit         bool         `json:"HasUnit"`
-	HasUpdateDate   bool         `json:"HasUpdateDate"`
-	IsCreateChart   bool         `json:"IsCreateChart"`
-	IsDataSort      bool         `json:"IsDataSort"`
-	IsNewSheet      bool         `json:"IsNewSheet"`
-	IsNewWorkbook   bool         `json:"IsNewWorkbook"`
-	Models          []ModelsInfo `json:"Models"`
-	Position        string       `json:"Position"`
-	RangeData       string       `json:"RangeData"`
-	ShowBlankLines  bool         `json:"ShowBlankLines"`
-	StartDate       string       `json:"StartDate"`
-	Transpose       bool         `json:"Transpose"`
-	UpdateMode      int64        `json:"UpdateMode"`
-	LookModel       struct {
-		IsLast    bool  `json:"IsLast"`
-		LookValue int64 `json:"LookValue"`
-		LookType  int64 `json:"lookType"`
-	} `json:"lookModel"`
-	Ver int64 `json:"ver"`
-}
-
-type ModelsInfo struct {
-	DataFormat       int64  `json:"DataFormat"`
-	DataStartDate    string `json:"DataStartDate"`
-	DefineName       string `json:"DefineName"`
-	DefineUnit       string `json:"DefineUnit"`
-	DisplayIndexCode string `json:"DisplayIndexCode"`
-	IndexCode        string `json:"IndexCode"`
-	IndexFormula     string `json:"IndexFormula"`
-	PointValue       int64  `json:"PointValue"`
-	UnionStart       string `json:"UnionStart"`
-}
-
-//
-//commentItem := new(IndexComment)
-//commentItem.BlankValue = "0"
-//commentItem.CanMark = true
-//commentItem.ChartLineType = "0"
-//commentItem.DateBlock = 0
-//commentItem.DateBlockCount = 1
-//commentItem.DateFormat = 0
-//commentItem.DateTimeTag = "637979007914770000"
-//commentItem.EndDate = ""
-//commentItem.ExportType = 0
-//commentItem.HasDescription = true
-//commentItem.HasEmptyRows = false
-//commentItem.HasFrequency = true
-//commentItem.HasIndexID = true
-//commentItem.HasSourceName = true
-//commentItem.HasTimeInterval = true
-//commentItem.HasUnit = true
-//commentItem.HasUpdateDate = true
-//commentItem.IsCreateChart = false
-//commentItem.IsDataSort = true
-//commentItem.IsNewSheet = false
-//commentItem.IsNewWorkbook = false
-//
-//model := new(ModelsInfo)
-//model.DataFormat = 0
-//model.DataStartDate = "2011-03-25"
-//model.DefineName = ""
-//model.DefineUnit = ""
-//model.DisplayIndexCode = req.IndexCode
-//model.IndexCode = req.IndexCode
-//model.IndexFormula = req.IndexCode
-//model.PointValue = 0
-//model.UnionStart = ""
-//commentItem.Models = append(commentItem.Models, *model)
-//commentItem.Position = "A1"
-//commentItem.RangeData = "A2:B2791"
-//commentItem.ShowBlankLines = false
-//commentItem.StartDate = ""
-//commentItem.Transpose = false
-//commentItem.UpdateMode = 0
-//commentItem.LookModel.IsLast = false
-//commentItem.LookModel.LookValue = 0
-//commentItem.LookModel.LookType = 0
-//commentItem.Ver = 3
-
-//8.136.199.33
-//datamysteel.hzinsights.com
+}