1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package controllers
- import (
- "eta/eta_task/models"
- "eta/eta_task/services"
- "eta/eta_task/utils"
- "github.com/beego/beego/v2/server/web"
- "time"
- )
- type DataInitController struct {
- web.Controller
- }
- // InitEdbRelation
- // @Title 初始化历史的图表、表格等引用记录
- // @Description 初始化历史的图表、表格等引用记录
- // @Param request body fe_calendar.FeCalendarMatterSaveReq true "type json string"
- // @Success 200 string "操作成功"
- // @router /relation_init [get]
- func (c *DataInitController) InitEdbRelation() {
- br := new(models.BaseResponse).Init()
- defer func() {
- c.Data["json"] = br
- c.ServeJSON()
- }()
- cacheKey := "eta_task:InitEdbRelation"
- deleteCache := true
- defer func() {
- if deleteCache {
- utils.Rc.Delete(cacheKey)
- }
- }()
- if !utils.Rc.SetNX(cacheKey, 1, 5*time.Minute) {
- deleteCache = false
- br.Msg = `系统处理中,请稍后重试!`
- return
- }
- services.InitChartEdbRelation()
- services.InitChartCrossVariety()
- services.InitCalendarIndicatorRelation()
- services.InitSandBoxEdbRelation()
- services.InitExcelEdbRelation()
- br.Ret = 200
- br.Success = true
- br.Msg = "处理成功"
- }
- func (c *DataInitController) DisableEdbRefresh() {
- br := new(models.BaseResponse).Init()
- defer func() {
- c.Data["json"] = br
- c.ServeJSON()
- }()
- br.Ret = 200
- br.Success = true
- br.Msg = "处理成功"
- }
|