Ver código fonte

fix:完善报告详情

zqbao 9 meses atrás
pai
commit
bb76800585
4 arquivos alterados com 16 adições e 15 exclusões
  1. 3 3
      controllers/report.go
  2. 0 11
      models/response/report.go
  3. 5 1
      services/report.go
  4. 8 0
      utils/constants.go

+ 3 - 3
controllers/report.go

@@ -34,8 +34,8 @@ func (this *ReportController) Detail() {
 		return
 	}
 
-	if result.Ret != 200 {
-		br.Msg = "查询报告详情失败"
+	if result.Ret == 403 {
+		br.Msg = result.Msg
 		br.ErrMsg = result.ErrMsg
 		return
 	}
@@ -43,7 +43,7 @@ func (this *ReportController) Detail() {
 	br.Msg = "查询成功"
 	br.Success = true
 	br.Ret = 200
-	br.Data = result
+	br.Data = result.Data
 }
 
 // @Title 研报列表

+ 0 - 11
models/response/report.go

@@ -10,14 +10,3 @@ type ReportListResp struct {
 	List   []*models.ReportList
 	Paging *paging.PagingItem
 }
-
-type ReportDetailResp struct {
-	Report   *models.ReportDetail   `description:"报告"`
-	Classify *models.ClassifyDetail `description:"对应专栏"`
-}
-
-type ReportResp[T any] struct {
-	Ret  int
-	Data T
-	Msg  string
-}

+ 5 - 1
services/report.go

@@ -24,6 +24,10 @@ type ReportResp[T any] struct {
 	Msg    string
 	ErrMsg string
 }
+type ReportDetailResp struct {
+	Report *models.ReportDetail `description:"报告"`
+	Status int                  `description:"报告状态"`
+}
 
 func GetReportList(chartPermissionId, level, rangeType, currentIndex, pageSize int) (resp *ReportResp[ReportList], err error) {
 	url := utils.ETA_MINI_BRIDGE_URL + "/report/list?"
@@ -66,7 +70,7 @@ func GetReportList(chartPermissionId, level, rangeType, currentIndex, pageSize i
 
 }
 
-func GetReportDetail(reportId, userId int) (resp *ReportResp[models.ReportDetail], err error) {
+func GetReportDetail(reportId, userId int) (resp *ReportResp[ReportDetailResp], err error) {
 	url := utils.ETA_MINI_BRIDGE_URL + "/report/detail?"
 	url += fmt.Sprintf("ReportId=%d&UserId=%d", reportId, userId)
 	fmt.Println(url)

+ 8 - 0
utils/constants.go

@@ -6,6 +6,14 @@ const (
 	VerifyCodeExpireMinute = 15                // 短信/邮箱验证码过期时间-分钟
 )
 
+// 报告权限状态定义
+const (
+	ReportPermissionStatusExpired      = 1 //已过期
+	ReportPermissionStatusNoPermission = 2 //没有该品种权限
+	ReportPermissionStatusNo           = 3 //没有权限
+	ReportPermissionStatusHas          = 4 //有该品种权限
+)
+
 // 常量定义
 const (
 	FormatTime            = "15:04:05"                //时间格式