package controllers import ( "context" "eta/eta_data_analysis/models" "eta/eta_data_analysis/services" "fmt" "github.com/beego/beego/v2/server/web" ) type YongyiController struct { web.Controller } // Analysis // @Title 解析涌溢咨询excel文件 // @Description 合同套餐列表 // @Param DayFlag query int false // @Param WeekFlag query int false // @Success 200 {object} company.GetUnusualRenewListGroupMonthResp // @router /analysis [get] func (this *YongyiController) Analysis() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() // 起始日期 // 截止日期 dayFlag, _ := this.GetInt("DayFlag") weekFlag, _ := this.GetInt("WeekFlag") var err error if dayFlag == 1 { err = services.YongyiDownloadDaily(context.TODO()) if err != nil { fmt.Println(err) br.Msg = "操作异常" br.ErrMsg = "操作异常,Err:" + err.Error() return } } if weekFlag == 1 { err = services.YongyiDownloadWeekyly(context.TODO()) if err != nil { fmt.Println(err) br.Msg = "操作异常" br.ErrMsg = "操作异常,Err:" + err.Error() return } } br.Ret = 200 br.Success = true br.Msg = "操作成功" }