瀏覽代碼

fix:修复报告详情权限不匹配问题,以前写死ficc最大权限数量15个,现在是从表中获取

Roc 3 年之前
父節點
當前提交
6d53a85bb0
共有 2 個文件被更改,包括 35 次插入2 次删除
  1. 18 2
      controllers/report.go
  2. 17 0
      rdlucklog/hongze_api.log

+ 18 - 2
controllers/report.go

@@ -2,6 +2,7 @@ package controllers
 
 import (
 	"encoding/json"
+	"fmt"
 	"hongze/hongze_api/models"
 	"hongze/hongze_api/services"
 	"hongze/hongze_api/utils"
@@ -72,11 +73,26 @@ func (this *ReportController) Detail() {
 	maxPermissionCount := 0
 	if strings.Contains(report.ClassifyNameFirst, "权益研报") {
 		productId = 2
-		maxPermissionCount = 5
 	} else {
 		productId = 1
-		maxPermissionCount = 15
 	}
+
+	maxPermissionCountKey := fmt.Sprint(`hongze_api:max_permission_count:product_id:`, productId)
+	maxPermissionCount, err = utils.Rc.RedisInt(maxPermissionCountKey)
+	if err != nil || maxPermissionCount <= 0 {
+		maxPermissionCount, err = models.GetDefaultChartPermissionCount(productId)
+		if err != nil {
+			br.Msg = "获取报告详情失败"
+			br.ErrMsg = "获取产品默认最大权限数量失败,Err:" + err.Error()
+			return
+		}
+		utils.Rc.SetNX(maxPermissionCountKey, maxPermissionCount, time.Second*3600)
+	}
+	//ficc需要移除策略的权限
+	if productId == 1 {
+		maxPermissionCount = maxPermissionCount - 1
+	}
+
 	utils.FileLog.Info("report.detail %d,%d", user.CompanyId, productId)
 	company, err := models.GetCompanyProductById(user.CompanyId, productId)
 	if err != nil {

+ 17 - 0
rdlucklog/hongze_api.log

@@ -24,3 +24,20 @@
 2021/03/25 17:39:07.585 [I]  URI:/api/user/test
 2021/03/25 18:13:44.363 [I]  authorization:,cookie:
 2021/03/25 18:13:44.363 [I]  URI:/api/user/test
+2021/12/27 15:46:15.270  [I]  report.detail %d,%d
+2021/12/27 15:47:21.520  [I]  report.detail %d,%d
+2021/12/27 16:04:51.261  [I]  report.detail %d,%d
+2021/12/27 16:07:39.767  [I]  report.detail %d,%d
+2021/12/27 16:15:49.469  [I]  report.detail %d,%d
+2021/12/27 16:28:10.388  [I]  report.detail %d,%d
+2021/12/27 16:28:13.988  [I]  report.detail %d,%d
+2021/12/27 16:28:43.217  [I]  report.detail %d,%d
+2021/12/27 16:29:08.326  [I]  report.detail %d,%d
+2021/12/27 16:33:02.454  [I]  report.detail %d,%d
+2021/12/27 16:38:13.015  [I]  report.detail %d,%d
+2021/12/27 16:43:47.238  [I]  report.detail %d,%d
+2021/12/27 16:45:29.302  [I]  report.detail %d,%d
+2021/12/27 16:46:02.031  [I]  report.detail %d,%d
+2021/12/27 16:47:36.435  [I]  report.detail %d,%d
+2021/12/27 16:57:39.059  [I]  report.detail %d,%d
+2021/12/27 16:58:07.198  [I]  report.detail %d,%d