123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- package controllers
- import (
- "eta/eta_mini_api/models"
- "eta/eta_mini_api/services"
- )
- type ReportController struct {
- BaseAuthController
- }
- // @Title 日评详情
- // @Description 日评详情接口
- // @Param ReportId query int true "报告id"
- // @Success 200 {object} models.ReportDetailResp
- // @router /detail [get]
- func (this *ReportController) Detail() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- reportId, _ := this.GetInt("ReportId")
- if reportId <= 0 {
- br.Msg = "报告不存在"
- return
- }
- result, err := services.GetReportDetail(reportId)
- if err != nil {
- br.Msg = "查询报告详情失败"
- br.ErrMsg = "查询报告失败,系统异常,Err:" + err.Error()
- return
- }
- if result.Ret != 200 {
- br.Msg = "查询报告详情失败"
- br.ErrMsg = result.ErrMsg
- return
- }
- br.Msg = "查询成功"
- br.Success = true
- br.Ret = 200
- br.Data = result
- }
- // @Title 研报列表
- // @Description 研报列表
- // @Param ReportId query int true "报告id"
- // @Param chartPermissionId query int true "品种ID"
- // @Param Level query int true "品种层级"
- // @Param PageSize query int true "每页数据条数"
- // @Param CurrentIndex query int true "当前页页码,从1开始"
- // @Success 200 {object} models.ReportDetailResp
- // @router /list [get]
- func (this *ReportController) List() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- pageSize, _ := this.GetInt("PageSize")
- currentIndex, _ := this.GetInt("CurrentIndex")
- chartPermissionId, _ := this.GetInt("ChartPermissionId")
- level, _ := this.GetInt("Level")
- reports, err := services.GetReportList(chartPermissionId, level, currentIndex, pageSize)
- if err != nil {
- br.Msg = "研报列表查询失败"
- br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
- return
- }
- if reports.Ret != 200 {
- br.Msg = "研报列表查询失败"
- br.ErrMsg = reports.ErrMsg
- return
- }
- br.Data = reports.Data
- br.Msg = "查询成功"
- br.Ret = 200
- br.Success = true
- }
- // @Title 研报列表
- // @Description 研报列表
- // @Param ReportId query int true "报告id"
- // @Param chartPermissionId query int true "品种ID"
- // @Param PageSize query int true "每页数据条数"
- // @Param CurrentIndex query int true "当前页页码,从1开始"
- // @Success 200 {object} models.ReportDetailResp
- // @router /daily/list [get]
- func (this *ReportController) DailyList() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- pageSize, _ := this.GetInt("PageSize")
- currentIndex, _ := this.GetInt("CurrentIndex")
- reports, err := services.GetReportDailyList(currentIndex, pageSize)
- if err != nil {
- br.Msg = "研报列表查询失败"
- br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
- return
- }
- br.Data = reports.Data
- br.Msg = "查询成功"
- br.Ret = 200
- br.Success = true
- }
|