yongyi.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package controllers
  2. import (
  3. "context"
  4. "eta/eta_data_analysis/models"
  5. "eta/eta_data_analysis/services"
  6. "fmt"
  7. "github.com/beego/beego/v2/server/web"
  8. )
  9. type YongyiController struct {
  10. web.Controller
  11. }
  12. // Analysis
  13. // @Title 解析涌溢咨询excel文件
  14. // @Description 合同套餐列表
  15. // @Param DayFlag query int false
  16. // @Param WeekFlag query int false
  17. // @Success 200 {object} company.GetUnusualRenewListGroupMonthResp
  18. // @router /analysis [get]
  19. func (this *YongyiController) Analysis() {
  20. br := new(models.BaseResponse).Init()
  21. defer func() {
  22. this.Data["json"] = br
  23. this.ServeJSON()
  24. }()
  25. // 起始日期
  26. // 截止日期
  27. dayFlag, _ := this.GetInt("DayFlag")
  28. weekFlag, _ := this.GetInt("WeekFlag")
  29. var err error
  30. if dayFlag == 1 {
  31. err = services.YongyiDownloadDaily(context.TODO())
  32. if err != nil {
  33. fmt.Println(err)
  34. br.Msg = "操作异常"
  35. br.ErrMsg = "操作异常,Err:" + err.Error()
  36. return
  37. }
  38. }
  39. if weekFlag == 1 {
  40. err = services.YongyiDownloadWeekyly(context.TODO())
  41. if err != nil {
  42. fmt.Println(err)
  43. br.Msg = "操作异常"
  44. br.ErrMsg = "操作异常,Err:" + err.Error()
  45. return
  46. }
  47. }
  48. br.Ret = 200
  49. br.Success = true
  50. br.Msg = "操作成功"
  51. }